public override void VisitCellStart(CellProxy cell)
 {
     this.builder.AppendLine("<Cell>");
 }
 public override void VisitCellEnd(CellProxy cell)
 {
     this.builder.AppendLine("</Cell>");
 }
        public void AddsInnerTablesToCell_WhenStartVisitingFromOuterTable()
        {
            Table outerTable = CreateDocumentWithNestedTables();

            var outerCellProxy = new CellProxy();
            var firstInnerTableProxy = A.Fake<TableProxy>();
            var secondInnerTableProxy = A.Fake<TableProxy>();

            A.CallTo(() => this.proxyFactory.CreateCell()).ReturnsNextFromSequence(outerCellProxy);
            A.CallTo(() => this.proxyFactory.CreateTable()).ReturnsNextFromSequence(A.Fake<TableProxy>(), firstInnerTableProxy, secondInnerTableProxy);

            outerTable.Accept(this.testee);

            outerCellProxy.Children.Should().ContainInOrder(firstInnerTableProxy, secondInnerTableProxy);
        }
        public void AddsParagraphsToCell_WhenStartVisitingFromRow()
        {
            Row row = CreateDocumentWithTables(1, 1, 1).FirstSection.Body.Tables[0].FirstRow;
            var secondParagraph = new Paragraph(row.Document);
            row.FirstCell.AppendChild(secondParagraph);

            var cellProxy = new CellProxy();
            var firstParagraphProxy = new ParagraphProxy();
            var secondParagraphProxy = new ParagraphProxy();

            A.CallTo(() => this.proxyFactory.CreateCell()).Returns(cellProxy);
            A.CallTo(() => this.proxyFactory.CreateParagraph()).ReturnsNextFromSequence(firstParagraphProxy, secondParagraphProxy);

            row.Accept(this.testee);

            cellProxy.Children.Should().HaveCount(2)
                .And.ContainInOrder(firstParagraphProxy, secondParagraphProxy);
        }
 public CellProxyFacts()
 {
     this.testee = new CellProxy();
 }