Пример #1
0
        public void running_a_step_logs_the_start_and_end_of_the_grammar()
        {
            var step = new Step("the step");

            var listener = MockRepository.GenerateMock<ITestObserver>();
            listener.Expect(x => x.CanContinue(null)).Return(true).IgnoreArguments().Repeat.Any();

            var context = new TestContext(new Container(), new Test("Fake"), listener);
            IGrammar grammar = context.SetupMockGrammar(step.GrammarKey);

            context.RunStep(step);

            listener.AssertWasCalled(x => x.StartStep(step));
            listener.AssertWasCalled(x => x.FinishStep(step));
        }
Пример #2
0
        public void run_a_step()
        {
            var step = new Step("the step");

            var context = new TestContext();
            IGrammar grammar = context.SetupMockGrammar(step.GrammarKey);

            context.RunStep(step);

            grammar.AssertWasCalled(x => x.Execute(step, context));
        }
Пример #3
0
        public void catch_all_exception_on_grammar_adds_exception_count_and_exception_text()
        {
            var step = new Step("the step");
            var context = new TestContext();
            IGrammar grammar = context.SetupMockGrammar(step.GrammarKey);

            grammar.Expect(x => x.Execute(step, context))
                .Throw(new NotImplementedException());

            context.RunStep(step);

            context.Counts.ShouldEqual(0, 0, 1, 0);

            context.ResultsFor(step).ExceptionText.ShouldContain("NotImplementedException");
        }