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);
        }
        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);
        }
 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>");
     }
 }
 public override void VisitSectionEnd(SectionProxy section)
 {
     this.builder.AppendLine("</Section>");
 }
        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);
        }
 public SectionProxyFacts()
 {
     this.testee = new SectionProxy();
 }