예제 #1
0
        public void RelativeIsEmpty()
        {
            var root     = "//*[@id='aaa1']";
            var relative = "";

            Assert.AreEqual("//*[@id='aaa1']", XPathBuilder.Concat(root, relative));
        }
예제 #2
0
        public void MakeRelative()
        {
            var root     = "//*[@id='aaa1']";
            var relative = "//*[@id='bbb']";

            Assert.AreEqual("//*[@id='aaa1']/descendant::*[@id='bbb']", XPathBuilder.Concat(root, relative));
        }
예제 #3
0
        public void LeaveAxis()
        {
            var root     = "//div";
            var relative = "self::*[@id='myid']";

            Assert.AreEqual("//div/self::*[@id='myid']", XPathBuilder.Concat(root, relative));
        }
예제 #4
0
        public void ConcatAsDescendant()
        {
            var root     = "//div";
            var relative = "*[@id='myid']";

            Assert.AreEqual("//div/descendant::*[@id='myid']", XPathBuilder.Concat(root, relative));
        }
예제 #5
0
        public void MultipleRootXpath()
        {
            var root     = "//*[@id='aaa1'] | //*[@id='aaa2']";
            var relative = "*[@id='bbb']";

            Assert.AreEqual(
                "//*[@id='aaa1']/descendant::*[@id='bbb']|//*[@id='aaa2']/descendant::*[@id='bbb']",
                XPathBuilder.Concat(root, relative, "myid"));
        }
예제 #6
0
        public void InsertArgsToRelative()
        {
            var root     = "//div";
            var relative = "*[@id='{0}']";

            Assert.AreEqual("//div/descendant::*[@id='myid']", XPathBuilder.Concat(root, relative, "myid"));

            root     = "//div[@id='{0}']";
            relative = "*[@id='{0}']";
            Assert.AreEqual("//div[@id='{0}']/descendant::*[@id='myid']", XPathBuilder.Concat(root, relative, "myid"));
        }
예제 #7
0
        public void RootIsEmpty(string root)
        {
            var relative = "div";

            Assert.AreEqual("//div", XPathBuilder.Concat(root, relative));
        }
예제 #8
0
 public void IsXpath(string xpath, bool isXpath)
 {
     Assert.AreEqual(isXpath, XPathBuilder.IsXPath(xpath));
 }