Skip to content

Commit

Permalink
Merge pull request #259 from CaptnCodr/feature/nunit4-upgrade
Browse files Browse the repository at this point in the history
NUnit 4 upgrade
  • Loading branch information
CaptnCodr authored Dec 12, 2023
2 parents 93fc1b7 + ecf8f70 commit 7816a2b
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 63 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 6.0.0.0-alpha1 - Dec 12, 2023
- Migrate to NUnit 4.

### 5.6.1.0 - Nov 29, 2023
- Set NUnit dependency < 4.0.0 to prevent compatibility issues. - (https://github.com/fsprojects/FsUnit/pull/257)

Expand Down
7 changes: 4 additions & 3 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ let cloneUrl = "[email protected]:fsprojects/FsUnit.git"

// Read additional information from the release notes document
let release = ReleaseNotes.load "RELEASE_NOTES.md"
let version = release.AssemblyVersion

// Helper active pattern for project types
let (|Fsproj|Csproj|Vbproj|) (projFileName: string) =
Expand All @@ -79,8 +80,8 @@ Target.create "AssemblyInfo" (fun _ ->
[ AssemblyInfo.Title(projectName)
AssemblyInfo.Product project
AssemblyInfo.Description summary
AssemblyInfo.Version release.AssemblyVersion
AssemblyInfo.FileVersion release.AssemblyVersion ]
AssemblyInfo.Version version
AssemblyInfo.FileVersion version ]

let getProjectDetails (projectPath: string) =
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
Expand Down Expand Up @@ -192,7 +193,7 @@ Target.create "NuGet" (fun _ ->
{ p with
ToolType = ToolType.CreateLocalTool()
OutputPath = "bin"
Version = release.AssemblyVersion
Version = version
ReleaseNotes = String.toLines release.Notes }))

Target.create "PublishNuget" (fun _ ->
Expand Down
2 changes: 1 addition & 1 deletion paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ nuget FSharp.Core ~> 5.0.0
nuget Microsoft.NET.Test.Sdk

// NUnit
nuget NUnit ~> 3.13.3
nuget NUnit ~> 4.0.0
nuget NUnit3TestAdapter
nuget System.Collections.Immutable
nuget System.Collections.NonGeneric
Expand Down
31 changes: 15 additions & 16 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ RESTRICTION: || (== net6.0) (== netstandard2.0)
NUGET
remote: https://api.nuget.org/v3/index.json
FSharp.Core (5.0.2)
Microsoft.CodeCoverage (17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NET.Test.Sdk (17.7.2)
Microsoft.CodeCoverage (>= 17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (>= 17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.CodeCoverage (17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NET.Test.Sdk (17.8)
Microsoft.CodeCoverage (>= 17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (>= 17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.NETCore.Platforms (7.0.4)
Microsoft.NETCore.Targets (5.0)
Microsoft.TestPlatform.ObjectModel (17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NuGet.Frameworks (>= 6.5)
System.Reflection.Metadata (>= 1.6)
Microsoft.TestPlatform.TestHost (17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (>= 17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.TestHost (17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Microsoft.TestPlatform.ObjectModel (>= 17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
MSTest.TestAdapter (2.1.2)
NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Expand All @@ -22,9 +22,8 @@ NUGET
Microsoft.NETCore.Platforms (>= 1.1)
Newtonsoft.Json (13.0.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NHamcrest (3.4)
NuGet.Frameworks (6.7) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NUnit (3.14)
NETStandard.Library (>= 2.0)
NuGet.Frameworks (6.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
NUnit (4.0.1)
NUnit3TestAdapter (4.5)
runtime.native.System (4.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
Microsoft.NETCore.Platforms (>= 1.1.1)
Expand All @@ -34,7 +33,7 @@ NUGET
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
System.Runtime (>= 4.3)
System.Collections.Immutable (7.0)
System.Collections.Immutable (8.0)
System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (== netstandard2.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
System.Collections.NonGeneric (4.3)
Expand Down Expand Up @@ -86,8 +85,8 @@ NUGET
System.IO (>= 4.3)
System.Reflection.Primitives (>= 4.3)
System.Runtime (>= 4.3)
System.Reflection.Metadata (7.0.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
System.Collections.Immutable (>= 7.0)
System.Reflection.Metadata (8.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
System.Collections.Immutable (>= 8.0)
System.Reflection.Primitives (4.3)
Microsoft.NETCore.Platforms (>= 1.1)
Microsoft.NETCore.Targets (>= 1.1)
Expand Down Expand Up @@ -122,8 +121,8 @@ NUGET
xunit.assert (>= 2.5.3)
xunit.core (2.5.3)
xunit.abstractions (2.0.3)
xunit.analyzers (1.4)
xunit.assert (2.6.1)
xunit.analyzers (1.7)
xunit.assert (2.6.3)
NETStandard.Library (>= 1.6.1) - restriction: == netstandard2.0
xunit.core (2.5.3)
xunit.extensibility.core (2.5.3)
Expand All @@ -134,4 +133,4 @@ NUGET
xunit.extensibility.execution (2.5.3)
NETStandard.Library (>= 1.6.1)
xunit.extensibility.core (2.5.3)
xunit.runner.visualstudio (2.5.3)
xunit.runner.visualstudio (2.5.5)
5 changes: 3 additions & 2 deletions src/FsUnit.NUnit/CustomConstraints.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ module CustomConstraints =

member this.Expected = expected

override this.ApplyTo<'TActual>(actual: 'TActual) : ConstraintResult =
do this.Description <- defaultArg (Common.caseName this.Expected) "<The method only works on union types!>"
override this.Description =
defaultArg (Common.caseName this.Expected) "<The method only works on union types!>"

override this.ApplyTo<'TActual>(actual: 'TActual) : ConstraintResult =
if Common.isUnionCase actual then
let result = Common.isOfCase this.Expected actual
ConstraintResult(this, actual, result)
Expand Down
2 changes: 1 addition & 1 deletion src/FsUnit.NUnit/FsUnit.NUnit.fsproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<AssemblyName>FsUnit.NUnit</AssemblyName>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
7 changes: 4 additions & 3 deletions src/FsUnit.NUnit/FsUnitTyped.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ namespace FsUnitTyped

open System.Diagnostics
open NUnit.Framework
open NUnit.Framework.Legacy

[<AutoOpen>]
module TopLevelOperators =
Expand All @@ -20,19 +21,19 @@ module TopLevelOperators =

[<DebuggerStepThrough>]
let shouldBeEmpty(actual: 'a seq) =
Assert.IsEmpty(actual)
ClassicAssert.IsEmpty(actual)

[<DebuggerStepThrough>]
let shouldNotContain (expected: 'a) (actual: 'a seq) =
CollectionAssert.DoesNotContain(actual, expected, $"Seq %A{actual} should not contain %A{expected}")

[<DebuggerStepThrough>]
let shouldBeSmallerThan (expected: 'a) (actual: 'a) =
Assert.Less(actual, expected)
ClassicAssert.Less(actual, expected)

[<DebuggerStepThrough>]
let shouldBeGreaterThan (expected: 'a) (actual: 'a) =
Assert.Greater(actual, expected)
ClassicAssert.Greater(actual, expected)

[<DebuggerStepThrough>]
let shouldFail<'exn when 'exn :> exn>(f: unit -> unit) =
Expand Down
Loading

0 comments on commit 7816a2b

Please sign in to comment.