Skip to content

Commit 7816a2b

Browse files
authored
Merge pull request #259 from CaptnCodr/feature/nunit4-upgrade
NUnit 4 upgrade
2 parents 93fc1b7 + ecf8f70 commit 7816a2b

File tree

11 files changed

+73
-63
lines changed

11 files changed

+73
-63
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 6.0.0.0-alpha1 - Dec 12, 2023
2+
- Migrate to NUnit 4.
3+
14
### 5.6.1.0 - Nov 29, 2023
25
- Set NUnit dependency < 4.0.0 to prevent compatibility issues. - (https://github.com/fsprojects/FsUnit/pull/257)
36

build.fsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ let cloneUrl = "[email protected]:fsprojects/FsUnit.git"
6464

6565
// Read additional information from the release notes document
6666
let release = ReleaseNotes.load "RELEASE_NOTES.md"
67+
let version = release.AssemblyVersion
6768

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

8586
let getProjectDetails (projectPath: string) =
8687
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
@@ -192,7 +193,7 @@ Target.create "NuGet" (fun _ ->
192193
{ p with
193194
ToolType = ToolType.CreateLocalTool()
194195
OutputPath = "bin"
195-
Version = release.AssemblyVersion
196+
Version = version
196197
ReleaseNotes = String.toLines release.Notes }))
197198

