File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 88 </PropertyGroup >
99 <ItemGroup >
1010 <Compile Include =" AssemblyInfo.fs" />
11+ <Compile Include =" Runner.fs" />
1112 <Compile Include =" PropertyAttribute.fs" />
1213 <Compile Include =" CheckExtensions.fs" />
1314 </ItemGroup >
Original file line number Diff line number Diff line change @@ -4,11 +4,12 @@ open System
44open System.Reflection
55open System.Threading .Tasks
66
7- open FsCheck
87open Xunit
98open Xunit.Sdk
109open Xunit.Abstractions
1110
11+ open FsCheck
12+
1213type PropertyFailedException =
1314 inherit Exception
1415 new ( testResult : FsCheck.TestResult ) = {
Original file line number Diff line number Diff line change 1+ namespace FsCheck.Xunit
2+
3+ open FsCheck
4+
5+ /// A runner for FsCheck (i.e. that you can use as Config.Runner) which outputs
6+ /// to Xunit's given ITestOutputHelper.
7+ /// For example, { Config.QuickThrowOnFailure with Runner = TestOutputRunner(output) }
8+ type TestOutputRunner ( output : Xunit.Abstractions.ITestOutputHelper ) =
9+ interface IRunner with
10+ member _.OnStartFixture t =
11+ output.WriteLine ( Runner.onStartFixtureToString t)
12+ member _.OnArguments ( ntest , args , every ) =
13+ output.WriteLine ( every ntest args)
14+ member _.OnShrink ( args , everyShrink ) =
15+ output.WriteLine ( everyShrink args)
16+ member _.OnFinished ( name , testResult ) =
17+ let resultText = Runner.onFinishedToString name testResult
18+ match testResult with
19+ | TestResult.True _ -> resultText |> output.WriteLine
20+ | _ -> failwithf " %s " resultText
You can’t perform that action at this time.
0 commit comments