コード例 #1
0
        public void SetUp()
        {
            graph     = new FixtureGraph("something");
            structure = new StubGrammarStructure();

            graph.AddStructure("grammar1", structure);
        }
コード例 #2
0
        public void ConfigurePartAdders(OutlineNode node, FixtureGraph fixture, IPartHolder holder)
        {
            var selector   = new OutlineGrammarSelector(node);
            var configurer = new GrammarSelectorConfigurer(holder, selector, _controller);

            configurer.Configure(fixture);
        }
コード例 #3
0
ファイル: TestEditorTag.cs プロジェクト: larsw/storyteller
        public TestEditorTag(FixtureLibrary library) : base("div")
        {
            AddClass("main");
            Add("h2").AddClass(HtmlClasses.TEST_NAME);
            Id("testEditor");

            AddClass(HtmlClasses.TEST_EDITOR);

            _container = Add("div").AddClasses("container", HtmlClasses.SECTION, "test-editor");

            FixtureGraph fixture = library.BuildTopLevelGraph();

            HtmlTag holder = new HolderTag(fixture).AddClass("top-level-holder");

            holder.Children.Last().Render(false);

            Container
            .MetaData(GrammarConstants.LEAF_NAME, GrammarConstants.TEST)
            .MetaData(GrammarConstants.FIXTURE, GrammarConstants.TEST)
            .MetaData(GrammarConstants.SELECTION_MODE, SelectionMode.OneOrMore.ToString())
            .Append(holder)
            .Append(new HtmlTag("hr"));


            Container.ActionLink(fixture.Policies.AddGrammarText, GrammarConstants.ADD_SECTION_ACTIVATOR);
            Container.Append(new GrammarSelector(fixture).Build());
        }
コード例 #4
0
        private FixtureTag writeFixture(FixtureGraph fixture)
        {
            _fixtureTag = new FixtureTag(fixture);
            _top.Append(_fixtureTag);

            return(_fixtureTag);
        }
コード例 #5
0
        public void close_should_not_appear_in_the_html_for_a_single_selection_fixture()
        {
            var fixture = new FixtureGraph("Math");

            fixture.Policies.SelectionMode = SelectionMode.Single;

            new GrammarSelector(fixture).Build().ToString().ShouldNotContain(GrammarConstants.CLOSE);
        }
コード例 #6
0
        protected override void beforeEach()
        {
            fixture = new FixtureGraph("Math");
            Services.Inject <IFixtureNode>(fixture);


            ThePresenter.Activate(null);
        }
コード例 #7
0
        public void combines_the_list_of_all_errors()
        {
            var graph = new FixtureGraph("Math");
            graph.AddStructure("key1", new StubGrammarStructure().AddError("error1"));
            graph.AddStructure("key2", new StubGrammarStructure().AddError("error1").AddError("error 2"));

            graph.AllErrors().Count().ShouldEqual(3);
        }
コード例 #8
0
        public void LogFixtureFailure(string fixtureName, Exception exception)
        {
            sendMessage(fixtureName);

            FixtureGraph fixtureGraph = _library.FixtureFor(fixtureName);

            fixtureGraph.LogError(exception);
        }
コード例 #9
0
        private void readGrammar(IGrammar grammar, FixtureGraph fixtureGraph, string key)
        {
            GrammarStructure structure = grammar.ToStructure(_library);

            structure.Description = grammar.Description;

            fixtureGraph.AddStructure(key, structure);
        }
コード例 #10
0
ファイル: HolderTagTester.cs プロジェクト: larsw/storyteller
        public void should_not_show_the_add_grammar_text_for_mandatory_auto_selection()
        {
            var fixture = new FixtureGraph();

            fixture.Policies.SelectionMode = SelectionMode.MandatoryAutoSelect;

            new HolderTag(fixture).ToString().ShouldNotContain(fixture.Policies.AddGrammarText);
        }
コード例 #11
0
ファイル: HolderTagTester.cs プロジェクト: larsw/storyteller
        public void should_show_the_add_grammar_text_for_non_single_selection()
        {
            var fixture = new FixtureGraph();

            fixture.Policies.SelectionMode = SelectionMode.Any;

            new HolderTag(fixture).ToString().ShouldContain(fixture.Policies.AddGrammarText);
        }
コード例 #12
0
        public void required_should_not_appear_in_the_html_for_a_multiple_selection_fixture()
        {
            var fixture = new FixtureGraph("Math");

            fixture.Policies.SelectionMode = SelectionMode.Any;

            new GrammarSelector(fixture).Build().ToString().ShouldNotContain(GrammarConstants.REQUIRED);
        }
コード例 #13
0
        void ITestStream.StartSection(Section section, FixtureGraph fixture)
        {
            var sectionTag = new SectionTag(section, fixture);

            _document.Add(sectionTag);

            _document.PushWithoutAttaching(sectionTag.Body);
        }
コード例 #14
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();
        }
コード例 #15
0
        public GrammarStructure ToStructure(FixtureLibrary library)
        {
            FixtureGraph fixture = library.FixtureFor(typeof(T).GetFixtureAlias());

            return(new EmbeddedSection(fixture, Label, LeafName())
            {
                Style = Style
            });
        }
コード例 #16
0
        public void combines_the_list_of_all_errors()
        {
            var graph = new FixtureGraph("Math");

            graph.AddStructure("key1", new StubGrammarStructure().AddError("error1"));
            graph.AddStructure("key2", new StubGrammarStructure().AddError("error1").AddError("error 2"));

            graph.AllErrors().Count().ShouldEqual(3);
        }
コード例 #17
0
ファイル: TestParserTester.cs プロジェクト: larsw/storyteller
        public void relay_to_the_stream_when_the_new_section_can_be_found()
        {
            FixtureGraph fixture = library.FixtureFor("Existing");
            var          section = new Section(fixture.Name);

            parser.As <ITestVisitor>().StartSection(section);

            stream.AssertWasCalled(x => x.StartSection(section, fixture));
        }
コード例 #18
0
        public void text_for_single_selection_fixture_should_be_change()
        {
            var fixture = new FixtureGraph();

            fixture.Policies.SelectionMode = SelectionMode.Single;

            var tag = new RemoveLinkTag(fixture);

            tag.Text().ShouldEqual("change");
        }
コード例 #19
0
        public void text_for_multiple_selection_mode_should_be_delete()
        {
            var fixture = new FixtureGraph();

            fixture.Policies.SelectionMode = SelectionMode.Any;

            var tag = new RemoveLinkTag(fixture);

            tag.Text().ShouldEqual("delete");
        }
コード例 #20
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();
        }
コード例 #21
0
ファイル: FixtureTag.cs プロジェクト: larsw/storyteller
        public FixtureTag(FixtureGraph fixture)
            : base("div")
        {
            Id(fixture.Name);
            _fixture = fixture;

            Add <CommentTag>();
            Add <TagsTag>();

            fixture.TopLevelGrammars().Each(writeGrammar);
        }
コード例 #22
0
        private void writeFailedFixture(HtmlDocument document, FixtureGraph fixture)
        {
            document.Add("h3").Text("Fixture:  " + fixture.Name);

            fixture.Errors.Each(e =>
            {
                document.Add("div").Append(new ExceptionTag(e.ErrorText));
            });

            document.Add("hr");
        }
コード例 #23
0
        public void StartSection(Section section, FixtureGraph fixture)
        {
            withNewNode(section, Icon.Section, node =>
            {
                node.AddText(fixture.Label);
                node.ToolTip = fixture.FixtureClassName;

                addRearrangeCommands(node);
                _configurer.ConfigurePartAdders(node, fixture, section);
            });
        }
コード例 #24
0
ファイル: HolderTag.cs プロジェクト: larsw/storyteller
        public HolderTag(FixtureGraph fixture)
            : base("div")
        {
            Add("div").AddClass(GrammarConstants.STEP_HOLDER);

            if (fixture.IsSingleSelection() || fixture.Policies.SelectionMode == SelectionMode.MandatoryAutoSelect)
            {
                return;
            }

            this.ActionLink(fixture.Policies.AddGrammarText, GrammarConstants.ADD_SECTION_ACTIVATOR);
        }
コード例 #25
0
        public SectionTag(Section section, FixtureGraph fixture)
            : base("div")
        {
            _section = section;
            _fixture = fixture;

            Add("h3").Text(_fixture.Label ?? _fixture.Name).AddClass(HtmlClasses.SECTION_TITLE).Title(fixture.FixtureClassName);

            AddClass("section");

            _body = Add("div").AddClass("section-body");
        }
コード例 #26
0
        public SectionTag(Section section, FixtureGraph fixture)
            : base("div")
        {
            _section = section;
            _fixture = fixture;

            Add("h3").Text(_fixture.Label ?? _fixture.Name).AddClass(HtmlClasses.SECTION_TITLE).Title(fixture.FixtureClassName);

            AddClass("section");

            _body = Add("div").AddClass("section-body");
        }
コード例 #27
0
        protected override void theContextIs()
        {
            treeBuilder.StartTest(theTest);
            fixture = theLibrary.FixtureFor("Math");

            fixture.FixtureClassName = "Math Classname";
            fixture.Label            = "the title of this fixture";

            section = new Section(fixture.Name);

            treeBuilder.StartTest(theTest);
            treeBuilder.StartSection(section, fixture);
        }
コード例 #28
0
        public HtmlTag Build()
        {
            _top = new DivTag(GrammarConstants.FIXTURE_SELECTOR).Hide();

            FixtureGraph topFixture     = _library.BuildTopLevelGraph();
            var          topFixtureNode = writeFixture(topFixture);

            topFixtureNode.Children.Each(x => x.AddClass("top-node"));

            _library.ActiveFixtures.Each(f => writeFixture(f));

            return(_top);
        }
コード例 #29
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);
        }
