Exemplo n.º 1
0
        public void Execute(ThrowingMethods throwingMethods)
        {
            var scenario = new DisposableScenario(throwingMethods);

            var bddifier = scenario.LazyBDDfy();

            try
            {
                // we need TestObject for this test; so I disable StoryCache processor for this one test
                BDDfy.Configuration.Configurator.Processors.StoryCache.Disable();
                bddifier.Run();
            }
            catch (Exception)
            {
                // there will be an exception but we do not care about it
            }
            finally
            {
                BDDfy.Configuration.Configurator.Processors.StoryCache.Enable();
            }
            var story = bddifier.Story;

            Assert.That(story.Scenarios.All(s => ((DisposableScenario)s.TestObject).Disposed), Is.False);
            Assert.That(scenario.Disposed, Is.False);
        }
        public void Execute(ThrowingMethods methodToThrow, bool useFluentScanner)
        {
            SetThrowingStep(methodToThrow);

            Engine engine = useFluentScanner ? FluentScannerBddifier() : ReflectingScannersBddifier();

            try
            {
                engine.Run();
            }
            finally
            {
                Story     = engine.Story;
                _scenario = engine.Story.Scenarios.First();
            }
        }
Exemplo n.º 3
0
        public void Execute(ThrowingMethods throwingMethods)
        {
            var scenario = new DisposableScenario(throwingMethods);

            var bddifier = scenario.LazyBDDfy();
            try
            {
                bddifier.Run();
            }
            catch (Exception)
            {
                // there will be an exception but we do not care about it
            }
            var story = bddifier.Story;

            Assert.That(story.Scenarios.All(s => ((DisposableScenario)s.TestObject).Disposed), Is.False);
            Assert.That(scenario.Disposed, Is.False);
        }
Exemplo n.º 4
0
        public void Execute(ThrowingMethods throwingMethods)
        {
            var scenario = new DisposableScenario(throwingMethods);

            var bddifier = scenario.LazyBDDfy();

            try
            {
                bddifier.Run();
            }
            catch (Exception)
            {
                // there will be an exception but we do not care about it
            }
            var story = bddifier.Story;

            Assert.That(story.Scenarios.All(s => ((DisposableScenario)s.TestObject).Disposed), Is.False);
            Assert.That(scenario.Disposed, Is.False);
        }
        private void SetThrowingStep(ThrowingMethods methodToThrow)
        {
            _givenShouldThrow = false;
            _whenShouldThrow  = false;
            _thenShouldThrow  = false;

            switch (methodToThrow)
            {
            case ThrowingMethods.Given:
                _givenShouldThrow = true;
                break;

            case ThrowingMethods.When:
                _whenShouldThrow = true;
                break;

            case ThrowingMethods.Then:
                _thenShouldThrow = true;
                break;
            }
        }
        public void Execute(ThrowingMethods throwingMethods)
        {
            var scenario = new DisposableScenario(throwingMethods);

            var bddifier = scenario.LazyBDDfy();
            try
            {
                // we need TestObject for this test; so I disable StoryCache processor for this one test
                BDDfy.Configuration.Configurator.Processors.StoryCache.Disable();
                bddifier.Run();
            }
            catch (Exception)
            {
                // there will be an exception but we do not care about it
            }
            finally
            {
                BDDfy.Configuration.Configurator.Processors.StoryCache.Enable();
            }
            var story = bddifier.Story;

            story.Scenarios.All(s => ((DisposableScenario)s.TestObject).Disposed).ShouldBe(false);
            scenario.Disposed.ShouldBe(false);
        }
Exemplo n.º 7
0
 public DisposableScenario(ThrowingMethods throwingMethods)
 {
     _givenThrows = (throwingMethods & ThrowingMethods.Given) > 0;
     _whenThrows  = (throwingMethods & ThrowingMethods.When) > 0;
     _thenThrows  = (throwingMethods & ThrowingMethods.Then) > 0;
 }
 public DisposableScenario(ThrowingMethods throwingMethods)
 {
     _givenThrows = (throwingMethods & ThrowingMethods.Given) > 0;
     _whenThrows = (throwingMethods & ThrowingMethods.When) > 0;
     _thenThrows = (throwingMethods & ThrowingMethods.Then) > 0;
 }