示例#1
0
        public void can_override_just_the_title()
        {
            var fixture = new MyParagraphsFixture();

            overrides <MyParagraphsFixture>(@"
# The target fixture

## MyParagraph
### A better title in the override
* Better A Title
");

            theSystemFixtures.Models[fixture.Key] = fixture.Compile(CellHandling.Basic());

            var paragraph = theCombinedFixtures.Models[fixture.Key].FindGrammar(nameof(MyParagraphsFixture.MyParagraph))
                            .ShouldBeOfType <Paragraph>();

            paragraph.title.ShouldBe("A better title in the override");
        }
示例#2
0
        public void can_skip_silents_just_fine()
        {
            var fixture = new MyParagraphsFixture();

            overrides <MyParagraphsFixture>(@"
# The target fixture

## HasSilents
### A better title in the override
* Better A Title
* Better B Title
");

            theSystemFixtures.Models[fixture.Key] = fixture.Compile(CellHandling.Basic());

            var paragraph = theCombinedFixtures.Models[fixture.Key].FindGrammar(nameof(MyParagraphsFixture.HasSilents))
                            .ShouldBeOfType <Paragraph>();

            paragraph.children.Select(x => x.TitleOrFormat())
            .ShouldHaveTheSameElementsAs("SILENT", "Better A Title", "SILENT", "Better B Title", "SILENT", "C", "SILENT");
        }
示例#3
0
        public void can_override_just_some_of_the_children()
        {
            var fixture = new MyParagraphsFixture();

            overrides <MyParagraphsFixture>(@"
# The target fixture

## MyParagraph
### A better title in the override
* Better A Title
* Better B Title
");

            theSystemFixtures.Models[fixture.Key] = fixture.Compile(CellHandling.Basic());

            var paragraph = theCombinedFixtures.Models[fixture.Key].FindGrammar(nameof(MyParagraphsFixture.MyParagraph))
                            .ShouldBeOfType <Paragraph>();

            paragraph.children[0].TitleOrFormat().ShouldBe("Better A Title");
            paragraph.children[1].TitleOrFormat().ShouldBe("Better B Title");

            // original title
            paragraph.children[2].TitleOrFormat().ShouldBe("C");
        }