Пример #1
0
        void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step)
        {
            var sectionTag = new EmbeddedSectionTag(section, step);

            sectionTag.WriteResults(_context);
            _document.Push(sectionTag);
        }
Пример #2
0
        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]");
        }
Пример #3
0
        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));
        }
Пример #4
0
 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);
     });
 }
Пример #5
0
        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));
        }
Пример #6
0
        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));
            }
        }
Пример #7
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);
        }
        private IReaderMode buildEmbed(string line)
        {
            _hasAdded = true;

            var first    = line.IndexOf(" ");
            var otherKey = line.Substring(first + 1);

            var embed = new EmbeddedSection
            {
                key     = _key,
                title   = _title,
                fixture = new FixtureModel(otherKey)
            };


            _adder(embed);

            return(null);
        }
        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);
        }
Пример #10
0
        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);
        }
Пример #11
0
 void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step)
 {
     add(section.Name, section.Label, Icon.EmbeddedSection);
 }
Пример #12
0
 private static void writeEmbed(EmbeddedSection grammar, TextWriter writer)
 {
     writer.WriteLine($"embeds {grammar.fixture.key}");
 }
Пример #13
0
 void ITestStream.EndEmbeddedSection(EmbeddedSection section, IStep step)
 {
     _fixtureStack.Pop();
 }
Пример #14
0
 void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step)
 {
     markGrammar(section.Name);
     ForFixture(section.Fixture.Name).Mark(_currentTest);
     _fixtureStack.Push(section.Fixture);
 }
Пример #15
0
 void IGrammarVisitor.EmbeddedSection(EmbeddedSection section, IStep step)
 {
     _link.Label(section.Label);
 }
 private static void writeEmbed(EmbeddedSection grammar, TextWriter writer)
 {
     writer.WriteLine($"embeds {grammar.fixture.key}");
 }
Пример #17
0
 public void EndEmbeddedSection(EmbeddedSection section, IStep step)
 {
     _nodes.Pop();
 }
Пример #18
0
 void ITestStream.EndEmbeddedSection(EmbeddedSection section, IStep step)
 {
     _document.Pop();
 }
Пример #19
0
        private IReaderMode buildEmbed(string line)
        {
            _hasAdded = true;

            var first = line.IndexOf(" ");
            var otherKey = line.Substring(first + 1);

            var embed = new EmbeddedSection
            {
                key = _key,
                title = _title,
                fixture = new FixtureModel(otherKey)
            };


            _adder(embed);

            return null;
        }
Пример #20
0
 void ITestStream.StartEmbeddedSection(EmbeddedSection section, IStep step)
 {
     _document.Push(new EmbeddedSectionTag(section, step));
 }