Exemple #1
0
        public void SetUp()
        {
            library = new FixtureLibrary();
            library.FixtureFor("Math").Policies.IsPrivate        = false;
            library.FixtureFor("Algebra").Policies.IsPrivate     = false;
            library.FixtureFor("MathDetails").Policies.IsPrivate = true;
            library.FixtureFor("Calculus").Policies.IsPrivate    = false;

            topFixture = library.BuildTopLevelGraph();

            mathSection = topFixture.GrammarFor("Math").ShouldBeOfType <EmbeddedSection>();
        }
        public void SetUp()
        {
            library = new FixtureLibrary();
            FixtureGraph fixture1 = library.FixtureFor("Math");

            fixture1.AddStructure("Grammar1", new Sentence());
            fixture1.AddStructure("Grammar2", new Sentence());
            fixture1.AddStructure("Grammar3", new Sentence());

            FixtureGraph fixture2 = library.FixtureFor("Arithmetic");

            fixture2.AddStructure("Grammar4", new Sentence());
            fixture2.AddStructure("Grammar5", new Sentence());
        }
        public void SetUp()
        {
            var            runner  = TestRunnerBuilder.ForFixture <TableOnlyFixture>();
            FixtureLibrary library = runner.Library;

            table = library.FixtureFor("TableOnly").GrammarFor("Go").ShouldBeOfType <Table>();
        }
        public void SetUp()
        {
            var            runner  = TestRunnerBuilder.ForFixture <LinesOnlyFixture>();
            FixtureLibrary library = runner.Library;

            fixtureGraph = library.FixtureFor("LinesOnly");
        }
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture <LinesOnlyFixture>();

            FixtureLibrary library = runner.Library;

            sentence = library.FixtureFor("LinesOnly").GrammarFor("Go").ShouldBeOfType <Sentence>();
        }
        public void the_context_should_not_show_up_in_example()
        {
            ITestRunner    runner  = TestRunnerBuilder.ForFixture <AddressCheckFixture>();
            FixtureLibrary library = runner.Library;
            IStep          step    = library.FixtureFor("AddressCheck").GrammarFor("LoadList1").CreateExample();

            step.Has("context").ShouldBeFalse();
        }
        public GrammarStructure ToStructure(FixtureLibrary library)
        {
            FixtureGraph fixture = library.FixtureFor(typeof(T).GetFixtureAlias());

            return(new EmbeddedSection(fixture, Label, LeafName())
            {
                Style = Style
            });
        }
        public void SetUp()
        {
            FixtureLibrary library =
                FixtureLibrary.For(x => x.AddFixturesFromAssemblyContaining <EmbeddedChoicesFixture>());

            // Look for the EmbeddedChoicesFixture
            fixture    = library.FixtureFor("EmbeddedChoices");
            fixtureTag = new FixtureTag(fixture);
        }
        public void fixture_graph_should_have_the_policies_from_the_original_fixture()
        {
            FixtureGraph fixture = library.FixtureFor(typeof(FixtureWithHiddenGrammarsFixture).GetFixtureAlias());

            fixture.Policies.IsHidden("Hidden1").ShouldBeTrue();
            fixture.Policies.IsHidden("Hidden2").ShouldBeTrue();
            fixture.Policies.IsHidden("NotHidden1").ShouldBeFalse();
            fixture.Policies.IsHidden("NotHidden2").ShouldBeFalse();
        }
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture <VerificationFixture>();

            FixtureLibrary library = runner.Library;

            verification =
                library.FixtureFor("Verification").GrammarFor("theStates").ShouldBeOfType <SetVerification>();
        }
        public void SetUp()
        {
            FixtureLibrary library = FixtureLibrary.For(x => x.AddFixture <SentenceTargetFixture>());

            grammarTag =
                new GrammarTag(library.FixtureFor(typeof(SentenceTargetFixture).GetFixtureAlias()).GrammarFor("Go"));
            var writer = new SentenceWriter(grammarTag, new CellBuilderLibrary());

            writer.Write();
        }
Exemple #12
0
        public UsageGraph(FixtureLibrary library, IUsageGraphListener listener)
        {
            _library  = library;
            _listener = listener;

            _fixtures.OnMissing = name =>
            {
                var fixture = library.FixtureFor(name);
                return(new FixtureUsage(fixture));
            };
        }
