Ejemplo n.º 1
0
        public void CopyTo_Flattens()
        {
            // Arrange
            var buffer = new ViewBuffer(new TestViewBufferScope(), "some-name", pageSize: 4);

            var nestedItems = new List <object>();
            var nested      = new HtmlContentBuilder(nestedItems);

            nested.AppendHtml("Hello");
            buffer.AppendHtml(nested);

            var destinationItems = new List <object>();
            var destination      = new HtmlContentBuilder(destinationItems);

            // Act
            buffer.CopyTo(destination);

            // Assert
            Assert.Same(nested, buffer.Pages[0].Buffer[0].Value);
            Assert.Equal("Hello", Assert.IsType <HtmlEncodedString>(nestedItems[0]).Value);
            Assert.Equal("Hello", Assert.IsType <HtmlEncodedString>(destinationItems[0]).Value);
        }