198199
Target.create "PublishNuget" (fun _ ->

paket.dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nuget FSharp.Core ~> 5.0.0
66
nuget Microsoft.NET.Test.Sdk
77

88
// NUnit
9-
nuget NUnit ~> 3.13.3
9+
nuget NUnit ~> 4.0.0
1010
nuget NUnit3TestAdapter
1111
nuget System.Collections.Immutable
1212
nuget System.Collections.NonGeneric

paket.lock

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ RESTRICTION: || (== net6.0) (== netstandard2.0)
22
NUGET
33
remote: https://api.nuget.org/v3/index.json
44
FSharp.Core (5.0.2)
5-
Microsoft.CodeCoverage (17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
6-
Microsoft.NET.Test.Sdk (17.7.2)
7-
Microsoft.CodeCoverage (>= 17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
8-
Microsoft.TestPlatform.TestHost (>= 17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
5+
Microsoft.CodeCoverage (17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
6+
Microsoft.NET.Test.Sdk (17.8)
7+
Microsoft.CodeCoverage (>= 17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= net462)) (&& (== netstandard2.0) (>= netcoreapp3.1))
8+
Microsoft.TestPlatform.TestHost (>= 17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
99
Microsoft.NETCore.Platforms (7.0.4)
1010
Microsoft.NETCore.Targets (5.0)
11-
Microsoft.TestPlatform.ObjectModel (17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
11+
Microsoft.TestPlatform.ObjectModel (17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
1212
NuGet.Frameworks (>= 6.5)
1313
System.Reflection.Metadata (>= 1.6)
14-
Microsoft.TestPlatform.TestHost (17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
15-
Microsoft.TestPlatform.ObjectModel (>= 17.7.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
14+
Microsoft.TestPlatform.TestHost (17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
15+
Microsoft.TestPlatform.ObjectModel (>= 17.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
1616
Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
1717
MSTest.TestAdapter (2.1.2)
1818
NETStandard.Library (>= 1.6.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
@@ -22,9 +22,8 @@ NUGET
2222
Microsoft.NETCore.Platforms (>= 1.1)
2323
Newtonsoft.Json (13.0.3) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
2424
NHamcrest (3.4)
25-
NuGet.Frameworks (6.7) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
26-
NUnit (3.14)
27-
NETStandard.Library (>= 2.0)
25+
NuGet.Frameworks (6.8) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
26+
NUnit (4.0.1)
2827
NUnit3TestAdapter (4.5)
2928
runtime.native.System (4.3.1) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp1.0))
3029
Microsoft.NETCore.Platforms (>= 1.1.1)
@@ -34,7 +33,7 @@ NUGET
3433
Microsoft.NETCore.Platforms (>= 1.1)
3534
Microsoft.NETCore.Targets (>= 1.1)
3635
System.Runtime (>= 4.3)
37-
System.Collections.Immutable (7.0)
36+
System.Collections.Immutable (8.0)
3837
System.Memory (>= 4.5.5) - restriction: || (&& (== net6.0) (>= net462)) (== netstandard2.0)
3938
System.Runtime.CompilerServices.Unsafe (>= 6.0)
4039
System.Collections.NonGeneric (4.3)
@@ -86,8 +85,8 @@ NUGET
8685
System.IO (>= 4.3)
8786
System.Reflection.Primitives (>= 4.3)
8887
System.Runtime (>= 4.3)
89-
System.Reflection.Metadata (7.0.2) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
90-
System.Collections.Immutable (>= 7.0)
88+
System.Reflection.Metadata (8.0) - restriction: || (== net6.0) (&& (== netstandard2.0) (>= netcoreapp3.1))
89+
System.Collections.Immutable (>= 8.0)
9190
System.Reflection.Primitives (4.3)
9291
Microsoft.NETCore.Platforms (>= 1.1)
9392
Microsoft.NETCore.Targets (>= 1.1)
@@ -122,8 +121,8 @@ NUGET
122121
xunit.assert (>= 2.5.3)
123122
xunit.core (2.5.3)
124123
xunit.abstractions (2.0.3)
125-
xunit.analyzers (1.4)
126-
xunit.assert (2.6.1)
124+
xunit.analyzers (1.7)
125+
xunit.assert (2.6.3)
127126
NETStandard.Library (>= 1.6.1) - restriction: == netstandard2.0
128127
xunit.core (2.5.3)
129128
xunit.extensibility.core (2.5.3)
@@ -134,4 +133,4 @@ NUGET
134133
xunit.extensibility.execution (2.5.3)
135134
NETStandard.Library (>= 1.6.1)
136135
xunit.extensibility.core (2.5.3)
137-
xunit.runner.visualstudio (2.5.3)
136+
xunit.runner.visualstudio (2.5.5)

src/FsUnit.NUnit/CustomConstraints.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ module CustomConstraints =
99

1010
member this.Expected = expected
1111

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

15+
override this.ApplyTo<'TActual>(actual: 'TActual) : ConstraintResult =
1516
if Common.isUnionCase actual then
1617
let result = Common.isOfCase this.Expected actual
1718
ConstraintResult(this, actual, result)

src/FsUnit.NUnit/FsUnit.NUnit.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
3+
<TargetFrameworks>net6.0</TargetFrameworks>
44
<AssemblyName>FsUnit.NUnit</AssemblyName>
55
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/FsUnit.NUnit/FsUnitTyped.fs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace FsUnitTyped
22

33
open System.Diagnostics
44
open NUnit.Framework
5+
open NUnit.Framework.Legacy
56

67
[<AutoOpen>]
78
module TopLevelOperators =
@@ -20,19 +21,19 @@ module TopLevelOperators =
2021

2122
[<DebuggerStepThrough>]
2223
let shouldBeEmpty(actual: 'a seq) =
23-
Assert.IsEmpty(actual)
24+
ClassicAssert.IsEmpty(actual)
2425

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

2930
[<DebuggerStepThrough>]
3031
let shouldBeSmallerThan (expected: 'a) (actual: 'a) =
31-
Assert.Less(actual, expected)
32+
ClassicAssert.Less(actual, expected)
3233

3334
[<DebuggerStepThrough>]
3435
let shouldBeGreaterThan (expected: 'a) (actual: 'a) =
35-
Assert.Greater(actual, expected)
36+
ClassicAssert.Greater(actual, expected)
3637

3738
[<DebuggerStepThrough>]
3839
let shouldFail<'exn when 'exn :> exn>(f: unit -> unit) =

0 commit comments

Comments
 (0)