Inheritance: IFixtureNode, IFixtureGraph
        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);
        }
        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);
        }
        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);
        }
Beispiel #4
0
        private FixtureTag writeFixture(FixtureGraph fixture)
        {
            _fixtureTag = new FixtureTag(fixture);
            _top.Append(_fixtureTag);

            return _fixtureTag;
        }
        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);
        }
 public EmbeddedSection(FixtureGraph fixture, string label, string childStepName)
 {
     Name = label;
     _fixture = fixture;
     _label = label;
     if (_label.IsEmpty()) _label = fixture.Name;
     _leafName = childStepName;
 }
        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");
        }
        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 SetUp()
        {
            FixtureLibrary library =
                FixtureLibrary.For(x => x.AddFixturesFromAssemblyContaining<EmbeddedChoicesFixture>());

            // Look for the EmbeddedChoicesFixture
            fixture = library.FixtureFor("EmbeddedChoices");
            fixtureTag = new FixtureTag(fixture);
        }
Beispiel #10
0
        public FixtureTag(FixtureGraph fixture)
            : base("div")
        {
            Id(fixture.Name);
            _fixture = fixture;

            Child<CommentTag>();

            fixture.TopLevelGrammars().Each(writeGrammar);
        }
Beispiel #11
0
 public EmbeddedSection(FixtureGraph fixture, string label, string leafName)
 {
     Name     = label;
     _fixture = fixture;
     _label   = label;
     if (_label.IsEmpty())
     {
         _label = fixture.Name;
     }
     _leafName = leafName;
 }
Beispiel #12
0
        public IFixtureNode Find(TPath path)
        {
            if (path.IsRoot)
            {
                return(this);
            }

            FixtureGraph fixture = FixtureFor(path.Next);

            return(path.IsEnd ? fixture : (IFixtureNode)fixture.GrammarFor(path.Pop().Next));
        }
        private void writeFailedFixture(HtmlDocument document, FixtureGraph fixture)
        {
            document.Add("h3").Text("Fixture:  " + fixture.Name);

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

            document.Add("hr");
        }
Beispiel #14
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);
        }
Beispiel #15
0
 public bool Equals(FixtureGraph obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(Equals(obj._name, _name));
 }
Beispiel #16
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.Label ?? x.Name, x.Name);
                grammar.Style = EmbedStyle.TitledAndIndented;
                fixture.AddStructure(x.Name, grammar);
            });

            return(fixture);
        }
        public void SetUp()
        {
            container = new Container(x =>
            {
                x.For<IFixtureNodeView>().Use<FixtureNodeView>();
                x.For<IScreen<IFixtureNode>>().Use<FixtureNodePresenter>();
            });

            factory = new ScreenFactory(container);

            fixture = new FixtureGraph("fixture1");

            subject = new FixtureNodeSubject(fixture);

            thePresenter = subject.CreateScreen(factory).ShouldBeOfType<FixtureNodePresenter>();
        }
        public void matches_by_fixture_node()
        {
            var fixture1 = new FixtureGraph("fixture1");
            var fixture2 = new FixtureGraph("fixture2");

            var screen1 = new FixtureNodePresenter(new StubFixtureNodeView(), fixture1, new UsageService());
            var screen2 = new FixtureNodePresenter(new StubFixtureNodeView(), fixture2, new UsageService());

            var subject = new FixtureNodeSubject(fixture1);

            subject.Matches(screen1).ShouldBeTrue();
            subject.Matches(screen2).ShouldBeFalse();

            var randomScreen = MockRepository.GenerateMock<IScreen>();
            subject.Matches(randomScreen).ShouldBeFalse();
        }
Beispiel #19
0
        void ITestVisitor.StartSection(Section section)
        {
            if (isLatched)
            {
                return;
            }
            string fixtureName = section.GetName();

            if (_library.HasFixture(fixtureName))
            {
                FixtureGraph fixture = _library.FixtureFor(fixtureName);
                _fixtureStack.Push(fixture);
                _stream.StartSection(section, fixture);
            }
            else
            {
                _stream.InvalidSection(section);
                _latchedSection = section;
            }
        }
Beispiel #20
0
 public RemoveLinkTag(FixtureGraph fixture)
     : base(fixture.IsSingleSelection() ? "change" : "delete", "#", GrammarConstants.DELETE_STEP)
 {
 }
        public void SetUp()
        {
            ProjectContext context = new ProjectContext();
            context.Hierarchy = DataMother.GrammarProject().LoadTests();
            context.Library = DataMother.GrammarsProjectRunner().GetLibary();
            UsageService service = new UsageService(context);

            container = new Container(x =>
            {
                x.For<IFixtureNodeView>().Use<StubFixtureNodeView>();
                x.For<IScreen<IFixtureNode>>().Use<FixtureNodePresenter>();
                x.For<UsageService>().Use(service);
            });

            factory = new ScreenFactory(container);

            fixture = context.Library.FixtureFor("Composite");

            subject = new FixtureNodeSubject(fixture);

            thePresenter = subject.CreateScreen(factory).ShouldBeOfType<FixtureNodePresenter>();
            thePresenter.Activate(null);
        }
 public void SetUp()
 {
     fixture = new FixtureGraph("Math");
 }
Beispiel #23
0
 private void writeFixture(FixtureGraph fixture)
 {
     _fixtureTag = new FixtureTag(fixture);
     _top.Child(_fixtureTag);
 }
Beispiel #24
0
 void ITestStream.StartSection(Section section, FixtureGraph fixture)
 {
     ForFixture(section.FixtureName).Mark(_currentTest);
     _fixtureStack.Push(fixture);
 }
        public void SetUp()
        {
            sentence = new Sentence
            {
                Name = "Something"
            };

            var fixture = new FixtureGraph("Math");
            fixture.Policies.Tag(sentence.Name, "abc");
            fixture.Policies.Tag(sentence.Name, "def");
            fixture.Policies.Tag(Guid.NewGuid().ToString(), "tuv");

            fixtureTag = new FixtureTag(fixture);
            grammarTag = fixtureTag.Add(sentence);
        }
 public void ConfigurePartAdders(OutlineNode node, FixtureGraph fixture, IPartHolder holder)
 {
     var selector = new OutlineGrammarSelector(node);
     var configurer = new GrammarSelectorConfigurer(holder, selector, _controller);
     configurer.Configure(fixture);
 }
Beispiel #27
0
 public FixtureUsage(FixtureGraph fixture)
 {
     _fixture = fixture;
 }
            public void Configure(FixtureGraph fixture)
            {
                _selector.Add(Icon.Comment, "Comment", () => _controller.AddComment(_holder), Key.C.ToGesture());

                fixture.Grammars.Each(g => g.AcceptVisitor(this, new Step()));
            }
 private void writeGrammarErrorsFromFixture(HtmlDocument document, FixtureGraph fixture)
 {
     document.Add("h3").Text("Fixture:  " + fixture.FixtureClassName);
     document.Add("ul").Modify(ul => fixture.Grammars.Each(g => writeGrammarErrors(ul, g)));
 }
Beispiel #30
0
 public bool Equals(FixtureGraph obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     return Equals(obj._name, _name);
 }
        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);
            });
        }