Inheritance: ILineExecution
コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);

        }
コード例 #4
0
        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");


        }