public void exceptions_are_critical()
        {
            var context = SpecContext.ForTesting();
            var ex      = new DivideByZeroException();

            var section = new Section("Math")
            {
                id = "5"
            };
            var action = SilentAction.AsCritical("Fixture", Stage.teardown, x => { throw ex; }, section);

            action.Execute(context);

            context.CanContinue().ShouldBe(false);
        }
Esempio n. 2
0
        private IEnumerable<IExecutionStep> toExecutionSteps(FixtureLibrary library, Fixture fixture)
        {
            var setup = SilentAction.AsCritical("Fixture", Stage.setup, x =>
            {
                fixture.Context = x;
                fixture.SetUp();
            }, this);
            setup.Subject = Key + ":SetUp";

            yield return setup;

            // Ignore comments!
            foreach (var step in Children.OfType<Step>())
            {
                var grammar = fixture.GrammarFor(step.Key);
                yield return grammar.CreatePlan(step, library);
            }

            var teardown = SilentAction.AsCritical("Fixture", Stage.teardown, x => fixture.TearDown(), this);
            teardown.Subject = Key + ":TearDown";
            yield return teardown;
        }