diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0949232c..ab4924b8 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -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) diff --git a/build.fsx b/build.fsx index 9ced32e0..5ea8f3d4 100644 --- a/build.fsx +++ b/build.fsx @@ -64,6 +64,7 @@ let cloneUrl = "git@github.com: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) = @@ -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) @@ -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 _ -> diff --git a/paket.dependencies b/paket.dependencies index ec34c5e9..778a3d32 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -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 diff --git a/paket.lock b/paket.lock index 778064bc..cf34234a 100644 --- a/paket.lock +++ b/paket.lock @@ -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)) @@ -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) @@ -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) @@ -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) @@ -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) @@ -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) diff --git a/src/FsUnit.NUnit/CustomConstraints.fs b/src/FsUnit.NUnit/CustomConstraints.fs index 4ab824f9..a61ac3ea 100644 --- a/src/FsUnit.NUnit/CustomConstraints.fs +++ b/src/FsUnit.NUnit/CustomConstraints.fs @@ -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) "" + override this.Description = + defaultArg (Common.caseName this.Expected) "" + override this.ApplyTo<'TActual>(actual: 'TActual) : ConstraintResult = if Common.isUnionCase actual then let result = Common.isOfCase this.Expected actual ConstraintResult(this, actual, result) diff --git a/src/FsUnit.NUnit/FsUnit.NUnit.fsproj b/src/FsUnit.NUnit/FsUnit.NUnit.fsproj index da3689f8..c13c87fc 100644 --- a/src/FsUnit.NUnit/FsUnit.NUnit.fsproj +++ b/src/FsUnit.NUnit/FsUnit.NUnit.fsproj @@ -1,6 +1,6 @@  - net6.0;netstandard2.0 + net6.0 FsUnit.NUnit false true diff --git a/src/FsUnit.NUnit/FsUnitTyped.fs b/src/FsUnit.NUnit/FsUnitTyped.fs index 0ac6cca8..423732a7 100644 --- a/src/FsUnit.NUnit/FsUnitTyped.fs +++ b/src/FsUnit.NUnit/FsUnitTyped.fs @@ -2,6 +2,7 @@ namespace FsUnitTyped open System.Diagnostics open NUnit.Framework +open NUnit.Framework.Legacy [] module TopLevelOperators = @@ -20,7 +21,7 @@ module TopLevelOperators = [] let shouldBeEmpty(actual: 'a seq) = - Assert.IsEmpty(actual) + ClassicAssert.IsEmpty(actual) [] let shouldNotContain (expected: 'a) (actual: 'a seq) = @@ -28,11 +29,11 @@ module TopLevelOperators = [] let shouldBeSmallerThan (expected: 'a) (actual: 'a) = - Assert.Less(actual, expected) + ClassicAssert.Less(actual, expected) [] let shouldBeGreaterThan (expected: 'a) (actual: 'a) = - Assert.Greater(actual, expected) + ClassicAssert.Greater(actual, expected) [] let shouldFail<'exn when 'exn :> exn>(f: unit -> unit) = diff --git a/src/FsUnit.NUnit/GenericAssert.fs b/src/FsUnit.NUnit/GenericAssert.fs index 6db8e354..90b5461b 100644 --- a/src/FsUnit.NUnit/GenericAssert.fs +++ b/src/FsUnit.NUnit/GenericAssert.fs @@ -9,6 +9,7 @@ open LanguagePrimitives /// Generic test assertions. [] type Assert = + /// /// Verifies that two values are equal. /// If they are not, then an NUnit.Framework.AssertException is thrown. @@ -17,7 +18,7 @@ type Assert = /// The actual value. static member AreEqual<'T when 'T: equality>(expected: 'T, actual: 'T) : unit = let eqConstraint = Equality.IsEqualTo(expected) - Assert.That(actual, eqConstraint, null, null) + Assert.That<'T>(actual, eqConstraint) /// /// Verifies that two values are equal. @@ -28,7 +29,7 @@ type Assert = /// The message to display in case of failure. static member AreEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string) : unit = let eqConstraint = Equality.IsEqualTo(expected) - Assert.That(actual, eqConstraint, message, null) + Assert.That<'T>(actual, eqConstraint, message) /// /// Verifies that two values are equal. @@ -40,7 +41,7 @@ type Assert = /// Array of objects to be used in formatting the message. static member AreEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit = let eqConstraint = Equality.IsEqualTo(expected) - Assert.That(actual, eqConstraint, message, args) + Assert.That<'T>(actual, eqConstraint, String.Format(message, args)) /// /// Verifies that two values are not equal. @@ -50,7 +51,7 @@ type Assert = /// The actual value. static member AreNotEqual<'T when 'T: equality>(expected: 'T, actual: 'T) : unit = let neqConstraint = Equality.IsNotEqualTo(expected) - Assert.That(actual, neqConstraint, null, null) + Assert.That<'T>(actual, neqConstraint) /// /// Verifies that two values are not equal. @@ -61,7 +62,7 @@ type Assert = /// The message to display in case of failure. static member AreNotEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string) : unit = let neqConstraint = Equality.IsNotEqualTo(expected) - Assert.That(actual, neqConstraint, message, null) + Assert.That<'T>(actual, neqConstraint, message) /// /// Verifies that two values are not equal. @@ -73,7 +74,7 @@ type Assert = /// Array of objects to be used in formatting the message. static member AreNotEqual<'T when 'T: equality>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit = let neqConstraint = Equality.IsNotEqualTo(expected) - Assert.That(actual, neqConstraint, message, args) + Assert.That<'T>(actual, neqConstraint, String.Format(message, args)) /// /// Asserts that two objects do not refer to the same object. @@ -83,7 +84,7 @@ type Assert = /// The actual object. static member AreNotSame<'T when 'T: not struct>(expected: 'T, actual: 'T) : unit = let sameConstraint = Is.Not.SameAs expected - Assert.That(actual, sameConstraint, null, null) + Assert.That<'T>(actual, sameConstraint) /// /// Asserts that two objects do not refer to the same object. @@ -94,7 +95,7 @@ type Assert = /// The message to display in case of failure. static member AreNotSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string) : unit = let sameConstraint = Is.Not.SameAs expected - Assert.That(actual, sameConstraint, message, null) + Assert.That<'T>(actual, sameConstraint, message) /// /// Asserts that two objects do not refer to the same object. @@ -106,7 +107,7 @@ type Assert = /// Array of objects to be used in formatting the message. static member AreNotSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit = let sameConstraint = Is.Not.SameAs expected - Assert.That(actual, sameConstraint, message, args) + Assert.That<'T>(actual, sameConstraint, String.Format(message, args)) /// /// Asserts that two objects refer to the same object. @@ -116,7 +117,7 @@ type Assert = /// The actual object. static member AreSame<'T when 'T: not struct>(expected: 'T, actual: 'T) : unit = let sameConstraint = Is.SameAs expected - Assert.That(actual, sameConstraint, null, null) + Assert.That<'T>(actual, sameConstraint) /// /// Asserts that two objects refer to the same object. @@ -127,7 +128,7 @@ type Assert = /// The message to display in case of failure. static member AreSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string) : unit = let sameConstraint = Is.SameAs expected - Assert.That(actual, sameConstraint, message, null) + Assert.That<'T>(actual, sameConstraint, message) /// /// Asserts that two objects refer to the same object. @@ -139,7 +140,7 @@ type Assert = /// Array of objects to be used in formatting the message. static member AreSame<'T when 'T: not struct>(expected: 'T, actual: 'T, message: string, [] args: obj[]) : unit = let sameConstraint = Is.SameAs expected - Assert.That(actual, sameConstraint, message, args) + Assert.That<'T>(actual, sameConstraint, String.Format(message, args)) /// /// Asserts that an object is contained in a list. @@ -149,7 +150,7 @@ type Assert = static member Contains<'T when 'T: equality>(expected: 'T, actual: IEnumerable<'T>) : unit = let eqConstraint = Equality.IsEqualTo(expected) let containsConstraint = SomeItemsConstraint(eqConstraint) - Assert.That(actual, containsConstraint, null, null) + Assert.That(actual, containsConstraint) /// /// Asserts that an object is contained in a list. @@ -160,7 +161,7 @@ type Assert = static member Contains<'T when 'T: equality>(expected: 'T, actual: IEnumerable<'T>, message: string) : unit = let eqConstraint = Equality.IsEqualTo(expected) let containsConstraint = SomeItemsConstraint(eqConstraint) - Assert.That(actual, containsConstraint, message, null) + Assert.That(actual, containsConstraint, message) /// /// Asserts that an object is contained in a list. @@ -172,7 +173,7 @@ type Assert = static member Contains<'T when 'T: equality>(expected: 'T, actual: IEnumerable<'T>, message: string, [] args: obj[]) : unit = let eqConstraint = Equality.IsEqualTo(expected) let containsConstraint = SomeItemsConstraint(eqConstraint) - Assert.That(actual, containsConstraint, message, args) + Assert.That(actual, containsConstraint, String.Format(message, args)) /// /// Verifies that the first value is greater than the second value. @@ -181,7 +182,7 @@ type Assert = /// The first value, expected to be greater. /// The second value, expected to be less. static member Greater<'T when 'T: comparison>(arg1: 'T, arg2: 'T) : unit = - Assert.That(arg1, Is.GreaterThan arg2, null, null) + Assert.That<'T>(arg1, Is.GreaterThan arg2) /// /// Verifies that the first value is greater than the second value. @@ -191,7 +192,7 @@ type Assert = /// The second value, expected to be less. /// The message to display in case of failure. static member Greater<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string) : unit = - Assert.That(arg1, Is.GreaterThan arg2, message, null) + Assert.That<'T>(arg1, Is.GreaterThan arg2, message) /// /// Verifies that the first value is greater than the second value. @@ -202,7 +203,7 @@ type Assert = /// The message to display in case of failure. /// Array of objects to be used in formatting the message. static member Greater<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit = - Assert.That(arg1, Is.GreaterThan arg2, message, args) + Assert.That<'T>(arg1, Is.GreaterThan arg2, String.Format(message, args)) /// /// Verifies that the first value is greater than or equal to than the second value. @@ -211,7 +212,7 @@ type Assert = /// The first value, expected to be greater. /// The second value, expected to be less. static member GreaterOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T) : unit = - Assert.That(arg1, Is.GreaterThanOrEqualTo arg2, null, null) + Assert.That<'T>(arg1, Is.GreaterThanOrEqualTo arg2) /// /// Verifies that the first value is greater than or equal to than the second value. @@ -221,7 +222,7 @@ type Assert = /// The second value, expected to be less. /// The message to display in case of failure. static member GreaterOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string) : unit = - Assert.That(arg1, Is.GreaterThanOrEqualTo arg2, message, null) + Assert.That<'T>(arg1, Is.GreaterThanOrEqualTo arg2, message) /// /// Verifies that the first value is greater than or equal to than the second value. @@ -232,7 +233,7 @@ type Assert = /// The message to display in case of failure. /// Array of objects to be used in formatting the message. static member GreaterOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit = - Assert.That(arg1, Is.GreaterThanOrEqualTo arg2, message, args) + Assert.That<'T>(arg1, Is.GreaterThanOrEqualTo arg2, String.Format(message, args)) /// /// Verifies that the first value is less than the second value. @@ -241,7 +242,7 @@ type Assert = /// The first value, expected to be less. /// The second value, expected to be greater. static member Less<'T when 'T: comparison>(arg1: 'T, arg2: 'T) : unit = - Assert.That(arg1, Is.LessThan arg2, null, null) + Assert.That<'T>(arg1, Is.LessThan arg2) /// /// Verifies that the first value is less than the second value. @@ -251,7 +252,7 @@ type Assert = /// The second value, expected to be greater. /// The message to display in case of failure. static member Less<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string) : unit = - Assert.That(arg1, Is.LessThan arg2, message, null) + Assert.That<'T>(arg1, Is.LessThan arg2, message) /// /// Verifies that the first value is less than the second value. @@ -262,7 +263,7 @@ type Assert = /// The message to display in case of failure. /// Array of objects to be used in formatting the message. static member Less<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit = - Assert.That(arg1, Is.LessThan arg2, message, args) + Assert.That<'T>(arg1, Is.LessThan arg2, String.Format(message, args)) /// /// Verifies that the first value is less than or equal to the second value. @@ -271,7 +272,7 @@ type Assert = /// The first value, expected to be less. /// The second value, expected to be greater. static member LessOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T) : unit = - Assert.That(arg1, Is.LessThanOrEqualTo arg2, null, null) + Assert.That<'T>(arg1, Is.LessThanOrEqualTo arg2) /// /// Verifies that the first value is less than or equal to the second value. @@ -281,7 +282,7 @@ type Assert = /// The second value, expected to be greater. /// The message to display in case of failure. static member LessOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string) : unit = - Assert.That(arg1, Is.LessThanOrEqualTo arg2, message, null) + Assert.That<'T>(arg1, Is.LessThanOrEqualTo arg2, message) /// /// Verifies that the first value is less than or equal to the second value. @@ -292,7 +293,7 @@ type Assert = /// The message to display in case of failure. /// Array of objects to be used in formatting the message. static member LessOrEqual<'T when 'T: comparison>(arg1: 'T, arg2: 'T, message: string, [] args: obj[]) : unit = - Assert.That(arg1, Is.LessThanOrEqualTo arg2, message, args) + Assert.That<'T>(arg1, Is.LessThanOrEqualTo arg2, String.Format(message, args)) /// /// Verifies that the object that is passed in is not equal to 'null'. @@ -300,7 +301,7 @@ type Assert = /// /// The object that is to be tested. static member NotNull<'T when 'T: not struct>(arg: 'T) : unit = - Assert.That(arg, Is.Not.Null, null, null) + Assert.That<'T>(arg, Is.Not.Null) /// /// Verifies that the object that is passed in is not equal to 'null'. @@ -309,7 +310,7 @@ type Assert = /// The object that is to be tested. /// The message to display in case of failure. static member NotNull<'T when 'T: not struct>(arg: 'T, message: string) : unit = - Assert.That(arg, Is.Not.Null, message, null) + Assert.That<'T>(arg, Is.Not.Null, message) /// /// Verifies that the object that is passed in is not equal to 'null'. @@ -319,7 +320,7 @@ type Assert = /// The message to display in case of failure. /// Array of objects to be used in formatting the message. static member NotNull<'T when 'T: not struct>(arg: 'T, message: string, [] args: obj[]) : unit = - Assert.That(arg, Is.Not.Null, message, args) + Assert.That<'T>(arg, Is.Not.Null, String.Format(message, args)) /// /// Verifies that the object that is passed in is equal to 'null'. @@ -327,7 +328,7 @@ type Assert = /// /// The object that is to be tested. static member Null<'T when 'T: not struct>(arg: 'T) : unit = - Assert.That(arg, Is.Null, null, null) + Assert.That<'T>(arg, Is.Null) /// /// Verifies that the object that is passed in is equal to 'null'. @@ -336,7 +337,7 @@ type Assert = /// The object that is to be tested. /// The message to display in case of failure. static member Null<'T when 'T: not struct>(arg: 'T, message: string) : unit = - Assert.That(arg, Is.Null, message, null) + Assert.That<'T>(arg, Is.Null, message) /// /// Verifies that the object that is passed in is equal to 'null'. @@ -346,4 +347,4 @@ type Assert = /// The message to display in case of failure. /// Array of objects to be used in formatting the message. static member Null<'T when 'T: not struct>(arg: 'T, message: string, [] args: obj[]) : unit = - Assert.That(arg, Is.Null, message, args) + Assert.That<'T>(arg, Is.Null, String.Format(message, args)) diff --git a/src/FsUnit.NUnit/paket.template b/src/FsUnit.NUnit/paket.template index ea27b60e..3e81e058 100644 --- a/src/FsUnit.NUnit/paket.template +++ b/src/FsUnit.NUnit/paket.template @@ -23,7 +23,6 @@ description FsUnit is a set of extensions that add special testing syntax to NUnit. files ../../bin/FsUnit.NUnit/net6.0/FsUnit.* ==> lib/net6.0 - ../../bin/FsUnit.NUnit/netstandard2.0/FsUnit.* ==> lib/netstandard2.0 ../../src/install.ps1 ==> tools dependencies diff --git a/tests/FsUnit.NUnit.Test/equalTests.fs b/tests/FsUnit.NUnit.Test/equalTests.fs index 180ddc20..72dd937b 100644 --- a/tests/FsUnit.NUnit.Test/equalTests.fs +++ b/tests/FsUnit.NUnit.Test/equalTests.fs @@ -111,7 +111,9 @@ type ``equal Tests``() = |> Assert.Throws |> fun e -> e.Message - |> should equal (sprintf " Expected: [Ok \"no\"] or [Ok \"no\"]%s But was: [Ok \"ok\"]%s" Environment.NewLine Environment.NewLine) + |> should + equal + (String.Format(" Assert.That(, ){0} Expected: [Ok \"no\"] or [Ok \"no\"]{0} But was: [Ok \"ok\"]{0}", Environment.NewLine)) [] member _.``structural value type should equal equivalent value``() = diff --git a/tests/FsUnit.NUnit.Test/typed.shouldEqualTests.fs b/tests/FsUnit.NUnit.Test/typed.shouldEqualTests.fs index 8e04c68d..f0b2c012 100644 --- a/tests/FsUnit.NUnit.Test/typed.shouldEqualTests.fs +++ b/tests/FsUnit.NUnit.Test/typed.shouldEqualTests.fs @@ -23,6 +23,9 @@ type ``shouldEqual Tests``() = let equivalentImmutableArray = ImmutableArray.Create(1, 2, 3) let otherImmutableArray = ImmutableArray.Create(1, 2, 4) + let sformat (formattableString: string) (argument: string) = + String.Format(formattableString, argument) + [] member _.``value type should equal equivalent value``() = 1 |> shouldEqual 1 @@ -87,7 +90,7 @@ type ``shouldEqual Tests``() = e.Message |> should equal - (sprintf " Expected: Error \"Bar\" or Error \"Bar\"%s But was: Error \"Foo\"%s" Environment.NewLine Environment.NewLine) + (sformat " Assert.That(, ){0} Expected: Error \"Bar\" or Error \"Bar\"{0} But was: Error \"Foo\"{0}" Environment.NewLine) [] member _.``Error "Foo" should not equal Error "Bar"``() = @@ -101,7 +104,7 @@ type ``shouldEqual Tests``() = e.Message |> should equal - (sprintf " Expected: not Error \"Foo\" or Error \"Foo\"%s But was: Error \"Foo\"%s" Environment.NewLine Environment.NewLine) + (sformat " Assert.That(, ){0} Expected: not Error \"Foo\" or Error \"Foo\"{0} But was: Error \"Foo\"{0}" Environment.NewLine) [] member this.``structural equality``() =