下面是一个简单有效的测试:
module Tests
open NUnit.Framework
open FsUnit
[<TestFixture>] 
type simple ()=
   [<Test>] member test.
    ``tautology`` ()=
           true |> should be True我的项目还没有使用F#的任何面向对象的特性--我可以在没有对象的情况下编写测试吗,或者这只是NUnit的工作方式?
发布于 2012-06-03 04:07:32
FsUnit/NUnit也支持let-bound。下面是来自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)使用静态函数的另一个示例可以在FsUnit's github page中找到。
https://stackoverflow.com/questions/10865394
复制相似问题