deps: upgrade to NUnit 4

This commit is contained in:
Kyle Ratti 2024-04-30 13:39:53 -04:00
parent d4d0469858
commit 1ad8e46ab5
No known key found for this signature in database
GPG Key ID: 4D429B6287C68DD9
3 changed files with 19 additions and 15 deletions

View File

@ -10,10 +10,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@ -11,22 +11,22 @@ public class MaybeExtensionTests
[Test]
public void EnumerableFirstOrEmptyTests()
{
Assert.AreEqual(Maybe.Empty<string>(), Array.Empty<string>().FirstOrEmpty());
Assert.AreEqual(Maybe.Create<string>("banana"), new[] { "banana" }.FirstOrEmpty());
Assert.That(Array.Empty<string>().FirstOrEmpty(), Is.EqualTo(Maybe.Empty<string>()));
Assert.That(new[] { "banana" }.FirstOrEmpty(), Is.EqualTo(Maybe.Create<string>("banana")));
}
[Test]
public void TestToMaybe()
{
Assert.AreEqual(Maybe.Empty<int>(), Maybe.Empty<int>());
Assert.AreNotEqual(Maybe.Create(293921), Maybe.Create(2));
Assert.That(Maybe.Empty<int>(), Is.EqualTo(Maybe.Empty<int>()));
Assert.That(Maybe.Create(2), Is.Not.EqualTo(Maybe.Create(293921)));
}
[Test]
public void MaybeNullableTests()
{
Assert.IsNull(Maybe.Empty<int>().ToNullable());
Assert.IsNull(Maybe.Create(0, evalIsEmpty: () => true).ToNullable());
Assert.That(Maybe.Empty<int>().ToNullable(), Is.Null);
Assert.That(Maybe.Create(0, evalIsEmpty: () => true).ToNullable(), Is.Null);
}
[Test]

View File

@ -7,12 +7,16 @@ namespace Base.Tests.Structures;
public class NullableExtensionTests
{
[Test]
public void TestNullableStructOfNullToMaybe() =>
Assert.AreEqual(Maybe.Empty<int>(), ((int?)null).ToMaybe());
public void TestNullableStructOfNullToMaybe()
{
Assert.That(((int?)null).ToMaybe(), Is.EqualTo(Maybe.Empty<int>()));
}
[Test]
public void TestNullableStructOfValueToMaybe() =>
Assert.AreEqual(Maybe.Create(25), ((int?)25).ToMaybe());
public void TestNullableStructOfValueToMaybe()
{
Assert.That(((int?)25).ToMaybe(), Is.EqualTo(Maybe.Create(25)));
}
[Test]
public void TestNullableReferenceOfNullAsMaybe()