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

View File

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

View File

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