-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b82d77
commit d57ba75
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace FsCheck.Xunit | ||
|
||
open FsCheck | ||
|
||
/// A runner for FsCheck (i.e. that you can use as Config.Runner) which outputs | ||
/// to Xunit's given ITestOutputHelper. | ||
/// For example, { Config.QuickThrowOnFailure with Runner = TestOutputRunner(output) } | ||
type TestOutputRunner(output: Xunit.Abstractions.ITestOutputHelper) = | ||
interface IRunner with | ||
member _.OnStartFixture t = | ||
output.WriteLine (Runner.onStartFixtureToString t) | ||
member _.OnArguments (ntest, args, every) = | ||
output.WriteLine (every ntest args) | ||
member _.OnShrink(args, everyShrink) = | ||
output.WriteLine (everyShrink args) | ||
member _.OnFinished(name,testResult) = | ||
let resultText = Runner.onFinishedToString name testResult | ||
match testResult with | ||
| TestResult.True _ -> resultText |> output.WriteLine | ||
| _ -> failwithf "%s" resultText |