不同于普通的Xunit测试,一般的测试需要标记[Fact],你需要使用[Property]标记FsCheck测试。给定一个函数:1 2 3 4 private int Add(int x, int y) { return x + y; } 针对加法交换律编写一个Property-based测试: 1 2 3 4 5 [Property] public bool Commutative(int x, int y) { return Add(x, y...
FsCheck.Xunit FsCheck.Nunit FsCheck follows Semantic Versioning 2.0.0, except for the API exposed in FsCheck.Experimental which is subject to change at any time. All AppVeyor builds are available using the NuGet feed: https://ci.appveyor.com/nuget/fscheck If using Paket, add the source...
open System open FsCheck open FsCheck.Xunit [<Property>] let MultiplyIdentityCornerCases () = Gen.oneof [ Gen.elements [Int64.MinValue; -1L; 0L; 1L; Int64.MaxValue] Arb.generate ] |> Arb.fromGen |> Prop.forAll <| fun x -> x = x * 1L Two generators are passed ...
OnFinished(String , TestResult ) at FsCheck.Runner.check[a](Config config, a p) at FsCheck.Check.QuickThrowOnFailure[Testable](Testable property) C:\Users\mark\Documents\Library1.fs(36,0): at ShrinkDemo() 0 passed, 1 failed, 0 skipped, took 0,92 seconds (xUnit.net 2.1.0 build ...
Supported formats: xunit, xunit-quiet --large-fs optimise scratch device for large filesystems -s section run only specified section from config file -S section exclude the specified section from the config file -L <n> loop tests <n> times following a failure, measuring aggregate pass/fail...