Example #1
0
        public void LeaveAxis()
        {
            string root     = "//div";
            string relative = "self::*[@id='myid']";

            Assert.AreEqual("//div/self::*[@id='myid']", XPathBuilder.Concat(root, relative));
        }
Example #2
0
        public void RelativeIsEmpty()
        {
            string root     = "//*[@id='aaa1']";
            string relative = "";

            Assert.AreEqual("//*[@id='aaa1']", XPathBuilder.Concat(root, relative));
        }
Example #3
0
        public void ConcatAsDescendant()
        {
            string root     = "//div";
            string relative = "*[@id='myid']";

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

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

            Assert.AreEqual("//*[@id='aaa1']/descendant::*[@id='bbb']",
                            XPathBuilder.Concat(root, relative));
        }
Example #6
0
        public Scss Concat(Scss scss2)
        {
            string resultXpath = XPathBuilder.Concat(Xpath, scss2.Xpath);
            string resultCss   = string.IsNullOrEmpty(Css) || string.IsNullOrEmpty(scss2.Css)
                ? string.Empty
                : CssBuilder.Concat(Css, scss2.Css);

            return(new Scss(resultXpath, resultCss));
        }
Example #7
0
        public void InsertArgsToRelative()
        {
            string root     = "//div";
            string 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"));
        }
Example #8
0
        public void RootIsEmpty(string root)
        {
            string relative = "div";

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