public Execute ( SpecContext context ) : void | ||
context | SpecContext | |
return | void |
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"); }