public void It_should_allow_to_apply_context_instance() { var capture = _builder.ExpectContext(); var context = new object(); _runner.WithContext(context); _builder.Verify(); Assert.That(capture.Value.Invoke(), Is.SameAs(context)); }
private static Task RunScenarioAsync(IBddRunner runner) { return(runner.WithContext(new ExplicitContext()).RunScenarioAsync( ctx => ctx.Given_implicit_context_initialized(), ctx => ctx.When_time_elapsed_allowing_other_scenario_to_execute_concurrently(), ctx => ctx.Then_implicit_context_should_be_preserved(), ctx => ctx.Then_implicit_context_should_be_preserved_in_subtasks())); }
public void It_should_run_contextual_scenarios() { var ex = Assert.ThrowsAsync <Exception>(() => _runner .WithContext(new object()) .AddSteps(_ => Step_one_async_action()) .RunAsync()); Assert.That(ex.Message, Is.EqualTo(nameof(Step_one_async_action))); }
public void WithContext_accepting_instance_should_not_takeOwnership_by_default() { _runner.WithContext(new object()); _builder.Verify(x => x.WithContext(It.IsAny <Func <object> >(), false)); }