Esempio n. 1
0
        public void XmlObjectSetPropertyTest()
        {
            var a = new XmlObject("<root id=''/>", "q", null);

            Assert.IsFalse(a.SetProperty("/any", "should not work"));
            Assert.IsTrue(a.SetProperty("/root/@id", "test"));
            Assert.AreEqual("test", a.GetProperty("/root/@id"));
        }
Esempio n. 2
0
        public void XmlObjectTrimTest()
        {
            const string source  = "<text>   aa   </text>";
            const string locator = "/text";
            var          noTrim  = new XmlObject(source, "q", null);

            Assert.AreEqual("   aa   ", noTrim.GetProperty(locator));
            Assert.AreEqual("   aa   ", noTrim.Evaluate(locator));
            var trim = new XmlObject(source, "q", null, true);

            Assert.AreEqual("aa", trim.GetProperty(locator));
            Assert.AreEqual("aa", trim.Evaluate(locator));
        }
Esempio n. 3
0
        public void XmlObjectGetPropertyForUnknownElementTest()
        {
            var a = new XmlObject("<root/>", "q", null);

            Assert.IsTrue(string.IsNullOrEmpty(a.GetProperty("/any")));
        }