Ejemplo n.º 1
0
        public void QuerySameArgumentTwice()
        {
            Expression<Func<MyContext, int, string, MyValue>> lambda =
                (context, id, value) => context.Values.Where(v => v.Id < id).First(val => val.Id >= id);

            var provider = new CqlQueryProvider();
            var plan = (QueryPlan<MyValue>)provider.CreateQueryPlan(lambda);

            Assert.AreEqual(2, plan.VariableMap.Count);
            Assert.AreEqual(plan.VariableMap[0], 0);
            Assert.AreEqual(plan.VariableMap[1], 0);
            Assert.AreEqual("SELECT \"id\",\"value\" FROM \"myvalue\" WHERE \"id\"<? AND \"id\">=? LIMIT 1;", plan.Cql);
        }
Ejemplo n.º 2
0
 public static void CheckCql(Expression query, string expectedCql)
 {
     var provider = new CqlQueryProvider();
     var plan = provider.CreateQueryPlan(query);
     Assert.AreEqual(expectedCql, plan.Cql);
 }