Skip to content

Commit b6196ab

Browse files
authored
Merge pull request #1485 from nunit/issue-1478
Upgrade all tests to use latest version of NUnit available for each runtime.
2 parents 2a180d5 + 55d30d7 commit b6196ab

31 files changed

+161
-130
lines changed

NetFXTests.nunit

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<NUnitProject>
22
<Settings processModel="Default" domainUsage="Default" />
33
<Config name="Debug" appbase="bin/Debug">
4-
<assembly path="net462/mock-assembly.dll" />
5-
<assembly path="net6.0/mock-assembly.dll" />
4+
<assembly path="testdata/net462/mock-assembly.dll" />
5+
<assembly path="testdata/net6.0/mock-assembly.dll" />
66
</Config>
77
<Config name="Release" appbase="bin/Release">
8-
<assembly path="net462/mock-assembly.dll" />
9-
<assembly path="net6.0/mock-assembly.dll" />
8+
<assembly path="testdata/net462/mock-assembly.dll" />
9+
<assembly path="testdata/net6.0/mock-assembly.dll" />
1010
</Config>
1111
</NUnitProject>

package-tests.cake

+23-23
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,31 @@ class MockAssemblyExpectedResult : ExpectedResult
3535
StandardRunnerTests.Add(new PackageTest(
3636
1, "Net462Test",
3737
"Run mock-assembly.dll under .NET 4.6.2",
38-
"net462/mock-assembly.dll",
38+
"testdata/net462/mock-assembly.dll",
3939
new MockAssemblyExpectedResult("net-4.6.2")));
4040

4141
AddToBothLists(new PackageTest(
4242
1, "Net80Test",
4343
"Run mock-assembly.dll under .NET 8.0",
44-
"net8.0/mock-assembly.dll",
44+
"testdata/net8.0/mock-assembly.dll",
4545
new MockAssemblyExpectedResult("netcore-8.0")));
4646

4747
AddToBothLists(new PackageTest(
4848
1, "Net70Test",
4949
"Run mock-assembly.dll under .NET 7.0",
50-
"net7.0/mock-assembly.dll",
50+
"testdata/net7.0/mock-assembly.dll",
5151
new MockAssemblyExpectedResult("netcore-7.0")));
5252

5353
AddToBothLists(new PackageTest(
5454
1, "Net60Test",
5555
"Run mock-assembly.dll under .NET 6.0",
56-
"net6.0/mock-assembly.dll",
56+
"testdata/net6.0/mock-assembly.dll",
5757
new MockAssemblyExpectedResult("netcore-6.0")));
5858

5959
AddToBothLists(new PackageTest(
6060
1, "NetCore31Test",
6161
"Run mock-assembly.dll under .NET Core 3.1",
62-
"netcoreapp3.1/mock-assembly.dll",
62+
"testdata/netcoreapp3.1/mock-assembly.dll",
6363
new MockAssemblyExpectedResult("netcore-3.1")));
6464

6565
//////////////////////////////////////////////////////////////////////
@@ -83,7 +83,7 @@ class MockAssemblyX86ExpectedResult : MockAssemblyExpectedResult
8383
StandardRunnerTests.Add(new PackageTest(
8484
1, "Net462X86Test",
8585
"Run mock-assembly-x86.dll under .NET 4.6.2",
86-
"net462/mock-assembly-x86.dll",
86+
"testdata/net462/mock-assembly-x86.dll",
8787
new MockAssemblyX86ExpectedResult("net-4.6.2")));
8888

8989
if (dotnetX86Available)
@@ -96,27 +96,27 @@ if (dotnetX86Available)
9696
StandardRunnerTests.Add(new PackageTest(
9797
1, "Net80X86Test",
9898
"Run mock-assembly-x86.dll under .NET 8.0",
99-
"net8.0/mock-assembly-x86.dll",
99+
"testdata/net8.0/mock-assembly-x86.dll",
100100
new MockAssemblyX86ExpectedResult("netcore-8.0")));
101101

