【发布时间】:2015-11-29 21:47:27
【问题描述】:
当我尝试构建测试时,无法识别在我的测试方法中引用的“propertyCheck”函数。
我以为propertyChecked是FsCheck框架的核心功能?
我还需要执行什么其他仪式?
module Tests.Units
open FsUnit
open NUnit.Framework
open NUnit.Core.Extensibility
open FsCheck.NUnit
open FsCheck.NUnit.Addin
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``()=
propertyCheck commutativeProperty |> should equal true
【问题讨论】:
-
使用 Check.Quick 代替 propertyCheck。
-
是什么让您想到 FsCheck 中有一个
propertyCheck函数? -
章节:“重构通用代码” :: fsharpforfunandprofit.com/posts/property-based-testing
-
@ScottNimrod 在那篇文章中定义了该函数:“首先,我们将编写一个名为 propertyCheck 的函数...”
-
啊...谢谢你告诉我。