Skip to content

Commit 7755da5

Browse files
authored
feat: Migrated to TUnit (#392)
1 parent f1cc67c commit 7755da5

13 files changed

+64
-140
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ indent_size = 4
4242
generated_code = true
4343

4444
# XML project files
45-
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,nativeproj,locproj}]
45+
[*.{slnx,csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,nativeproj,locproj}]
4646
indent_size = 2
4747

4848
# Xml build files

Directory.Packages.props

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
1515
</ItemGroup>
1616
<ItemGroup>
17-
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
18-
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
19-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
17+
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
18+
<PackageVersion Include="NetEvolve.Extensions.TUnit" Version="2.7.59" />
2019
<PackageVersion Include="NetEvolve.Extensions.XUnit" Version="2.7.59" />
21-
<PackageVersion Include="Polyfill" Version="9.0.3" />
22-
<PackageVersion Include="xunit" Version="2.9.3" />
23-
<PackageVersion Include="xunit.runner.visualstudio" Version="3.0.2" />
20+
<PackageVersion Include="Polyfill" Version="9.1.0" />
21+
<PackageVersion Include="TUnit" Version="1.2.11" />
22+
<PackageVersion Include="Verify.TUnit" Version="31.7.1" />
2423
</ItemGroup>
2524
</Project>

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System.Diagnostics.CodeAnalysis;
4-
using NetEvolve.Extensions.XUnit;
4+
using NetEvolve.Extensions.TUnit;
55

66
[ExcludeFromCodeCoverage]
77
[UnitTest]

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests_ThrowIfEqual.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
4+
using System.Threading.Tasks;
55

66
public sealed partial class ArgumentTests
77
{
8-
[Fact]
8+
[Test]
99
public void ThrowIfEqual_WhenArgumentIsEqualToMaximum_ThrowsArgumentOutOfRangeException()
1010
{
1111
// Arrange
@@ -19,8 +19,8 @@ public void ThrowIfEqual_WhenArgumentIsEqualToMaximum_ThrowsArgumentOutOfRangeEx
1919
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
2020
}
2121

22-
[Fact]
23-
public void ThrowIfEqual_WhenArgumentIsNotEqualToMaximum_ReturnsArgument()
22+
[Test]
23+
public async Task ThrowIfEqual_WhenArgumentIsNotEqualToMaximum_ReturnsArgument()
2424
{
2525
// Arrange
2626
var argument = 2;
@@ -29,7 +29,6 @@ public void ThrowIfEqual_WhenArgumentIsNotEqualToMaximum_ReturnsArgument()
2929
// Act
3030
Argument.ThrowIfEqual(argument, maximum);
3131

32-
// Assert
33-
Assert.True(true);
32+
_ = await Assert.That(maximum).IsEqualTo(1);
3433
}
3534
}

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests_ThrowIfGreaterThan.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
4+
using System.Threading.Tasks;
55

66
public sealed partial class ArgumentTests
77
{
8-
[Fact]
8+
[Test]
99
public void ThrowIfGreaterThan_WhenArgumentIsGreaterThanMaximum_ThrowsArgumentOutOfRangeException()
1010
{
1111
// Arrange
@@ -19,8 +19,8 @@ public void ThrowIfGreaterThan_WhenArgumentIsGreaterThanMaximum_ThrowsArgumentOu
1919
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
2020
}
2121

22-
[Fact]
23-
public void ThrowIfGreaterThan_WhenArgumentIsEqualToMaximum_ReturnsArgument()
22+
[Test]
23+
public async Task ThrowIfGreaterThan_WhenArgumentIsEqualToMaximum_ReturnsArgument()
2424
{
2525
// Arrange
2626
var argument = 1;
@@ -30,6 +30,6 @@ public void ThrowIfGreaterThan_WhenArgumentIsEqualToMaximum_ReturnsArgument()
3030
Argument.ThrowIfGreaterThan(argument, maximum);
3131

3232
// Assert
33-
Assert.True(true);
33+
_ = await Assert.That(maximum).IsEqualTo(1);
3434
}
3535
}

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests_ThrowIfGreaterThanOrEqual.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
54

