Exemplo n.º 1
0
        public void QueryableRewriter_RemoveAsQueryable()
        {
            TestDatabase db                 = new TestDatabase();
            Expression   expression         = CreateExpression(() => db.Groups.SelectAll().AsQueryable().Where(t => t.Id > 2).Select(t => t.Name));
            Expression   expectedExpression = CreateExpression(() => db.Groups.SelectAll().Where(t => t.Id > 2).Select(t => t.Name));

            IExpressionRewriter rewriter = new QueryableRewriter();

            expression = rewriter.Rewrite(expression);

            Assert.AreEqual(expectedExpression.ToString(), expression.ToString());
        }
Exemplo n.º 2
0
        public void QueryableRewriter_ContainsNonGenericMethod()
        {
            TestDatabase db         = new TestDatabase();
            Expression   expression = CreateExpression(
                () => db.Groups.Select(g => string.Concat("Name: ", g.Name)));

            Expression expectedExpression = expression;

            IExpressionRewriter rewriter = new QueryableRewriter();

            expression = rewriter.Rewrite(expression);

            Assert.AreEqual(expectedExpression.ToString(), expression.ToString());
        }