internal static Example Execute(this Spec spec, Action specifyExpectations) { using (var runner = new Runner(spec)) return runner.Run(() => { spec.SetUp(); specifyExpectations(); spec.TearDown(); }, Substitute.For<IExampleReporter>()); }
public override void RunTestMethod(TestResult testResult) { using (var runner = new Runner(Spec)) { var example = runner.Run(() => RunBaseTestMethod(testResult), new TestResultExampleReporter(testResult)); if (example.IsFail) testResult.Failure(GetTestResultMessageForResultState(testResult, ResultState.Failure, "Failing"), ""); if (example.IsPass) testResult.Success(); if (example.IsPending) testResult.Ignore(GetTestResultMessageForResultState(testResult, ResultState.Ignored, "Pending")); } }
public override TestResult RunTest() { ArrayUtil.Add(ref setUpMethods, setUpMethod); ArrayUtil.Add(ref tearDownMethods, tearDownMethod); // TearDown methods are run in reverse order using (var runner = new Runner(Spec)) { var exampleResult = new TestResult(this); var exampleReporter = new TestResultExampleReporter(exampleResult); TestResult testResult = null; var example = runner.Run(() => testResult = RunBaseTest(), exampleReporter); if (testResult.IsSuccess) { if (example.IsFail) testResult.Failure(GetTestResultMessageForResultState(exampleResult, ResultState.Failure, "Failing"), ""); if (example.IsPending) testResult.Ignore(GetTestResultMessageForResultState(exampleResult, ResultState.Ignored, "Pending")); } return testResult; } }
internal static Example Execute(this Spec spec, Action specifyExpectations) { using (var runner = new Runner(spec)) return runner.Run(specifyExpectations, Substitute.For<IExampleReporter>()); }