public bool Equals(EmbeddedSection obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return Equals(obj._fixture, _fixture) && Equals(obj._label, _label) && Equals(obj._leafName, _leafName); }
public override GrammarModel ApplyOverrides(GrammarModel grammar) { var @override = grammar as EmbeddedSection; if (@override == null) { return(this); } var section = new EmbeddedSection { key = key, title = title, collection = collection, fixture = (FixtureModel)fixture.ApplyOverrides(@override.fixture), hasBeforeStep = hasBeforeStep, hasAfterStep = hasAfterStep }; if (@override.title.IsNotEmpty()) { section.title = @override.title; } return(section); }
public void SetUp() { FixtureLibrary library = FixtureGraph.Library; FixtureStructure fixture = library.FixtureFor("Math"); embeddedSection = new EmbeddedSectionGrammar<MathFixture>().ToStructure(library).ShouldBeOfType<EmbeddedSection>(); embeddedSection.Name = "MathGrammar"; theExample = embeddedSection.CreateExample(); }
void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step) { _fixtureStack.Push(section.Fixture); _stream.StartEmbeddedSection(section, step); section.GetLeaf(step).AcceptVisitor(this); _stream.EndEmbeddedSection(section, step); _fixtureStack.Pop(); }
public bool Equals(EmbeddedSection obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } return(Equals(obj._fixture, _fixture) && Equals(obj._label, _label) && Equals(obj._leafName, _leafName)); }
public EmbeddedSectionTag(EmbeddedSection section, IStep step) : base("div") { _section = section; _step = step; AddClass("embedded"); AddClass(section.Style.ToString()); if (section.Style == EmbedStyle.TitledAndIndented) { Add("div").AddClass(HtmlClasses.SECTION_TITLE).Text(section.Label); } }
public EmbeddedSectionTag(EmbeddedSection section, IStep step) : base("div") { _section = section; _step = step; AddClass("embedded"); AddClass(section.Style.ToString()); if (section.Style == EmbedStyle.TitledAndIndented) { Add("h3").AddClass("embedded-title").Text(section.Label).Title("{0} (Embeds {1})".ToFormat(section.Name, section.Fixture.FixtureClassName)); } }
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 override_title() { var section1 = new EmbeddedSection { key = "Something", title = "Do something", fixture = new FixtureModel("Something") }; var @override = new EmbeddedSection { key = "Something", title = "Do something different", fixture = new FixtureModel("Something") }; section1.ApplyOverrides(@override) .ShouldBeOfType<EmbeddedSection>() .title.ShouldBe(@override.title); }
void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step) { grammarTag.AddClasses(GrammarConstants.EMBEDDED, GrammarConstants.SECTION) .MetaData(GrammarConstants.LEAF_NAME, section.LeafName) .MetaData(GrammarConstants.FIXTURE, section.Fixture.Name) .MetaData(GrammarConstants.AUTO_SELECT_KEY, section.Fixture.Policies.AutoSelectGrammarKey) .MetaData(GrammarConstants.SELECTION_MODE, section.Fixture.Policies.SelectionMode.ToString()); var area = section.IsTitled() ? new AreaTag(section.Label) : new AreaTag(); var container = area.Container.Add("div").AddClass("section-container"); container.Append(new HolderTag(section.Fixture)); if (section.Fixture.Policies.SelectionMode != SelectionMode.MandatoryAutoSelect) { var selector = new GrammarSelector(section.Fixture).Build(); container.Append(selector); } grammarTag.Append(area); }
void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step) { grammarTag.AddClasses(GrammarConstants.EMBEDDED, GrammarConstants.SECTION) .MetaData(GrammarConstants.LEAF_NAME, section.LeafName) .MetaData(GrammarConstants.FIXTURE, section.Fixture.Name) .MetaData(GrammarConstants.AUTO_SELECT_KEY, section.Fixture.Policies.AutoSelectGrammarKey) .MetaData(GrammarConstants.SELECTION_MODE, section.Fixture.Policies.SelectionMode.ToString()); var header = new HeaderTag(); if (section.IsTitled()) { header.Titled(section.Title); } grammarTag.Child(header); grammarTag.Child(new HolderTag(section.Fixture)); if (section.Fixture.Policies.SelectionMode == SelectionMode.MandatoryAutoSelect) return; HtmlTag selector = new GrammarSelector(section.Fixture).Build(); grammarTag.Child(selector); }
public override GrammarModel ApplyOverrides(GrammarModel grammar) { var @override = grammar as EmbeddedSection; if (@override == null) return this; var section = new EmbeddedSection { key = key, title = title, collection = collection, fixture = (FixtureModel) fixture.ApplyOverrides(@override.fixture), hasBeforeStep = hasBeforeStep, hasAfterStep = hasAfterStep }; if (@override.title.IsNotEmpty()) { section.title = @override.title; } return section; }
void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step) { _link.Label(section.Label); }
void ITestStream.EndEmbeddedSection(EmbeddedSection section, IStep step) { _document.Pop(); }
public void with_embed_child() { var embed = new EmbeddedSection { fixture = new FixtureModel("Something"), title = "Do a bunch of things" }; embed.ToMissingCode(true).ShouldContain("[StoryTeller.Hidden]"); }
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; }
void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step) { var sectionTag = new EmbeddedSectionTag(section, step); sectionTag.WriteResults(_context); _document.Push(sectionTag); }
public void EndEmbeddedSection(EmbeddedSection section, IStep step) { _nodes.Pop(); }
void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step) { markGrammar(section.Name); ForFixture(section.Fixture.Name).Mark(_currentTest); _fixtureStack.Push(section.Fixture); }
void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step) { add(section.Name, section.Label, Icon.EmbeddedSection); }
void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step) { _document.Push(new EmbeddedSectionTag(section, step)); }
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() { 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); }
public void adding_an_embedded_section_then_a_sentence_under_a_paragraph_should_still_have_adder_commands() { var embedded = new EmbeddedSection(new FixtureGraph("Embed"), "the label", "embed"); treeBuilder.StartEmbeddedSection(embedded, step); var sentence = new Sentence(); var sentenceStep = new Step(); treeBuilder.Sentence(sentence, sentenceStep); nodeBuilder.AssertWasCalled(x => x.ConfigureRearrangeCommands(treeBuilder.LastNode, embedded.LeafFor(step), sentenceStep)); }
public void should_call_the_embedded_section_method() { var visitor = MockRepository.GenerateMock<IGrammarVisitor>(); var step = new Step(); var section = new EmbeddedSection(); section.AcceptVisitor(visitor, step); visitor.AssertWasCalled(x => x.EmbeddedSection(section, step)); }
void ITestStream.EndEmbeddedSection(EmbeddedSection section, IStep step) { _fixtureStack.Pop(); }
public void StartEmbeddedSection(EmbeddedSection section, IStep step) { withNewNode(step, Icon.EmbeddedSection, node => { node.AddText(section.Label); addRearrangeCommands(node); StepLeaf leaf = section.LeafFor(step); node.Holder = leaf; _configurer.ConfigurePartAdders(node, section.Fixture, leaf); }); }