Ejemplo 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"));
        }
Ejemplo 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));
        }
Ejemplo n.º 3
0
        public void XmlObjectGetPropertyForUnknownElementTest()
        {
            var a = new XmlObject("<root/>", "q", null);

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