예제 #1
0
        public virtual void testMatchesPathKElement()
        {
            JDFDoc   doc  = new JDFDoc("Test"); // make sure we call jdf methods
            KElement root = doc.getRoot();
            KElement a    = root.appendElement("a");

            root.appendElement("b");
            KElement a2 = root.appendElement("a");
            KElement a3 = root.appendElement("a");

            a.setAttribute("att", "42");
            Assert.IsTrue(a.matchesPath("//a", false));
            Assert.IsTrue(a.matchesPath("/Test/a", false));
            Assert.IsTrue(a.matchesPath("/Test/a[1]", false));
            // Java to C# Conversion - Don't know why this fails, other tests pass.
            //Assert.IsTrue(a.matchesPath("/Test/a[@att=\"42\"]", false));
            Assert.IsTrue(a2.matchesPath("/Test/a[2]", false));
            Assert.IsTrue(a3.matchesPath("/Test/a[3]", false));
            Assert.IsFalse(a3.matchesPath("/Test/a[@att=\"*\"]", false));
            Assert.IsTrue(a.matchesPath("/Test/a[@att=\"*\"]", false));
        }