public async Task It_should_allow_to_run_asynchronous_scenarios() { ExpectAsynchronousScenarioRun(); await Runner.RunScenarioAsync( _ => Step_one_async(), _ => Step_two_async()); MockScenarioRunner.Verify(); }
public void It_should_allow_to_run_synchronous_scenarios() { ExpectSynchronousScenarioRun(); Runner.RunScenario( _ => Step_one(), _ => Step_two()); MockScenarioRunner.Verify(); }
public void Generic_WithContext_should_takeOwnership_by_default() { ExpectNewScenario(); ExpectContext(); Runner.Object .WithContext <List <string> >() .Integrate().NewScenario(); MockScenarioRunner.Verify(x => x.WithContext(It.IsAny <Func <object> >(), true)); }
public void WithContext_accepting_instance_factory_should_honor_takeOwnership_override() { ExpectNewScenario(); ExpectContext(); Runner.Object .WithContext(() => new object(), false) .Integrate().NewScenario(); MockScenarioRunner.Verify(x => x.WithContext(It.IsAny <Func <object> >(), false)); }
public void WithContext_accepting_instance_should_not_takeOwnership_by_default() { ExpectNewScenario(); ExpectContext(); Runner.Object .WithContext(new object()) .Integrate().NewScenario(); MockScenarioRunner.Verify(x => x.WithContext(It.IsAny <Func <object> >(), false)); }
public void Generic_WithContext_should_use_DI_container() { ExpectNewScenario(); ExpectResolvedContext(); Runner.Object .WithContext <List <string> >() .Integrate().NewScenario(); MockScenarioRunner.Verify(x => x.WithContext(It.IsAny <Func <IDependencyResolver, object> >(), null)); }
public async Task It_should_not_capture_single_character_but_everything_else_for_step_type_in_asynchronous_run() { ExpectAsynchronousScenarioRun(); await Runner.RunScenarioAsync( _ => Step_one_async(), x => Step_one_async(), when => Step_two_async(), xx => Step_two_async() ); MockScenarioRunner.Verify(); Assert.That(CapturedSteps, Is.Not.Null); Assert.That(CapturedSteps.Length, Is.EqualTo(4)); AssertStep(CapturedSteps[0], nameof(Step_one_async)); AssertStep(CapturedSteps[1], nameof(Step_one_async)); AssertStep(CapturedSteps[2], nameof(Step_two_async), "when"); AssertStep(CapturedSteps[3], nameof(Step_two_async), "xx"); }