Skip to content

Commit 93ef1a4

Browse files
author
Kyle McCarthy
committed
dont use Assert.Fail just to cause code to throw as it fails the test in later versions of nunit
1 parent a54d918 commit 93ef1a4

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

PowerAssertTests/Approvals/EndToEndTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ public void PolyAssert()
484484
poly.IsTrue(() => x == 5);
485485
poly.IsTrue(() => x == 6);
486486
poly.IsTrue(() => x == 7);
487-
poly.Try(() => Assert.Fail("Wah wah"));
487+
poly.Try(() => throw new Exception("Wah wah"));
488488
poly.Log("PolyAssert.Log messages are only printed if the test fails");
489489
}
490490
}
@@ -506,7 +506,7 @@ public void PolyAssertCanFinishEarly()
506506
poly.Log("Sometimes you do want to end the test early after all");
507507
poly.StopIfErrorsHaveOccurred(); //no stop here
508508
poly.Log("So just call StopIfErrorsHaveOccurred (behaves the same as disposing the PolyAssert)");
509-
poly.Try(() => Assert.Fail("Wah wah"));
509+
poly.Try(() => throw new Exception("Wah wah"));
510510
poly.StopIfErrorsHaveOccurred(); //no stop here
511511
poly.Log("This message should not be printed, as StopIfErrorsHaveOccurred will throw an exception this time");
512512
}

PowerAssertTests/PowerAssertTests.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<Reference Include="nunit.framework">
13-
<HintPath>..\lib\nunit.framework.dll</HintPath>
14-
</Reference>
1512
<Reference Include="System" />
1613
<Reference Include="System.Core">
1714
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -32,6 +29,7 @@
3229
<PackageReference Include="ApprovalTests" Version="3.0.7" />
3330
<PackageReference Include="ApprovalUtilities" Version="3.0.7" />
3431
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
32+
<PackageReference Include="nunit" Version="3.13.1" />
3533
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
3634
</ItemGroup>
3735
</Project>

0 commit comments

Comments
 (0)