From 08acbe0bf89b0d3a4e522289f4e5bb0ca8796ec9 Mon Sep 17 00:00:00 2001 From: Filip Strajnar Date: Tue, 7 May 2024 18:05:11 +0200 Subject: [PATCH] Added unit tests for AioNet.Linq. --- AioNet.LinqTest/AioNet.LinqTest.csproj | 29 ++++++++++++++++++++++++++ AioNet.LinqTest/ExtendedLinqTest.cs | 18 ++++++++++++++++ AioNet.LinqTest/GlobalUsings.cs | 1 + AioNet.sln | 6 ++++++ 4 files changed, 54 insertions(+) create mode 100644 AioNet.LinqTest/AioNet.LinqTest.csproj create mode 100644 AioNet.LinqTest/ExtendedLinqTest.cs create mode 100644 AioNet.LinqTest/GlobalUsings.cs diff --git a/AioNet.LinqTest/AioNet.LinqTest.csproj b/AioNet.LinqTest/AioNet.LinqTest.csproj new file mode 100644 index 0000000..7a21d60 --- /dev/null +++ b/AioNet.LinqTest/AioNet.LinqTest.csproj @@ -0,0 +1,29 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/AioNet.LinqTest/ExtendedLinqTest.cs b/AioNet.LinqTest/ExtendedLinqTest.cs new file mode 100644 index 0000000..b23879b --- /dev/null +++ b/AioNet.LinqTest/ExtendedLinqTest.cs @@ -0,0 +1,18 @@ +namespace AioNet.LinqTest; + +using AioNet.Linq; + +public class ExtendedLinqTest +{ + [Fact] + public void FindOneCombinationFor3Elements_SubsequenceLength3() + { + var foundCombinations = new[] { 1, 2, 3 }.Combinations(3); + Assert.Single(foundCombinations); + + var onlyCombination = foundCombinations.First(); + Assert.Contains(1, onlyCombination); + Assert.Contains(2, onlyCombination); + Assert.Contains(3, onlyCombination); + } +} diff --git a/AioNet.LinqTest/GlobalUsings.cs b/AioNet.LinqTest/GlobalUsings.cs new file mode 100644 index 0000000..c802f44 --- /dev/null +++ b/AioNet.LinqTest/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; diff --git a/AioNet.sln b/AioNet.sln index 0fc4460..da41755 100644 --- a/AioNet.sln +++ b/AioNet.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AioNet.Linq", "AioNet.Linq\AioNet.Linq.csproj", "{575A2A25-59BF-4ED1-8278-0BFCD24D65B1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AioNet.LinqTest", "AioNet.LinqTest\AioNet.LinqTest.csproj", "{30BEA554-220B-4A76-99AC-05E482EE18D9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -18,5 +20,9 @@ Global {575A2A25-59BF-4ED1-8278-0BFCD24D65B1}.Debug|Any CPU.Build.0 = Debug|Any CPU {575A2A25-59BF-4ED1-8278-0BFCD24D65B1}.Release|Any CPU.ActiveCfg = Release|Any CPU {575A2A25-59BF-4ED1-8278-0BFCD24D65B1}.Release|Any CPU.Build.0 = Release|Any CPU + {30BEA554-220B-4A76-99AC-05E482EE18D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30BEA554-220B-4A76-99AC-05E482EE18D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30BEA554-220B-4A76-99AC-05E482EE18D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30BEA554-220B-4A76-99AC-05E482EE18D9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal