コード例 #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>();
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        public void SetUp()
        {
            var            runner  = TestRunnerBuilder.ForFixture <TableOnlyFixture>();
            FixtureLibrary library = runner.Library;

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

            fixtureGraph = library.FixtureFor("LinesOnly");
        }
コード例 #5
0
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture <LinesOnlyFixture>();

            FixtureLibrary library = runner.Library;

            sentence = library.FixtureFor("LinesOnly").GrammarFor("Go").ShouldBeOfType <Sentence>();
        }
コード例 #6
0
        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();
        }
コード例 #7
0
        public GrammarStructure ToStructure(FixtureLibrary library)
        {
            FixtureGraph fixture = library.FixtureFor(typeof(T).GetFixtureAlias());

            return(new EmbeddedSection(fixture, Label, LeafName())
            {
                Style = Style
            });
        }
コード例 #8
0
        public void SetUp()
        {
            FixtureLibrary library =
                FixtureLibrary.For(x => x.AddFixturesFromAssemblyContaining <EmbeddedChoicesFixture>());

            // Look for the EmbeddedChoicesFixture
            fixture    = library.FixtureFor("EmbeddedChoices");
            fixtureTag = new FixtureTag(fixture);
        }
コード例 #9
0
        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();
        }
コード例 #10
0
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture <VerificationFixture>();

            FixtureLibrary library = runner.Library;

            verification =
                library.FixtureFor("Verification").GrammarFor("theStates").ShouldBeOfType <SetVerification>();
        }
コード例 #11
0
        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();
        }
コード例 #12
0
ファイル: UsageGraph.cs プロジェクト: larsw/storyteller
        public UsageGraph(FixtureLibrary library, IUsageGraphListener listener)
        {
            _library  = library;
            _listener = listener;

            _fixtures.OnMissing = name =>
            {
                var fixture = library.FixtureFor(name);
                return(new FixtureUsage(fixture));
            };
        }
コード例 #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));
        }
コード例 #14
0
ファイル: TestParserTester.cs プロジェクト: larsw/storyteller
        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>();
        }
コード例 #15
0
        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();
        }
コード例 #16
0
        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));
        }
コード例 #17
0
        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);
        }
コード例 #18
0
ファイル: TestParserTester.cs プロジェクト: larsw/storyteller
        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
            });
        }
コード例 #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)");
        }
コード例 #20
0
        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()));
        }
コード例 #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"));
        }
コード例 #22
0
        public void negative_case()
        {
            var fixture = library.FixtureFor("Sentence");

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