public void accept_visitor() { var executor = MockRepository.GenerateMock<IStepExecutor>(); var action = new SilentAction("Fixture", Stage.setup, x => { }, new Section("Math")); action.AcceptVisitor(executor); executor.AssertWasCalled(x => x.Line(action)); }
public void accept_visitor() { var executor = Substitute.For<ILineStepGatherer>(); var action = new SilentAction("Fixture", Stage.setup, x => { }, new Section("Math")); action.AcceptVisitor(executor); executor.Received().Line(action); }
public void execute_happy_path() { var wasCalled = false; var section = new Section("Math"){id = "4"}; var action = new SilentAction("Fixture", Stage.setup, x => wasCalled = true, section); var context = SpecContext.ForTesting(); action.Execute(context); ShouldBeTestExtensions.ShouldBe(wasCalled, true); }
public void execute_sad_path() { var context = SpecContext.ForTesting(); var ex = new DivideByZeroException(); var section = new Section("Math") {id = "5"}; var action = new SilentAction("Fixture", Stage.teardown, x => { throw ex; }, section); action.Execute(context); var result = context.Results.Single().ShouldBeOfType<StepResult>(); result.id.ShouldBe(section.id); result.position.ShouldBe(Stage.teardown.ToString()); result.status.ShouldBe(ResultStatus.error); result.error.ShouldContain("DivideByZeroException"); }