示例#1
0
        public static void AsyncStepExceedsTimeout(Type feature, MethodResult[] results)
        {
            "Given a feature with a scenario with a single step which exceeds it's 1ms timeout"._(() =>
                feature = typeof(AsyncStepWhichExceedsTimeout));

            "When the test runner runs the feature"._(() =>
                results = TestRunner.Run(feature).ToArray());

            "Then there should be one result"._(() =>
                results.Count().Should().Be(1));

            "And the result should be a failure"._(() =>
                results.Should().ContainItemsAssignableTo<FailedResult>());

            "And the result message should be \"Test execution time exceeded: 1ms\""._(() =>
                results.Cast<FailedResult>().Should().OnlyContain(result => result.Message == "Test execution time exceeded: 1ms"));
        }
示例#2
0
        public static void AsyncVoidStepThrowsException(Type feature, MethodResult[] results)
        {
            "Given a feature with a scenario that throws an invalid operation exception"._(() =>
                feature = typeof(AsyncVoidStepWhichThrowsException));

            "When the test runner runs the feature"._(() =>
                results = TestRunner.Run(feature).ToArray());

            "Then the result should be a failure"._(() =>
                results.Should().ContainItemsAssignableTo<FailedResult>());

            "And the exception should be an invalid operation exception".And(() =>
                results.Cast<FailedResult>().First().ExceptionType.Should().Be("System.InvalidOperationException"));
        }