コード例 #30
0
        public void read_a_fixture_with_grammar_errors()
        {
            var fixture = new GrammarErrorFixture();

            fixture.Errors.Count().ShouldEqual(2);

            builder.ReadFixture("GrammarError", fixture);

            FixtureGraph fixtureGraph = builder.Library.FixtureFor("GrammarError");

            fixtureGraph.AllErrors().Count().ShouldEqual(2);

            fixtureGraph.AllErrors().Each(x => x.Node.ShouldEqual(fixtureGraph));
        }
コード例 #31
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());
        }
コード例 #32
0
        public SectionTag(Section section, FixtureGraph fixture)
            : base("div")
        {
            _section = section;
            _fixture = fixture;

            AddClass("section");
            AddClass("embedded");

            Add("div").AddClass("section-header")
                .Add("div").AddClass(HtmlClasses.SECTION_TITLE).Text(_fixture.Title);

            _stepHolder = Add("div").Add("div").AddClass("step-holder");
        }
コード例 #33
0
        public void SetUp()
        {
            fixture = new FixtureGraph();
            fixture.AddStructure("Hidden1", new Sentence());
            fixture.AddStructure("Hidden2", new Sentence());
            fixture.AddStructure("NotHidden3", new Sentence());
            fixture.AddStructure("NotHidden4", new Sentence());

            var constraints = new Policies();

            constraints.HideGrammar("Hidden1");
            constraints.HideGrammar("Hidden2");

            fixture.Policies = constraints;
        }
コード例 #34
0
        public FixtureGraph BuildTopLevelGraph()
        {
            var fixture = new FixtureGraph("Test");
            fixture.Policies.SelectionMode = SelectionMode.OneOrMore;
            fixture.Policies.AddGrammarText = "Add Section";

            _fixtures.Where(x => !x.Policies.IsPrivate).Each(x =>
            {
                var grammar = new EmbeddedSection(x, x.Title ?? x.Name, x.Name);
                grammar.Style = EmbedStyle.TitledAndIndented;
                fixture.AddStructure(x.Name, grammar);
            });

            return fixture;
        }
コード例 #35
0
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture<LinesOnlyFixture>();
            FixtureLibrary library = runner.Library;

            fixtureGraph = library.FixtureFor("LinesOnly");
        }
コード例 #36
0
ファイル: PreviewWriter.cs プロジェクト: abombss/storyteller
        void ITestStream.StartSection(Section section, FixtureGraph fixture)
        {
            var sectionTag = new SectionTag(section, fixture);

            _document.Add(sectionTag);

            _document.PushWithoutAttaching(sectionTag.Body);
        }
コード例 #37
0
        private void readGrammar(IGrammar grammar, FixtureGraph fixtureGraph, string key)
        {
            GrammarStructure structure = grammar.ToStructure(_library);
            structure.Description = grammar.Description;

            fixtureGraph.AddStructure(key, structure);
        }
コード例 #38
0
        public void SetUp()
        {
            fixture = new FixtureGraph();
            fixture.AddStructure("Hidden1", new Sentence());
            fixture.AddStructure("Hidden2", new Sentence());
            fixture.AddStructure("NotHidden3", new Sentence());
            fixture.AddStructure("NotHidden4", new Sentence());

            var constraints = new Policies();
            constraints.HideGrammar("Hidden1");
            constraints.HideGrammar("Hidden2");

            fixture.Policies = constraints;
        }
コード例 #39
0
        public void SetUp()
        {
            graph = new FixtureGraph("something");
            structure = new StubGrammarStructure();

            graph.AddStructure("grammar1", structure);
        }
コード例 #40
0
        protected override void theContextIs()
        {
            step = new Step().With("x", 1).With("y", 2);

            treeBuilder.StartTest(theTest);

            section = new Section("Math");

            treeBuilder.StartTest(theTest);
            treeBuilder.StartSection(section, new FixtureGraph("Math"));

            theFixture = new FixtureGraph("new");
            embedded = new EmbeddedSection(theFixture, "the label of embedded", "embedded");
            treeBuilder.StartEmbeddedSection(embedded, step);
        }
コード例 #41
0
ファイル: ResultsWriter.cs プロジェクト: wbinford/storyteller
        void ITestStream.StartSection(Section section, FixtureGraph fixture)
        {
            var sectionTag = new SectionTag(section, fixture);
            sectionTag.WriteResults(_context);

            _document.Add(sectionTag);

            _document.PushWithoutAttaching(sectionTag.StepHolder);
        }
コード例 #42
0
        public void SetUp()
        {
            var runner = new TestRunner(x => x.AddFixture<LinesOnlyFixture>());
            FixtureLibrary library = runner.Library;

            fixtureGraph = library.FixtureFor("LinesOnly");
        }
コード例 #43
0
 public GrammarSelector(FixtureGraph fixture)
 {
     _fixture = fixture;
 }
コード例 #44
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>();
        }
コード例 #45
0
        protected override void theContextIs()
        {
            treeBuilder.StartTest(theTest);
            fixture = theLibrary.FixtureFor("Math");

            fixture.FixtureClassName = "Math Classname";
            fixture.Label = "the title of this fixture";

            section = new Section(fixture.Name);

            treeBuilder.StartTest(theTest);
            treeBuilder.StartSection(section, fixture);
        }