public void TestAddCommentBefore() { // Arrange var docElement = new ZptXmlElement(_document.DocumentElement, _sourceFile, Mock.Of<IZptDocument>()); var sut = docElement.GetChildElements()[1].GetChildElements()[0].GetChildElements().First(); string expectedResult = @"<html xmlns:custom=""http://ns.csf-dev.com/custom""> <head> <title>Document title</title> </head> <body> <header> <!--Foo bar baz--> <div custom:parent_attrib=""Attribute value one"" class=""class_one class_two""> <ul> <li custom:child_attrib=""foo"">Foo content</li> <li custom:child_attrib=""bar"">Bar content</li> <li custom:child_attrib=""baz"">Baz content</li> </ul> </div> Page header </header> <section> <header> <h1 id=""page_heading"">Page heading</h1> </header> <p>A paragraph of content</p> </section> <footer>Page footer</footer> </body> </html>"; // Act sut.AddCommentBefore("Foo bar baz"); // Assert Assert.AreEqual(expectedResult, docElement.ToString()); }
public void TestToString() { // Arrange var sut = new ZptXmlElement(_document.DocumentElement, _sourceFile, Mock.Of<IZptDocument>()); // Act var result = sut.ToString(); // Assert Assert.AreEqual(_xmlSource, result); }