示例#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
        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);
        }
        protected override void beforeEach()
        {
            fixture = new FixtureGraph("Math");
            Services.Inject <IFixtureNode>(fixture);


            ThePresenter.Activate(null);
        }
        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
        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
        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);
        }
        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
        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));
        }
        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");
        }
        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
        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
        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);
        }
        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 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));
        }
        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;
        }
        public void SetUp()
        {
            var runner = TestRunnerBuilder.ForFixture<LinesOnlyFixture>();
            FixtureLibrary library = runner.Library;

            fixtureGraph = library.FixtureFor("LinesOnly");
        }
示例#36
0
        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);
        }
        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
        void ITestStream.StartSection(Section section, FixtureGraph fixture)
        {
            var sectionTag = new SectionTag(section, fixture);
            sectionTag.WriteResults(_context);

            _document.Add(sectionTag);

            _document.PushWithoutAttaching(sectionTag.StepHolder);
        }
        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;
 }
        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>();
        }
        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);
        }