コード例 #1
0
        public void ContentHandlerObjectFromInTest()
        {
            var h       = new ContentHandler();
            var baseObj = h.ObjectFrom("<a><b>test</b></a>");
            // use the deprecated one at least once to ensure it works
            var subObj = h.CreateObjectFromPropertyOf("/a", baseObj);

            Assert.AreEqual("<b>test</b>", subObj.Serialize());
            subObj = h.ObjectFromPropertyOf("/q", baseObj);
            Assert.IsTrue(string.IsNullOrEmpty(subObj.Serialize()));
            var jsonObj    = h.ObjectFrom("{ \"a\": { \"b\":\"test\" }}");
            var subJsonObj = h.ObjectFromPropertyOf("a", jsonObj);

            Assert.AreEqual("{\"b\":\"test\"}", subJsonObj.Serialize());
        }