Minimalistic version of FsUnitTyped for xUnit, NUnit ans MSTest.
It provides zero-cost abstraction over native assertions with no dependency on FsUnit.
You can find some considerations in the initial issue.
1 |> shouldEqual 1 // pass
1 |> shouldNotEqual 2 // pass
[2] |> shouldContain 1 // pass
[] |> shouldNotContain 1 // pass
"Hello" |> shouldContainText "He" // pass
"Hello" |> shouldNotContainText "He" // fail
[] |> shouldBeEmpty // pass
[1] |> shouldHaveLength 1 // pass
2 |> shouldBeGreaterThan 1 // pass
1 |> shouldBeSmallerThan 2 // pass
(fun () -> null |> Array.sortInPlace) |> shouldFail<ArgumentNullException> // pass
(fun () -> failwith "error") |> shouldFailWithMessage "error" // pass
task { raise <| ArgumentNullException() } |> shouldFailTask<ArgumentNullException> // pass (should be awaited)
task { failwith "error" } |> shouldFailTaskWithMessage "error" // pass (should be awaited)
[1;2] |> shouldEquivalent [2;1] // pass
Item(Id="1") |> shouldEquivalent (Item(Id ="1")) // passYou can also find examples in the real tests
You need to change
open FsUnitTypedto
open FsUnit.Light| Framework | Package |
|---|---|
| xUnit | FsUnit.Light.xUnit |
| NUnit | FsUnit.Light.NUnit |
| MSTest | FsUnit.Light.MSTest |
