public void XmlObjectDeleteTest() { var a = new XmlObject("<root><c>test</c></root>", "a", null); Assert.IsFalse(a.Delete("/root/b"), "Delete nonexisting XPath fails"); Assert.AreEqual("<root><c>test</c></root>", a.Serialize()); Assert.IsTrue(a.Delete("/root/c"), "Delete existing XPath passes"); // TODO: find out why we don't get <root/> here. Assert.AreEqual("<root></root>", a.Serialize()); }
public void XmlObjectCreateFromJsonTest() { var a = new XmlObject("{ \"test\": 1 }", null, null); Assert.AreEqual("<test>1</test>", a.Serialize()); var b = new XmlObject("{ \"test\": 1, \"a\": \"b\" }", null, null); Assert.AreEqual("<root><test>1</test><a>b</a></root>", b.Serialize()); }
public void XmlObjectCreatePlainTest() { var a = new XmlObject("<a>test</a>", "a", null); Assert.AreEqual("<a>test</a>", a.Serialize()); }
public void XmlObjectCreateMultiRootTest() { var a = new XmlObject("<a>test</a><b>test</b>", "a", null); Assert.AreEqual("<root><a>test</a><b>test</b></root>", a.Serialize()); }