Added unit tests for AioNet.Linq.

This commit is contained in:
Filip Strajnar 2024-05-07 18:05:11 +02:00
parent 1b5effa51a
commit 08acbe0bf8
4 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AioNet.Linq\AioNet.Linq.csproj" />
</ItemGroup>
</Project>

View file

@ -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);
}
}

View file

@ -0,0 +1 @@
global using Xunit;

View file

@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AioNet.Linq", "AioNet.Linq\AioNet.Linq.csproj", "{575A2A25-59BF-4ED1-8278-0BFCD24D65B1}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AioNet.Linq", "AioNet.Linq\AioNet.Linq.csproj", "{575A2A25-59BF-4ED1-8278-0BFCD24D65B1}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AioNet.LinqTest", "AioNet.LinqTest\AioNet.LinqTest.csproj", "{30BEA554-220B-4A76-99AC-05E482EE18D9}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{575A2A25-59BF-4ED1-8278-0BFCD24D65B1}.Release|Any CPU.Build.0 = 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 EndGlobalSection
EndGlobal EndGlobal