public void FailureBeforeForcedStep(Type feature, ITestResultMessage[] results) { ("Given a scenario with two empty steps, " + "a failing step with continuation, " + "two more empty steps, " + "a failing step and " + "another empty step") .f(() => feature = typeof(Steps)); "When I run the scenarios" .f(() => results = this.Run<ITestResultMessage>(feature)); "Then there should be 7 results" .f(() => results.Length.Should().Be(7)); "Then the first and second results are passes" .f(() => results.Take(2).Should().ContainItemsAssignableTo<ITestPassed>()); "And the third result is a failure" .f(() => results.Skip(2).Take(1).Should().ContainItemsAssignableTo<ITestFailed>()); "And the fourth and fifth results are passes" .f(() => results.Skip(3).Take(2).Should().ContainItemsAssignableTo<ITestPassed>()); "And the sixth result is a failure" .f(() => results.Skip(5).Take(1).Should().ContainItemsAssignableTo<ITestFailed>()); "And the seventh result is a skip" .f(() => results.Skip(6).Take(1).Should().ContainItemsAssignableTo<ITestSkipped>()); }
public void BackgroundSteps(Type feature, ITestResultMessage[] results) { "Given a {0}" .f(() => { }); "When I run the scenarios" .f(() => results = this.Run<ITestResultMessage>(feature)); "Then the background steps are run before each scenario" .f(() => results.Should().ContainItemsAssignableTo<ITestPassed>()); "And there are eight results" .f(() => results.Length.Should().Be(8)); "And the background steps have '(Background)' in their names" .f(() => { foreach (var result in results.Take(2).Concat(results.Skip(4).Take(2))) { result.Test.DisplayName.Should().Contain("(Background)"); } }); }
public void FailureBeforeContinuationStep(Type feature, ITestResultMessage[] results) { "Given a scenario with a failure before the continuation step" .f(() => feature = typeof(ScenarioWithFailureBeforeContinuationStep)); "When I run the scenarios" .f(() => results = this.Run<ITestResultMessage>(feature)); "Then there should be four results" .f(() => results.Length.Should().Be(4)); "Then the first result is a pass" .f(() => results.Take(1).Should().ContainItemsAssignableTo<ITestPassed>()); "And the second result is a failure" .f(() => results.Skip(1).Take(1).Should().ContainItemsAssignableTo<ITestFailed>()); "And the last two results are failures" .f(() => results.Skip(2).Should().ContainItemsAssignableTo<ITestFailed>()); }