public void WorksWithIXML() { var modifiedXml = new XMLPatched( new XMLCursor("<root><node><leaf name='test' /></node></root>"), new Directives() .Xpath("//root/node/leaf") .Attr("id", "123") .Add("content") .Set("testContent") ); Assert.NotEmpty( modifiedXml.Values("/root/node/leaf[@id='123']/content/text()") ); }
public void RejectsNoResults() { var doc = new XMLPatched( "<root/>", new Directives() .Xpath("/root") .Set("ugly_text") ); Assert.Throws <ArgumentException>(() => new XMLString( doc, "/wrong/text()" ).Value() ); }
public void ReturnsFallback() { var doc = new XMLPatched( "<root/>", new Directives() .Xpath("/root") .Set("ugly_text") ); Assert.Equal( "right text", new XMLString( doc, "/wrong/text()", "right text" ).Value() ); }
public void DeliversString() { var doc = new XMLPatched( "<root/>", new Directives() .Xpath("/root") .Set("ugly_text") ); Assert.Equal( "ugly_text", new XMLString( doc, "/root/text()", "Unable to access the text of root node" ).Value() ); }