【发布时间】:2015-11-29 21:50:56
【问题描述】:
我的作为单元测试运行的属性测试似乎失败了,即使它确实通过了。
代码如下:
module Tests.Units
open FsUnit
open NUnit.Framework
open NUnit.Core.Extensibility
open FsCheck.NUnit
open FsCheck.NUnit.Addin
open FsCheck
let add x y = (x + y)
let commutativeProperty x y =
let result1 = add x y
let result2 = add y x // reversed params
result1 = result2
[<Test>]
let ``When I add two numbers, the result should not depend on parameter order``()=
Check.Quick commutativeProperty |> should equal true
总结:
测试名称:当我添加两个数字时,结果不应该取决于 参数顺序
Test FullName: Tests.Units.When I add two numbers, 结果应该 不依赖于参数顺序
测试结果:失败
结果堆栈跟踪:在 FsUnit.TopLevelOperators.should[a,a](FSharpFunc`2 f, a x, Object y) in d:\GitHub\FsUnit\src\FsUnit.NUnit\FsUnit.fs:44行
在 Tests.Units. 当我添加两个数字时,结果不应该取决于 参数 order()
结果消息:预期:true,但
结果标准输出:好的,通过了 100 次测试。
我读对了吗?
我错过了什么?
【问题讨论】: