コード例 #1
0
        public void AddsBodyToSection_WhenStartVisitingFromSection()
        {
            Section section = new Document().FirstSection;
            var sectionProxy = new SectionProxy();
            var bodyProxy = A.Fake<BodyProxy>();

            A.CallTo(() => this.proxyFactory.CreateSection()).Returns(sectionProxy);
            A.CallTo(() => this.proxyFactory.CreateBody()).Returns(bodyProxy);

            section.Accept(this.testee);

            sectionProxy.Body.Should().Be(bodyProxy);
        }
コード例 #2
0
        public void AddsBodyToSections_WhenStartVisitingFromDocument()
        {
            Document document = CreateDocumentWithTwoSections();

            var firstSectionProxy = new SectionProxy();
            var secondSectionProxy = new SectionProxy();
            var firstBodyProxy = A.Fake<BodyProxy>();
            var secondBodyProxy = A.Fake<BodyProxy>();

            A.CallTo(() => this.proxyFactory.CreateSection()).ReturnsNextFromSequence(firstSectionProxy, secondSectionProxy);
            A.CallTo(() => this.proxyFactory.CreateBody()).ReturnsNextFromSequence(firstBodyProxy, secondBodyProxy);

            document.Accept(this.testee);

            firstSectionProxy.Body.Should().Be(firstBodyProxy);
            secondSectionProxy.Body.Should().Be(secondBodyProxy);
        }
コード例 #3
0
 public override void VisitSectionStart(SectionProxy section)
 {
     if (this.displayOptions.IncludeFormatting)
     {
         this.builder
             .AppendFormat(
                 "<Section {0}>",
                 FormatAttributes(
                     new NamedValue("Orientation", section.Format.Orientation),
                     new NamedValue("PaperSize", section.Format.PaperSize)))
             .AppendLine();
     }
     else
     {
         this.builder.AppendLine("<Section>");
     }
 }
コード例 #4
0
 public override void VisitSectionEnd(SectionProxy section)
 {
     this.builder.AppendLine("</Section>");
 }
コード例 #5
0
        public void AddsHeadersToSection_WhenStartVisitingFromSection()
        {
            var builder = new DocumentBuilder();
            builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
            builder.MoveToHeaderFooter(HeaderFooterType.HeaderEven);

            Section section = builder.Document.FirstSection;

            var sectionProxy = new SectionProxy();
            var firstHeaderProxy = A.Fake<HeaderProxy>();
            var secondHeaderProxy = A.Fake<HeaderProxy>();

            A.CallTo(() => this.proxyFactory.CreateSection()).Returns(sectionProxy);
            A.CallTo(() => this.proxyFactory.CreateHeader("Primary")).Returns(firstHeaderProxy);
            A.CallTo(() => this.proxyFactory.CreateHeader("Even")).Returns(secondHeaderProxy);

            section.Accept(this.testee);

            sectionProxy.Headers.Should().Contain(firstHeaderProxy)
                .And.Contain(secondHeaderProxy);
        }
コード例 #6
0
 public SectionProxyFacts()
 {
     this.testee = new SectionProxy();
 }