예제 #1
0
        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());
        }
예제 #2
0
        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());
        }
예제 #3
0
        public void XmlObjectCreatePlainTest()
        {
            var a = new XmlObject("<a>test</a>", "a", null);

            Assert.AreEqual("<a>test</a>", a.Serialize());
        }
예제 #4
0
        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());
        }