65
public sealed partial class ArgumentTests
76
{
8-
[Fact]
7+
[Test]
98
public void ThrowIfGreaterThanOrEqual_WhenArgumentIsGreaterThanOrEqualToMaximum_ThrowsArgumentOutOfRangeException()
109
{
1110
// Arrange
@@ -19,7 +18,7 @@ public void ThrowIfGreaterThanOrEqual_WhenArgumentIsGreaterThanOrEqualToMaximum_
1918
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
2019
}
2120

22-
[Fact]
21+
[Test]
2322
public void ThrowIfGreaterThanOrEqual_WhenArgumentIsEqualToMaximum_ReturnsArgument()
2423
{
2524
// Arrange
@@ -33,8 +32,8 @@ public void ThrowIfGreaterThanOrEqual_WhenArgumentIsEqualToMaximum_ReturnsArgume
3332
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
3433
}
3534

36-
[Fact]
37-
public void ThrowIfGreaterThanOrEqual_WhenArgumentIsLessThanMaximum_ReturnsArgument()
35+
[Test]
36+
public async Task ThrowIfGreaterThanOrEqual_WhenArgumentIsLessThanMaximum_ReturnsArgument()
3837
{
3938
// Arrange
4039
var argument = 0;
@@ -44,6 +43,6 @@ public void ThrowIfGreaterThanOrEqual_WhenArgumentIsLessThanMaximum_ReturnsArgum
4443
Argument.ThrowIfGreaterThanOrEqual(argument, maximum);
4544

4645
// Assert
47-
Assert.True(true);
46+
_ = await Assert.That(maximum).IsEqualTo(1);
4847
}
4948
}

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests_ThrowIfLessThan.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
54

65
public sealed partial class ArgumentTests
76
{
8-
[Fact]
7+
[Test]
98
public void ThrowIfLessThan_WhenArgumentIsLessThanMinimum_ThrowsArgumentOutOfRangeException()
109
{
1110
// Arrange
@@ -19,8 +18,8 @@ public void ThrowIfLessThan_WhenArgumentIsLessThanMinimum_ThrowsArgumentOutOfRan
1918
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
2019
}
2120

22-
[Fact]
23-
public void ThrowIfLessThan_WhenArgumentIsEqualToMinimum_ReturnsArgument()
21+
[Test]
22+
public async Task ThrowIfLessThan_WhenArgumentIsEqualToMinimum_ReturnsArgument()
2423
{
2524
// Arrange
2625
var argument = 1;
@@ -30,6 +29,6 @@ public void ThrowIfLessThan_WhenArgumentIsEqualToMinimum_ReturnsArgument()
3029
Argument.ThrowIfLessThan(argument, minimum);
3130

3231
// Assert
33-
Assert.True(true);
32+
_ = await Assert.That(minimum).IsEqualTo(1);
3433
}
3534
}

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests_ThrowIfLessThanOrEqual.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
54

