Reputation: 122412
Here is a working trivial test:
module Tests
open NUnit.Framework
open FsUnit
[<TestFixture>]
type simple ()=
[<Test>] member test.
``tautology`` ()=
true |> should be True
My project doesn't use any of F#'s OOP features yet - can I write tests without objects, or is that just how NUnit works?
Upvotes: 1
Views: 321
Reputation: 41290
FsUnit/NUnit also supports let-bounds. Here is an example from FsUnit's official announcement:
module Test.``equalWithin assertions``
open NUnit.Framework
open FsUnit
[<Test>]
let ``should equal within tolerance when less than``() =
10.09 |> should (equalWithin 0.1) 10.11
[<Test>]
let ``should not equal within tolerance``() =
10.1 |> should not ((equalWithin 0.001) 10.11)
Another example of using static functions could be found in FsUnit's github page.
Upvotes: 1