Inheritance: IFixtureNode, IFixtureGraph
Exemplo n.º 1
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);
        }
        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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 6
0
 public EmbeddedSection(FixtureGraph fixture, string label, string childStepName)
 {
     Name = label;
     _fixture = fixture;
     _label = label;
     if (_label.IsEmpty()) _label = fixture.Name;
     _leafName = childStepName;
 }
Exemplo n.º 7
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");
        }
Exemplo n.º 8
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");
        }
Exemplo n.º 9
0
        public void SetUp()
        {
            FixtureLibrary library =
                FixtureLibrary.For(x => x.AddFixturesFromAssemblyContaining<EmbeddedChoicesFixture>());

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

            Child<CommentTag>();

            fixture.TopLevelGrammars().Each(writeGrammar);
        }
Exemplo n.º 11
0
 public EmbeddedSection(FixtureGraph fixture, string label, string leafName)
 {
     Name     = label;
     _fixture = fixture;
     _label   = label;
     if (_label.IsEmpty())
     {
         _label = fixture.Name;
     }
     _leafName = leafName;
 }
Exemplo n.º 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");
        }
Exemplo n.º 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);
        }
Exemplo n.º 15
0
 public bool Equals(FixtureGraph obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(Equals(obj._name, _name));
 }
Exemplo n.º 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();
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 22
0
 public void SetUp()
 {
     fixture = new FixtureGraph("Math");
 }
Exemplo n.º 23
0
 private void writeFixture(FixtureGraph fixture)
 {
     _fixtureTag = new FixtureTag(fixture);
     _top.Child(_fixtureTag);
 }
Exemplo n.º 24
0
 void ITestStream.StartSection(Section section, FixtureGraph fixture)
 {
     ForFixture(section.FixtureName).Mark(_currentTest);
     _fixtureStack.Push(fixture);
 }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
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);
 }
Exemplo n.º 27
0
 public FixtureUsage(FixtureGraph fixture)
 {
     _fixture = fixture;
 }
Exemplo n.º 28
0
            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)));
 }
Exemplo n.º 30
0
 public bool Equals(FixtureGraph obj)
 {
     if (ReferenceEquals(null, obj)) return false;
     if (ReferenceEquals(this, obj)) return true;
     return Equals(obj._name, _name);
 }
Exemplo n.º 31
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);
            });
        }