102102
if (!onAppVeyor && !onGitHubActions)
103103
StandardRunnerTests.Add(new PackageTest(
104104
1, "Net70X86Test",
105105
"Run mock-assembly-x86.dll under .NET 7.0",
106-
"net7.0/mock-assembly-x86.dll",
106+
"testdata/net7.0/mock-assembly-x86.dll",
107107
new MockAssemblyX86ExpectedResult("netcore-7.0")));
108108

109109
StandardRunnerTests.Add(new PackageTest(
110110
1, "Net60X86Test",
111111
"Run mock-assembly-x86.dll under .NET 6.0",
112-
"net6.0/mock-assembly-x86.dll",
112+
"testdata/net6.0/mock-assembly-x86.dll",
113113
new MockAssemblyX86ExpectedResult("netcore-6.0")));
114114

115115
if (!onAppVeyor && !onGitHubActions)
116116
StandardRunnerTests.Add(new PackageTest(
117117
1, "NetCore31X86Test",
118118
"Run mock-assembly-x86.dll under .NET Core 3.1",
119-
"netcoreapp3.1/mock-assembly-x86.dll",
119+
"testdata/netcoreapp3.1/mock-assembly-x86.dll",
120120
new MockAssemblyX86ExpectedResult("netcore-3.1")));
121121
}
122122

@@ -127,19 +127,19 @@ if (dotnetX86Available)
127127
StandardRunnerTests.Add(new PackageTest(
128128
1, "Net462PlusNet462Test",
129129
"Run two copies of mock-assembly together",
130-
"net462/mock-assembly.dll net462/mock-assembly.dll",
130+
"testdata/net462/mock-assembly.dll testdata/net462/mock-assembly.dll",
131131
new MockAssemblyExpectedResult("net-4.6.2", "net-4.6.2")));
132132

133133
StandardRunnerTests.Add(new PackageTest(
134134
1, "Net60PlusNet80Test",
135135
"Run mock-assembly under .NET6.0 and 8.0 together",
136-
"net6.0/mock-assembly.dll net8.0/mock-assembly.dll",
136+
"testdata/net6.0/mock-assembly.dll testdata/net8.0/mock-assembly.dll",
137137
new MockAssemblyExpectedResult("netcore-6.0", "netcore-8.0")));
138138

139139
StandardRunnerTests.Add(new PackageTest(
140140
1, "Net462PlusNet60Test",
141141
"Run mock-assembly under .Net Framework 4.6.2 and .Net 6.0 together",
142-
"net462/mock-assembly.dll net6.0/mock-assembly.dll",
142+
"testdata/net462/mock-assembly.dll testdata/net6.0/mock-assembly.dll",
143143
new MockAssemblyExpectedResult("net-4.6.2", "netcore-6.0")));
144144

