public void Letting_Assert_String()
        {
            XmlDocument doc = new XmlDocument();
             doc.LoadXml("<foo>bar</foo>");
             XPathNavigator nav = doc.DocumentElement.CreateNavigator();

             XPathQueryLanguage query = new XPathQueryLanguage();
             object context = query.CreateMatchContext(null, doc);
             query.Let(context, "x", "'bar'");
             Assertion assert = new Assertion();
             assert.Test = ". = $x";
             Assert.IsTrue(query.Assert(assert, context, nav));

             context = query.CreateMatchContext(null, doc);
             query.Let(context, "x", "'foo'");
             Assert.IsFalse(query.Assert(assert, context, nav));
        }
        public void Letting_Match()
        {
            XmlDocument doc = new XmlDocument();
             doc.LoadXml("<foo/>");
             XPathNavigator nav = doc.DocumentElement.CreateNavigator();

             XPathQueryLanguage query = new XPathQueryLanguage();
             Rule rule = new Rule();
             rule.Context = " $ename ";

             object context = query.CreateMatchContext(null, doc);
             query.Let(context, "ename", "foo");
             Assert.IsTrue(query.Match(rule, context, nav));

             context = query.CreateMatchContext(null, doc);
             query.Let(context, "ename", "bar");
             Assert.IsFalse(query.Match(rule, context, nav));
        }
        public void MultipleLets()
        {
            XmlDocument doc = new XmlDocument();
             doc.LoadXml("<foo><a/><a/><a/></foo>");
             XPathNavigator nav = doc.DocumentElement.CreateNavigator();

             XPathQueryLanguage query = new XPathQueryLanguage();
             object context = query.CreateMatchContext(null, doc);
             query.Let(context, "x", "3");
             query.Let(context, "x", "2");
        }