public void ShouldAddNamespaceDeclaration() { sut = new DynamicXmlBuilder(new Namespaces { { "c", "http://www.w3.org/1999/xhtml" } }); var doc = sut.NewDocument; var bodyWithNamespacePrefix = doc.Head.c_Body; var xml = doc.ToXml(); Assert.Equal(@"<Head xmlns:c=""http://www.w3.org/1999/xhtml""> <c:Body> </c:Body> </Head>", xml); }
public void ShouldAddNamespaceToAttributeToElement() { var sut = new DynamicXmlBuilder(new Namespaces {{"c", "http://www.w3.org"}}); var doc = sut.NewDocument; doc.Head.Body(new Attributes {{"c_name", "body"}, {"c_style", "top:456px"}}); var xml = doc.ToXml(); Assert.Equal(@"<Head xmlns:c=""http://www.w3.org""> <Body c:name=""body"" c:style=""top:456px""> </Body> </Head>", xml); }
protected BaseTestFixtureWithOutput(ITestOutputHelper testOutputHelper) { this.testOutputHelper = testOutputHelper; this.output = new StringBuilderOutput(); this.sut = new DynamicXmlBuilder(element => new VerboseElement(element, output)); }