From 5463c06e44d46f6472081ae49a72b49930e9b56e Mon Sep 17 00:00:00 2001 From: RzR <108324929+I-RzR-I@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:53:27 +0200 Subject: [PATCH] Add enumerable utils some tests. --- LICENSE | 2 +- src/shared/GeneralAssemblyInfo.cs | 2 +- .../DataTypeTests/EnumerateUtilsTests.cs | 71 +++++++++++++++++++ 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 src/tests/DataTypeTests/EnumerateUtilsTests.cs diff --git a/LICENSE b/LICENSE index e60ac80..4fa0a8e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2024 RzR +Copyright (c) 2022-2025 RzR Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/shared/GeneralAssemblyInfo.cs b/src/shared/GeneralAssemblyInfo.cs index 2c8f46a..64ae97f 100644 --- a/src/shared/GeneralAssemblyInfo.cs +++ b/src/shared/GeneralAssemblyInfo.cs @@ -29,7 +29,7 @@ [assembly: AssemblyCompany("RzR ®")] [assembly: AssemblyProduct("Common data type extensions")] -[assembly: AssemblyCopyright("Copyright © 2022-2024 RzR All rights reserved.")] +[assembly: AssemblyCopyright("Copyright © 2022-2025 RzR All rights reserved.")] [assembly: AssemblyTrademark("® RzR™")] [assembly: AssemblyDescription( diff --git a/src/tests/DataTypeTests/EnumerateUtilsTests.cs b/src/tests/DataTypeTests/EnumerateUtilsTests.cs new file mode 100644 index 0000000..52eb853 --- /dev/null +++ b/src/tests/DataTypeTests/EnumerateUtilsTests.cs @@ -0,0 +1,71 @@ +// *********************************************************************** +// Assembly : RzR.Shared.Extensions.DataTypeTests +// Author : RzR +// Created On : 2025-01-09 20:50 +// +// Last Modified By : RzR +// Last Modified On : 2025-01-09 20:50 +// *********************************************************************** +// +// Copyright © RzR. All rights reserved. +// +// +// +// +// *********************************************************************** + +using System.Linq; +using DomainCommonExtensions.Utilities; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace DataTypeTests +{ + [TestClass] + public class EnumerateUtilsTests + { + [TestMethod] + public void Int32_FromTo_0_2_Test() + { + var list = EnumerateUtils.FromTo(0, 2); + + Assert.IsNotNull(list); + Assert.IsTrue(list.Count() == 3); + } + + [TestMethod] + public void Int32_FromTo_0_0_Test() + { + var list = EnumerateUtils.FromTo(0, 0); + + Assert.IsNotNull(list); + Assert.IsTrue(list.Count() == 1); + } + + [TestMethod] + public void Int32_FromTo_Minus5_0_Test() + { + var list = EnumerateUtils.FromTo(-5, 0); + + Assert.IsNotNull(list); + Assert.IsTrue(list.Count() == 6); + } + + [TestMethod] + public void Int32_FromTo_4_3_Test() + { + var list = EnumerateUtils.FromTo(4, 3); + + Assert.IsNotNull(list); + Assert.IsFalse(list.Any()); + } + + [TestMethod] + public void PowersOf_Test() + { + var list = EnumerateUtils.PowersOf(2, 4); + + Assert.IsNotNull(list); + Assert.IsTrue(list.Any()); + } + } +} \ No newline at end of file