Exemple #13
0
        public void ReadFixture(string fixtureName, IFixture fixture)
        {
            sendMessage(fixtureName);

            FixtureGraph fixtureGraph = _library.FixtureFor(fixtureName);

            fixtureGraph.FixtureClassName = fixture.GetType().FullName;
            fixtureGraph.FixtureNamespace = fixture.GetType().Namespace;
            fixtureGraph.Policies         = fixture.Policies;
            fixtureGraph.Description      = fixture.Description;
            fixtureGraph.Label            = fixture.Title.IsEmpty() ? fixtureName : fixture.Title;

            fixture.Errors.Each(x =>
            {
                x.Node = fixtureGraph;
                fixtureGraph.LogError(x);
            });

            fixture.ForEachGrammar((key, grammar) => readGrammar(grammar, fixtureGraph, key));
        }
Exemple #14
0
        public void SetUp()
        {
            library = new FixtureLibrary();
            test    = new Test("something");
            stream  = MockRepository.GenerateMock <ITestStream>();

            library.FixtureFor(GoodSection.FixtureName);

            parser      = new TestParser(test, stream, library);
            testVisitor = parser.As <ITestVisitor>();
        }
        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 SetUp()
        {
            container      = new Container();
            view           = new StubExplorerView();
            shellConductor = MockRepository.GenerateMock <IScreenConductor>();

            explorer = new FixtureExplorer(view, container);


            library = new FixtureLibrary();
            FixtureGraph fixture1 = library.FixtureFor("Math");

            fixture1.AddStructure("Grammar1", new Sentence());
            fixture1.AddStructure("Grammar2", new Sentence());
            fixture1.AddStructure("Grammar3", new Sentence());

            FixtureGraph fixture2 = library.FixtureFor("Arithmetic");

            fixture2.AddStructure("Grammar4", new Sentence());
            fixture2.AddStructure("Grammar5", new Sentence());

            explorer.Handle(new BinaryRecycleFinished(library));
        }
        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);
        }
Exemple #18
0
        private GrammarAndStep <T> runStep <T>(Action <T> configure) where T : GrammarStructure, new()
        {
            var grammar = new T();

            if (configure != null)
            {
                configure(grammar);
            }

            grammar.Name = "Good";
            library.FixtureFor(GoodSection.FixtureName).AddStructure("Good", grammar);

            var step = new Step("Good");

            testVisitor.StartSection(GoodSection);
            testVisitor.RunStep(step);

            return(new GrammarAndStep <T>
            {
                Step = step,
                Grammar = grammar
            });
        }
Exemple #19
0
        public void fixture_library_loaded_with_syntax_errors()
        {
            var library = new FixtureLibrary();
            StubGrammarStructure structure = new StubGrammarStructure()
                                             .AddError("bad error!")
                                             .AddError("bad error 2!")
                                             .AddError("bad error 3!");

            library.FixtureFor("math").AddStructure("g1", structure);
            library.HasErrors().ShouldBeTrue();

            ClassUnderTest.HandleMessage(new BinaryRecycleFinished(library));

            MockFor <IStatusView>().AssertWasCalled(x => x.SyntaxErrorText = "3 syntax error(s)");
        }
        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()));
        }
Exemple #21
0
        public void PossibleFixtures_uses_the_constraint_model_of_each_fixture_graph()
        {
            var library = new FixtureLibrary();

            library.FixtureFor("fixture1").Policies.IsPrivate = true;
            library.FixtureFor("fixture2").Policies.IsPrivate = false;
            library.FixtureFor("fixture3").Policies.IsPrivate = true;
            library.FixtureFor("fixture4").Policies.IsPrivate = false;

            library.PossibleFixturesFor(new Test("something")).ShouldHaveTheSameElementsAs(
                library.FixtureFor("fixture2"), library.FixtureFor("fixture4"));
        }
Exemple #22
0
        public void negative_case()
        {
            var fixture = library.FixtureFor("Sentence");

            fixture.IsMandatoryAutoSelectGrammar(fixture.GrammarFor("StartWithTheNumber")).ShouldBeFalse();
        }