65
public sealed partial class ArgumentTests
76
{
8-
[Fact]
7+
[Test]
98
public void ThrowIfLessThanOrEqual_WhenArgumentIsLessThanMinimum_ThrowsArgumentOutOfRangeException()
109
{
1110
// Arrange
@@ -19,7 +18,7 @@ public void ThrowIfLessThanOrEqual_WhenArgumentIsLessThanMinimum_ThrowsArgumentO
1918
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
2019
}
2120

22-
[Fact]
21+
[Test]
2322
public void ThrowIfLessThanOrEqual_WhenArgumentIsEqualToMinimum_ReturnsArgument()
2423
{
2524
// Arrange
@@ -33,8 +32,8 @@ public void ThrowIfLessThanOrEqual_WhenArgumentIsEqualToMinimum_ReturnsArgument(
3332
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
3433
}
3534

36-
[Fact]
37-
public void ThrowIfLessThanOrEqual_WhenArgumentIsGreaterThanMinimum_ReturnsArgument()
35+
[Test]
36+
public async Task ThrowIfLessThanOrEqual_WhenArgumentIsGreaterThanMinimum_ReturnsArgument()
3837
{
3938
// Arrange
4039
var argument = 2;
@@ -44,6 +43,6 @@ public void ThrowIfLessThanOrEqual_WhenArgumentIsGreaterThanMinimum_ReturnsArgum
4443
Argument.ThrowIfLessThanOrEqual(argument, minimum);
4544

4645
// Assert
47-
Assert.True(true);
46+
_ = await Assert.That(minimum).IsEqualTo(1);
4847
}
4948
}

tests/NetEvolve.Arguments.Tests.Unit/ArgumentTests_ThrowIfNotEqual.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
54

65
public sealed partial class ArgumentTests
76
{
8-
[Fact]
7+
[Test]
98
public void ThrowIfNotEqual_WhenArgumentIsNotEqualToMaximum_ThrowsArgumentOutOfRangeException()
109
{
1110
// Arrange
@@ -19,8 +18,8 @@ public void ThrowIfNotEqual_WhenArgumentIsNotEqualToMaximum_ThrowsArgumentOutOfR
1918
_ = Assert.Throws<ArgumentOutOfRangeException>("argument", Act);
2019
}
2120

22-
[Fact]
23-
public void ThrowIfNotEqual_WhenArgumentIsEqualToMaximum_ReturnsArgument()
21+
[Test]
22+
public async Task ThrowIfNotEqual_WhenArgumentIsEqualToMaximum_ReturnsArgument()
2423
{
2524
// Arrange
2625
var argument = 1;
@@ -30,6 +29,6 @@ public void ThrowIfNotEqual_WhenArgumentIsEqualToMaximum_ReturnsArgument()
3029
Argument.ThrowIfNotEqual(argument, maximum);
3130

3231
// Assert
33-
Assert.True(true);
32+
_ = await Assert.That(maximum).IsEqualTo(1);
3433
}
3534
}
Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
namespace NetEvolve.Arguments.Tests.Unit;
22

33
using System;
4-
using Xunit;
54

65
public sealed partial class ArgumentTests
76
{
8-
[Fact]
7+
[Test]
98
public void ThrowIfNull_WhenArgumentIsNull_ThrowsArgumentNullException()
109
{
1110
// Arrange
@@ -18,8 +17,8 @@ public void ThrowIfNull_WhenArgumentIsNull_ThrowsArgumentNullException()
1817
_ = Assert.Throws<ArgumentNullException>("argument", Act);
1918
}
2019

21-
[Fact]
22-
public void ThrowIfNull_WhenArgumentIsNotEmpty_ReturnsArgument()
20+
[Test]
21+
public async Task ThrowIfNull_WhenArgumentIsNotEmpty_ReturnsArgument()
2322
{
2423
// Arrange
2524
var argument = "argument";
@@ -28,10 +27,10 @@ public void ThrowIfNull_WhenArgumentIsNotEmpty_ReturnsArgument()
2827
Argument.ThrowIfNull(argument);
2928

3029
// Assert
31-
Assert.True(true);
30+
_ = await Assert.That(argument).IsNotNullOrWhiteSpace();
3231
}
3332

34-
[Fact]
33+
[Test]
3534
public unsafe void ThrowIfNull_WhenArgumentIsNullPointer_ThrowsArgumentNullException()
3635
{
3736
// Arrange
@@ -43,17 +42,4 @@ public unsafe void ThrowIfNull_WhenArgumentIsNullPointer_ThrowsArgumentNullExcep
4342
// Assert
4443
_ = Assert.Throws<ArgumentNullException>("argument", Act);
4544
}
46-
47-
[Fact]
48-
public unsafe void ThrowIfNull_WhenArgumentIsNotNullPointer_ReturnsArgument()
49-
{
50-
// Arrange
51-
var argument = (int*)0x1;
52-
53-
// Act
54-
Argument.ThrowIfNull(argument);
55-
56-
// Assert
57-
Assert.True(true);
58-
}
5945
}

0 commit comments

Comments
 (0)