public override void VisitDocumentStart(DocumentProxy document)
 {
     this.builder.AppendLine("<Document>");
 }
        public void AddsSectionsToDocument_WhenStartVisitingFromDocument()
        {
            Document document = CreateDocumentWithTwoSections();

            var documentProxy = new DocumentProxy();
            var firstSectionProxy = A.Fake<SectionProxy>();
            var secondSectionProxy = A.Fake<SectionProxy>();

            A.CallTo(() => this.proxyFactory.CreateDocument()).Returns(documentProxy);
            A.CallTo(() => this.proxyFactory.CreateSection()).ReturnsNextFromSequence(firstSectionProxy, secondSectionProxy);

            document.Accept(this.testee);

            documentProxy.Sections
                .Should().HaveCount(2)
                .And.ContainInOrder(firstSectionProxy, secondSectionProxy);
        }
        public void SetsDocumentAsRoot_WhenStartVisitingFromDocument()
        {
            var document = new Document();
            var documentProxy = new DocumentProxy();

            A.CallTo(() => this.proxyFactory.CreateDocument()).Returns(documentProxy);

            document.Accept(this.testee);

            this.testee.Root.Should().Be(documentProxy);
        }
 public DocumentProxyFacts()
 {
     this.testee = new DocumentProxy();
 }