예제 #1
0
        public void Parse_WithSubQuery_UsesNodeTypeRegistry()
        {
            var emptyNodeTypeRegistry = new MethodInfoBasedNodeTypeRegistry();

            emptyNodeTypeRegistry.Register(SelectExpressionNode.GetSupportedMethods(), typeof(SelectExpressionNode));
            var parser = new MethodCallExpressionParser(emptyNodeTypeRegistry);

            var expression = (MethodCallExpression)ExpressionHelper.MakeExpression <IQueryable <Cook>, IQueryable <int> > (
                q => q.Select(s => s.Assistants.Count()));

            var result = parser.Parse("t", _source, expression.Arguments.Skip(1), expression);

            Assert.That(result, Is.InstanceOf(typeof(SelectExpressionNode)));
            Assert.That(((SelectExpressionNode)result).Selector, Is.Not.TypeOf(typeof(SubQueryExpression)),
                        "The given nodeTypeRegistry does not know any query methods, so no SubQueryExpression is generated.");
        }
예제 #2
0
 private IExpressionNode ParseMethodCallExpression(MethodCallExpression methodCallExpression)
 {
     return(_parser.Parse("x", _source, methodCallExpression.Arguments.Skip(1), methodCallExpression));
 }