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); }
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); }
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)); }
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)); }