Ejemplo n.º 1
0
        public void GetQueryOperatorExpression_ArrayLength_NotRegistered()
        {
            var expressionTreeParser    = new ExpressionTreeParser(new MethodInfoBasedNodeTypeRegistry(), new NullExpressionTreeProcessor());
            var memberExpression        = (UnaryExpression)ExpressionHelper.MakeExpression(() => new int[0].Length);
            var queryOperatorExpression = expressionTreeParser.GetQueryOperatorExpression(memberExpression);

            Assert.That(queryOperatorExpression, Is.Null);
        }
Ejemplo n.º 2
0
        public void GetQueryOperatorExpression_MemberExpression_NotRegistered()
        {
            var expressionTreeParser    = new ExpressionTreeParser(new MethodInfoBasedNodeTypeRegistry(), new NullExpressionTreeProcessor());
            var memberExpression        = (MemberExpression)ExpressionHelper.MakeExpression(() => new List <int> ().Count);
            var queryOperatorExpression = expressionTreeParser.GetQueryOperatorExpression(memberExpression);

            Assert.That(queryOperatorExpression, Is.Null);
        }
Ejemplo n.º 3
0
        public void GetQueryOperatorExpression_MethodCallExpression()
        {
            var methodCallExpression    = (MethodCallExpression)ExpressionHelper.MakeExpression(() => ((IEnumerable <int>)_intSource).Select(i => i));
            var queryOperatorExpression = _expressionTreeParser.GetQueryOperatorExpression(methodCallExpression);

            Assert.That(queryOperatorExpression, Is.SameAs(methodCallExpression));
        }
Ejemplo n.º 4
0
        public override Expression Visit(Expression expression)
        {
            var potentialQueryOperatorExpression = _expressionTreeParser.GetQueryOperatorExpression(expression);

            if (potentialQueryOperatorExpression != null &&
                _nodeTypeProvider.IsRegistered(potentialQueryOperatorExpression.Method))
            {
                return(CreateSubQueryNode(potentialQueryOperatorExpression));
            }
            return(base.Visit(expression));
        }