public FsCheckRunner( IRunner runnerImplementation, FsCheckRunnerConfig csharpRunnerConfig, CSharpNotationConfig csharpNotationConfig, int?maxTest) { RunnerImplementation = runnerImplementation; FsCheckRunnerConfig = csharpRunnerConfig ?? FsCheckRunnerConfig.Default; CSharpNotationConfig = csharpNotationConfig ?? CSharpNotationConfig.Default; MaxTest = maxTest ?? FsCheckConfig.Default.MaxTest; TestTimer.Start(); }
/// <summary> /// Run FsCheck with using a FsCheckRunner and the given parameters. /// </summary> public static void VerboseCheckThrowOnFailure( this Property property, CSharpNotationConfig CSharpNotationConfig = null, FsCheckRunnerConfig FsCheckRunnerConfig = null, FsCheckConfig Config = null, List <Type> Arbitrary = null, int?EndSize = null, Func <int, object[], string> Every = null, Func <object[], string> EveryShrink = null, int?MaxRejected = null, int?MaxTest = null, string Name = null, ParallelRunConfig ParallelRunConfig = null, bool?QuietOnSuccess = null, Tuple <ulong, ulong, int> Replay = null, IRunner Runner = null, int?StartSize = null) { Config = Config ?? FsCheckConfig.VerboseThrowOnFailure; var csharpRunnerConfig = (FsCheckRunnerConfig ?? FsCheckRunnerConfig.Default).With(ThrowOnFailure: true); property.Verbose( Config.WithFsCheckRunner( CSharpNotationConfig, csharpRunnerConfig, Arbitrary, EndSize, Every, EveryShrink, MaxRejected, MaxTest, Name, ParallelRunConfig, QuietOnSuccess, Replay, Runner, StartSize ) ); }
/// <summary> /// Modify parameters of an FsCheck.Config instance and attach output of /// the latest shrink in CSharp notation. /// </summary> public static FsCheckConfig WithFsCheckRunner( this FsCheckConfig config, CSharpNotationConfig CSharpNotationConfig = null, FsCheckRunnerConfig FsCheckRunnerConfig = null, List <Type> Arbitrary = null, int?EndSize = null, Func <int, object[], string> Every = null, Func <object[], string> EveryShrink = null, int?MaxRejected = null, int?MaxTest = null, string Name = null, ParallelRunConfig ParallelRunConfig = null, bool?QuietOnSuccess = null, Tuple <ulong, ulong, int> Replay = null, IRunner Runner = null, int?StartSize = null) { var runner = Runner; var csharpRunnerConfig = FsCheckRunnerConfig; var csharpNotationConfig = CSharpNotationConfig; if (runner == null) { runner = config.Runner; } if (runner is FsCheckRunner csharpRunner) { // Unwrap allows us to call WithFsCheckRunner multiple times without a problem. runner = csharpRunner.RunnerImplementation; // Preserve wrapped runner configs unless method parameters were set. if (FsCheckRunnerConfig == null) { csharpRunnerConfig = csharpRunner.FsCheckRunnerConfig; } if (CSharpNotationConfig == null) { csharpNotationConfig = csharpRunner.CSharpNotationConfig; } } return(config.With( Arbitrary: Arbitrary, EndSize: EndSize, Every: Every, EveryShrink: EveryShrink, MaxRejected: MaxRejected, MaxTest: MaxTest, Name: Name, ParallelRunConfig: ParallelRunConfig, QuietOnSuccess: QuietOnSuccess, Replay: Replay, Runner: new FsCheckRunner( runnerImplementation: runner, csharpRunnerConfig: csharpRunnerConfig, csharpNotationConfig: csharpNotationConfig, maxTest: MaxTest ?? config.MaxTest ), StartSize: StartSize )); }