145145
//////////////////////////////////////////////////////////////////////
@@ -148,15 +148,15 @@ StandardRunnerTests.Add(new PackageTest(
148148

149149
StandardRunnerTests.Add(new PackageTest(
150150
1, "Net60AspNetCoreTest", "Run test using AspNetCore targeting .NET 6.0",
151-
"net6.0/aspnetcore-test.dll", new ExpectedResult("Passed")
151+
"testdata/net6.0/aspnetcore-test.dll", new ExpectedResult("Passed")
152152
{
153153
Total = 3, Passed = 3, Failed = 0, Warnings = 0, Inconclusive = 0, Skipped = 0,
154154
Assemblies = new ExpectedAssemblyResult[] { new ExpectedAssemblyResult("aspnetcore-test.dll", "netcore-6.0") }
155155
}));
156156

157157
StandardRunnerTests.Add(new PackageTest(
158158
1, "Net80AspNetCoreTest", "Run test using AspNetCore targeting .NET 8.0",
159-
"net8.0/aspnetcore-test.dll", new ExpectedResult("Passed")
159+
"testdata/net8.0/aspnetcore-test.dll", new ExpectedResult("Passed")
160160
{
161161
Total = 3, Passed = 3, Failed = 0, Warnings = 0, Inconclusive = 0, Skipped = 0,
162162
Assemblies = new ExpectedAssemblyResult[] { new ExpectedAssemblyResult("aspnetcore-test.dll", "netcore-8.0") }
@@ -168,15 +168,15 @@ StandardRunnerTests.Add(new PackageTest(
168168

169169
StandardRunnerTests.Add(new PackageTest(
170170
1, "Net60WindowsFormsTest", "Run test using windows forms under .NET 6.0",
171-
"net6.0-windows/windows-forms-test.dll", new ExpectedResult("Passed")
171+
"testdata/net6.0-windows/windows-forms-test.dll", new ExpectedResult("Passed")
172172
{
173173
Total = 2, Passed = 2, Failed = 0, Warnings = 0, Inconclusive = 0, Skipped = 0,
174174
Assemblies = new ExpectedAssemblyResult[] { new ExpectedAssemblyResult("windows-forms-test.dll", "netcore-6.0") }
175175
}));
176176

177177
StandardRunnerTests.Add(new PackageTest(
178178
1, "Net80WindowsFormsTest", "Run test using windows forms under .NET 8.0",
179-
"net8.0-windows/windows-forms-test.dll", new ExpectedResult("Passed")
179+
"testdata/net8.0-windows/windows-forms-test.dll", new ExpectedResult("Passed")
180180
{
181181
Total = 2, Passed = 2, Failed = 0, Warnings = 0, Inconclusive = 0, Skipped = 0,
182182
Assemblies = new ExpectedAssemblyResult[] { new ExpectedAssemblyResult("windows-forms-test.dll", "netcore-8.0") }
@@ -188,12 +188,12 @@ StandardRunnerTests.Add(new PackageTest(
188188

189189
StandardRunnerTests.Add(new PackageTest(
190190
1, "Net60WPFTest", "Run test using WPF under .NET 6.0",
191-
"net6.0-windows/WpfTest.dll --trace=Debug",
191+
"testdata/net6.0-windows/WpfTest.dll --trace=Debug",
192192
new ExpectedResult("Passed") { Assemblies = new[] { new ExpectedAssemblyResult("WpfTest.dll", "netcore-6.0") } }));
193193

194194
StandardRunnerTests.Add(new PackageTest(
195195
1, "Net80WPFTest", "Run test using WPF under .NET 8.0",
196-
"net8.0-windows/WpfTest.dll --trace=Debug",
196+
"testdata/net8.0-windows/WpfTest.dll --trace=Debug",
197197
new ExpectedResult("Passed") { Assemblies = new[] { new ExpectedAssemblyResult("WpfTest.dll", "netcore-8.0") } }));
198198

199199
//////////////////////////////////////////////////////////////////////
@@ -210,7 +210,7 @@ StandardRunnerTests.Add(new PackageTest(
210210
StandardRunnerTests.Add(new PackageTest(
211211
1, "V2ResultWriterTest",
212212
"Run mock-assembly under .NET 6.0 and produce V2 output",
213-
"net6.0/mock-assembly.dll --result=TestResult.xml --result=NUnit2TestResult.xml;format=nunit2",
213+
"testdata/net6.0/mock-assembly.dll --result=TestResult.xml --result=NUnit2TestResult.xml;format=nunit2",
214214
new MockAssemblyExpectedResult("netcore-6.0"),
215215
KnownExtensions.NUnitV2ResultWriter.SetVersion("3.8.0")));
216216

@@ -255,7 +255,7 @@ StandardRunnerTests.Add(new PackageTest(
255255
StandardRunnerTests.Add(new PackageTest(
256256
1, "InvalidTestNameTest_Net462",
257257
"Ensure we handle invalid test names correctly under .NET 4.6.2",
258-
"net462/InvalidTestNames.dll --trace:Debug",
258+
"testdata/net462/InvalidTestNames.dll --trace:Debug",
259259
new ExpectedResult("Passed")
260260
{
261261
Assemblies = new ExpectedAssemblyResult[]
@@ -267,7 +267,7 @@ StandardRunnerTests.Add(new PackageTest(
267267
AddToBothLists(new PackageTest(
268268
1, "InvalidTestNameTest_Net60",
269269
"Ensure we handle invalid test names correctly under .NET 6.0",
270-
"net6.0/InvalidTestNames.dll --trace:Debug",
270+
"testdata/net6.0/InvalidTestNames.dll --trace:Debug",
271271
new ExpectedResult("Passed")
272272
{
273273
Assemblies = new ExpectedAssemblyResult[]
@@ -279,7 +279,7 @@ AddToBothLists(new PackageTest(
279279
AddToBothLists(new PackageTest(
280280
1, "InvalidTestNameTest_Net80",
281281
"Ensure we handle invalid test names correctly under .NET 8.0",
282-
"net8.0/InvalidTestNames.dll --trace:Debug",
282+
"testdata/net8.0/InvalidTestNames.dll --trace:Debug",
283283
new ExpectedResult("Passed")
284284
{
285285
Assemblies = new ExpectedAssemblyResult[]

src/NUnitConsole/nunit3-console.tests/CommandLineTests.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void GetArgsFromFiles(string commandline, string files, params string[] e
9999

100100
// Then
101101
Assert.That(expandedArgs, Is.EqualTo(expectedArgs));
102-
Assert.IsEmpty(options.ErrorMessages);
102+
Assert.That(options.ErrorMessages, Is.Empty);
103103
}
104104

105105
[TestCase("--arg1 @file1.txt --arg2", "The file \"file1.txt\" was not found.")]
@@ -406,7 +406,7 @@ public void ResultOptionWithFilePath()
406406
var spec = options.ResultOutputSpecifications[0];
407407
Assert.That(spec.OutputPath, Is.EqualTo("results.xml"));
408408
Assert.That(spec.Format, Is.EqualTo("nunit3"));
409-
Assert.Null(spec.Transform);
409+
Assert.That(spec.Transform, Is.Null);
410410
}
411411

412412
[Test]
@@ -420,7 +420,7 @@ public void ResultOptionWithFilePathAndFormat()
420420
var spec = options.ResultOutputSpecifications[0];
421421
Assert.That(spec.OutputPath, Is.EqualTo("results.xml"));
422422
Assert.That(spec.Format, Is.EqualTo("nunit2"));
423-
Assert.Null(spec.Transform);
423+
Assert.That(spec.Transform, Is.Null);
424424
}
425425

426426
[Test]
@@ -479,12 +479,12 @@ public void ResultOptionMayBeRepeated()
479479
var spec1 = specs[0];
480480
Assert.That(spec1.OutputPath, Is.EqualTo("results.xml"));
481481
Assert.That(spec1.Format, Is.EqualTo("nunit3"));
482-
Assert.Null(spec1.Transform);
482+
Assert.That(spec1.Transform, Is.Null);
483483

484484
var spec2 = specs[1];
485485
Assert.That(spec2.OutputPath, Is.EqualTo("nunit2results.xml"));
486486
Assert.That(spec2.Format, Is.EqualTo("nunit2"));
487-
Assert.Null(spec2.Transform);
487+
Assert.That(spec2.Transform, Is.Null);
488488

489489
var spec3 = specs[2];
490490
Assert.That(spec3.OutputPath, Is.EqualTo("myresult.xml"));
@@ -502,7 +502,7 @@ public void DefaultResultSpecification()
502502
var spec = options.ResultOutputSpecifications[0];
503503
Assert.That(spec.OutputPath, Is.EqualTo("TestResult.xml"));
504504
Assert.That(spec.Format, Is.EqualTo("nunit3"));
505-
Assert.Null(spec.Transform);
505+
Assert.That(spec.Transform, Is.Null);
506506
}
507507

508508
[Test]
@@ -562,7 +562,7 @@ public void ExploreOptionWithFilePath()
562562
var spec = options.ExploreOutputSpecifications[0];
563563
Assert.That(spec.OutputPath, Is.EqualTo("results.xml"));
564564
Assert.That(spec.Format, Is.EqualTo("nunit3"));
565-
Assert.Null(spec.Transform);
565+
Assert.That(spec.Transform, Is.Null);
566566
}
567567

568568
[Test]
@@ -577,7 +577,7 @@ public void ExploreOptionWithFilePathAndFormat()
577577
var spec = options.ExploreOutputSpecifications[0];
578578
Assert.That(spec.OutputPath, Is.EqualTo("results.xml"));
579579
Assert.That(spec.Format, Is.EqualTo("cases"));
580-
Assert.Null(spec.Transform);
580+
Assert.That(spec.Transform, Is.Null);
581581
}
582582

583583
[Test]
@@ -869,14 +869,14 @@ private static IFileSystem GetFileSystemContainingFile(string fileName)
869869
private static FieldInfo GetFieldInfo(string fieldName)
870870
{
871871
FieldInfo field = typeof(ConsoleOptions).GetField(fieldName);
872-
Assert.IsNotNull(field, "The field '{0}' is not defined", fieldName);
872+
Assert.That(field, Is.Not.Null, "The field '{0}' is not defined", fieldName);
873873
return field;
874874
}
875875

876876
private static PropertyInfo GetPropertyInfo(string propertyName)
877877
{
878878
PropertyInfo property = typeof(ConsoleOptions).GetProperty(propertyName);
879-
Assert.IsNotNull(property, "The property '{0}' is not defined", propertyName);
879+
Assert.That(property, Is.Not.Null, "The property '{0}' is not defined", propertyName);
880880
return property;
881881
}
882882

src/NUnitConsole/nunit3-console.tests/OutputSpecificationTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void FileNameOnly()
4040
var spec = new Spec("MyFile.xml", null);
4141
Assert.That(spec.OutputPath, Is.EqualTo("MyFile.xml"));
4242
Assert.That(spec.Format, Is.EqualTo("nunit3"));
43-
Assert.Null(spec.Transform);
43+
Assert.That(spec.Transform, Is.Null);
4444
}
4545

4646
[Test]
@@ -49,7 +49,7 @@ public void FileNamePlusFormat()
4949
var spec = new Spec("MyFile.xml;format=nunit2", null);
5050
Assert.That(spec.OutputPath, Is.EqualTo("MyFile.xml"));
5151
Assert.That(spec.Format, Is.EqualTo("nunit2"));
52-
Assert.Null(spec.Transform);
52+
Assert.That(spec.Transform, Is.Null);
5353
}
5454

5555
[Test]

src/NUnitConsole/nunit3-console.tests/ResultReporterTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void CreateResult()
4242
var engineResult = AddMetadata(new TestEngineResult(xmlText));
4343
_result = engineResult.Xml;
4444

45-
Assert.NotNull(_result, "Unable to create report result.");
45+
Assert.That(_result, Is.Not.Null, "Unable to create report result.");
4646
}
4747

4848
[SetUp]

src/NUnitConsole/nunit3-console.tests/nunit3-console.tests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
</PropertyGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="NSubstitute" Version="2.0.3" />
20-
<PackageReference Include="NUnit" Version="3.13.3" />
21-
<PackageReference Include="NUnitLite" Version="3.13.3" />
19+
<PackageReference Include="NSubstitute" Version="5.1.0" />
20+
<PackageReference Include="NUnit" Version="4.2.2" />
21+
<PackageReference Include="NUnitLite" Version="4.2.2" />
2222
</ItemGroup>
2323

2424
<ItemGroup Condition="'$(TargetFramework)'!='net462'">

0 commit comments

Comments
 (0)