Exemple #1
0
        public void RunAsync_should_expose_exception_with_simple_call_stack_when_step_throws_it()
        {
            var ex = Assert.ThrowsAsync <InvalidOperationException>(() => _runner.NewScenario().AddSteps(Step_throwing_exception).RunAsync());

            ex.AssertStackTraceMatching(
                @"^\s*at LightBDD.Framework.UnitTests.Scenarios.Fluent.Fluent_scenario_exception_stack_trace_integration_tests.Step_throwing_exception[^\n]*
\s*at LightBDD.Framework.Scenarios.Basic.Implementation.BasicStepCompiler.StepExecutor.Execute[^\n]*
([^\n]*
)?\s*at LightBDD.Framework.Scenarios.Fluent.Implementation.ScenarioBuilder[^\n]*RunAsync[^\n]*");
        }
        public async Task Runner_should_allow_fluent_scenario_execution_in_async_mode()
        {
            var stepDescriptors = new[] { new StepDescriptor("foo", (ctx, args) => Task.FromResult(DefaultStepResultDescriptor.Instance)) };

            ExpectNewScenarioWithSteps(stepDescriptors);
            ExpectRunAsync();

            var builder = _runner.NewScenario();

            builder.Integrate().AddSteps(stepDescriptors);
            await builder.RunAsync();

            VerifyAllExpectations();
        }