public void ThrowsAfter(Type feature, ITestResultMessage[] results)
        {
            "Given a scenario with a throw after attribute"
                .f(() => feature = typeof(ScenarioWithThrowAfterAttribute));

            "When I run the scenario"
                .f(() => results = this.Run<ITestResultMessage>(feature));

#if V2
            "Then there is a single test failure"
                .f(() => results.Should().ContainSingle(result => result is ITestFailed));
#else
            "Then there are three test failures"
                .f(() => results.OfType<ITestFailed>().Count().Should().Be(3));
#endif
        }
예제 #2
0
        public void FailureToCompleteAStep(Type feature, ITestResultMessage[] results)
        {
            "Given a failing step with three teardowns"
                .f(() => feature = typeof(FailingStepWithThreeTeardowns));

            "When running the scenario"
                .f(() => results = this.Run<ITestResultMessage>(feature));

            "Then there should be one failure"
                .f(() => results.OfType<ITestFailed>().Count().Should().Be(1));

            "And the teardowns should be executed in reverse order after the step"
                .f(() => typeof(TeardownFeature).GetTestEvents()
                    .Should().Equal("step1", "teardown3", "teardown2", "teardown1"));
        }
예제 #3
0
        public void FailingSteps(Type feature, ITestResultMessage[] results)
        {
            "Given two steps with teardowns and a failing step"
                .f(() => feature = typeof(TwoStepsWithTeardownsAndAFailingStep));

            "When running the scenario"
                .f(() => results = this.Run<ITestResultMessage>(feature));

            "Then there should be one failure"
                .f(() => results.OfType<ITestFailed>().Count().Should().Be(1));

            "And the teardowns should be executed after each step"
                .f(() => typeof(TeardownFeature).GetTestEvents()
                    .Should().Equal("step1", "step2", "step3", "teardown2", "teardown1"));
        }
        public void FailingSteps(Type feature, ITestResultMessage[] results)
        {
            "Given {0}"
                .f(() => { });

            "When running the scenario"
                .f(() => results = this.Run<ITestResultMessage>(feature));

            "Then there should be one failure"
                .f(() => results.OfType<ITestFailed>().Count().Should().Be(1));

            "And the disposables should be disposed in reverse order"
                .f(() => typeof(ObjectDisposalFeature).GetTestEvents()
                    .Should().Equal("disposed3", "disposed2", "disposed1"));
        }