Skip to content

Commit

Permalink
Update NUnit to 4.0.
Browse files Browse the repository at this point in the history
NUnit 4.x only supports net6.0 and upwards. so change FsCheck.NUnit from netstandard2.0 to net6.0.
  • Loading branch information
kurtschelfthout committed Jan 2, 2025
1 parent 27689b8 commit 00ab875
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
14 changes: 7 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Project>
<ItemGroup>
<PackageVersion Include="FSharp.Core" Version="5.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageVersion Include="Microsoft.NETCore.Platforms" Version="5.0.2" />
<PackageVersion Include="Microsoft.NETCore.Targets" Version="5.0" />
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageVersion Include="Microsoft.TestPlatform.ObjectModel" Version="16.11" />
<PackageVersion Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageVersion Include="MSTest.TestFramework" Version="2.2.7" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.7.0" />
<PackageVersion Include="MSTest.TestFramework" Version="3.7.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NuGet.Frameworks" Version="5.11" />
<PackageVersion Include="NUnit" Version="[3.13.1,5.0.0)" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.0" />
<PackageVersion Include="NUnit" Version="[4.0.0, 5.0.0)" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.Collections" Version="4.3" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.Collections.Immutable" Version="9.0.0" />
<PackageVersion Include="System.Diagnostics.Debug" Version="4.3" />
<PackageVersion Include="System.Diagnostics.TextWriterTraceListener" Version="4.3" />
<PackageVersion Include="System.Diagnostics.TraceSource" Version="4.3" />
Expand All @@ -39,4 +39,4 @@
<PackageVersion Include="xunit.extensibility.execution" Version="[2.4.1, 3.0.0)" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion examples/FsCheck.NUnit.Examples/PropertyExamples.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type NUnitTest() =

[<Property>]
member __.PrintUnhandledException_ShouldFail (xs : int list) =
Assert.IsTrue(List.length xs < 6, "this message should be visible in test explorer")
Assert.That(List.length xs < 6, "this message should be visible in test explorer")

[<Property; Ignore("reason")>]
member __.ShouldIgnore (xs : int list) =
Expand Down
2 changes: 1 addition & 1 deletion src/FsCheck.NUnit/FsCheck.NUnit.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>FsCheck.NUnit</AssemblyName>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageDescription>FsCheck.NUnit integrates FsCheck with NUnit by adding a PropertyAttribute that runs FsCheck tests, similar to NUnit TestAttribute.
Expand Down
3 changes: 2 additions & 1 deletion src/FsCheck.NUnit/FsCheckPropertyAttribute.fs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ and FsCheckTestMethod(mi : IMethodInfo, parentSuite : Test) =

member private x.HandleException ex testResult failureSite =
match ex with
| :? ThreadAbortException -> Thread.ResetAbort()
| :? ThreadAbortException -> () // old code called obsolete Thread.ResetAbort() which is no longer supported on net core and 5+ and above, but those won't ever throw ThreadAbortException either.
// https://learn.microsoft.com/en-us/dotnet/api/system.threading.threadabortexception?view=net-8.0
| _ -> ()
testResult.RecordException(x.FilterException <| ex, failureSite)

Expand Down

0 comments on commit 00ab875

Please sign in to comment.