FsUnit


Expecto

The Expecto library can be installed from NuGet:
PM> Install-Package Expecto

Expecto.Flip has a similar syntax to FsUnit.

Expecto is not part of FsUnit.

Syntax

With Expecto.Flip you can write your unit tests like this:

open Expecto.Flip.Expect

One object equals or does not equal another:

1 |> equal "1 is equal to 1." 1
1 |> notEqual  "1 is not equal to 2." 2

One comparable value greater or smaller than another:

(11, 10) |> isGreaterThan "11 is greater than 10."
(10, 11) |> isLessThan "10 is less than 11."

& more operators:

true |> isTrue "Value is true."
false |> isFalse "Value is false."

"" |> isEmpty
"Foobar" |> isNotEmpty "Value is not empty."
None |> isNone "Value is None."

{1 .. 10} |> contains "Seq 1 to 10 contains 4." 4

All operators are listed here: Expecto.Flip.Expect

Namespace Expecto
Namespace Expecto.Flip
Modul Expect aus Expecto.Flip
val equal: message: string -> expected: 'a -> actual: 'a -> unit (requires equality)
<summary> Expects the two values to equal each other. </summary>
val notEqual: message: string -> expected: 'a -> actual: 'a -> unit (requires equality)
<summary> Expects the two values not to equal each other. </summary>
val isGreaterThan: message: string -> a: 'a * b: 'a -> unit (requires comparison)
<summary> Expects `a` &gt; `b`. </summary>
val isLessThan: message: string -> a: 'a * b: 'a -> unit (requires comparison)
<summary> Expects `a` to be less than `b`. </summary>
val isTrue: message: string -> actual: bool -> unit
<summary> Expects the value to be true. </summary>
val isFalse: message: string -> actual: bool -> unit
<summary> Expects the value to be false. </summary>
val isEmpty: message: string -> actual: seq<'a> -> unit
<summary> Expect the passed sequence to be empty. </summary>
val isNotEmpty: message: string -> actual: string -> unit
<summary> Expect the passed string not to be empty. </summary>
Union-Fall Option.None: Option<'T>
<summary>The representation of "No value"</summary>
val isNone: message: string -> x: 'a option -> unit
<summary> Expects the value to be a None value. </summary>
val contains: message: string -> element: 'a -> sequence: seq<'a> -> unit (requires equality)
<summary> Expects the `sequence` to contain the `element`. </summary>
Fork me on GitHub