public void SetUp()
        {
            FixtureLibrary library = TestRunnerBuilder.ForFixture <MathFixture>().Library;
            FixtureGraph   fixture = library.FixtureFor("Math");

            embeddedSection =
                new EmbeddedSectionGrammar <MathFixture>().ToStructure(library).ShouldBeOfType <EmbeddedSection>();
            embeddedSection.Name = "MathGrammar";

            theExample = embeddedSection.CreateExample();
        }
        public void execute_when_the_fixture_setup_fails_should_log_the_exception()
        {
            string sectionName = typeof(FixtureThatThrowsExceptionInSetUp).GetFixtureAlias();
            Step step = new Step().WithChildren(sectionName);

            var grammar = new EmbeddedSectionGrammar<FixtureThatThrowsExceptionInSetUp>();

            var results = grammar.Execute(step);

            results.Results.ExceptionText.ShouldNotBeNull();
        }
        public void execute_when_the_fixture_setup_fails_should_log_the_exception()
        {
            string sectionName = typeof(FixtureThatThrowsExceptionInSetUp).GetFixtureAlias();
            Step   step        = new Step().WithChildren(sectionName);

            var grammar = new EmbeddedSectionGrammar <FixtureThatThrowsExceptionInSetUp>();

            var results = grammar.Execute(step);

            results.Results.ExceptionText.ShouldNotBeNull();
        }
        public void execute_when_the_fixture_teardown_fails_should_log_the_exception()
        {
            string sectionName = typeof(FixtureThatThrowsExceptionInTearDown).GetFixtureAlias();
            Step   step        = new Step().WithChildren(sectionName);

            var grammar = new EmbeddedSectionGrammar <FixtureThatThrowsExceptionInTearDown>();

            StepExecutionResult results = grammar.Execute(step);

            results.Counts.Exceptions.ShouldEqual(1);

            results.Results.ExceptionText.ShouldNotBeNull();
        }
        public void create_an_embeddedSection_grammar_structure()
        {
            var library = new FixtureLibrary();
            FixtureGraph fixture = library.FixtureFor("Arithmetic");

            var grammar = new EmbeddedSectionGrammar<ArithmeticFixture>
            {
                Label = "The embedded section",
                Style = EmbedStyle.Inline
            }.LeafName("step name");
            var embeddedSection = grammar.ToStructure(library).ShouldBeOfType<EmbeddedSection>();

            embeddedSection.ShouldEqual(new EmbeddedSection(fixture, grammar.Label, grammar.LeafName()));
        }
        public void should_copy_the_style_from_the_grammar()
        {
            var          library = new FixtureLibrary();
            FixtureGraph fixture = library.FixtureFor("Arithmetic");

            var grammar = new EmbeddedSectionGrammar <ArithmeticFixture>
            {
                Label = "The embedded section",
                Style = EmbedStyle.Inline
            }.LeafName("step name");
            var embeddedSection = grammar.ToStructure(library).ShouldBeOfType <EmbeddedSection>();

            embeddedSection.Style.ShouldEqual(EmbedStyle.Inline);
        }
        public void create_an_embeddedSection_grammar_structure()
        {
            var          library = new FixtureLibrary();
            FixtureGraph fixture = library.FixtureFor("Arithmetic");

            var grammar = new EmbeddedSectionGrammar <ArithmeticFixture>
            {
                Label = "The embedded section",
                Style = EmbedStyle.Inline
            }.LeafName("step name");
            var embeddedSection = grammar.ToStructure(library).ShouldBeOfType <EmbeddedSection>();


            embeddedSection.ShouldEqual(new EmbeddedSection(fixture, grammar.Label, grammar.LeafName()));
        }
        public void execute_when_the_fixture_teardown_fails_should_log_the_exception()
        {
            string sectionName = typeof(FixtureThatThrowsExceptionInTearDown).GetFixtureAlias();
            Step step = new Step().WithChildren(sectionName);

            var grammar = new EmbeddedSectionGrammar<FixtureThatThrowsExceptionInTearDown>();

            StepExecutionResult results = grammar.Execute(step);
            results.Counts.Exceptions.ShouldEqual(1);

            results.Results.ExceptionText.ShouldNotBeNull();
        }
        public void should_copy_the_style_from_the_grammar()
        {
            var library = new FixtureLibrary();
            FixtureGraph fixture = library.FixtureFor("Arithmetic");

            var grammar = new EmbeddedSectionGrammar<ArithmeticFixture>
            {
                Label = "The embedded section",
                Style = EmbedStyle.Inline
            }.LeafName("step name");
            var embeddedSection = grammar.ToStructure(library).ShouldBeOfType<EmbeddedSection>();

            embeddedSection.Style.ShouldEqual(EmbedStyle.Inline);
        }
Beispiel #10
0
 public BuildModelWithFixture(string title = "If the input is")
 {
     _grammar = new EmbeddedSectionGrammar <TFixture> {
         Title = title
     };
 }