Exemplo n.º 1
0
        public void Apply()
        {
            var result = _node.Apply(QueryModel, ClauseGenerationContext);

            Assert.That(result, Is.SameAs(QueryModel));

            var selectClause = QueryModel.SelectClause;

            Assert.That(selectClause.Selector, Is.EqualTo(_node.GetResolvedSelector(ClauseGenerationContext)));
        }
Exemplo n.º 2
0
        public void Apply_WrapsQueryModel_AndEnsuresResolveWorksCorrectly()
        {
            var newQueryModel = _nodeWithResultOperatorSource.Apply(_queryModelWithResultOperator, ClauseGenerationContext);

            Expression <Func <int, string> > selector = i => i.ToString();
            var selectCall           = (MethodCallExpression)ExpressionHelper.MakeExpression <IQueryable <int>, IQueryable <string> > (q => q.Select(selector));
            var selectExpressionNode = new SelectExpressionNode(new MethodCallExpressionParseInfo("y", _nodeWithResultOperatorSource, selectCall), selector);

            selectExpressionNode.Apply(newQueryModel, ClauseGenerationContext);

            var newSelector = (MethodCallExpression)newQueryModel.SelectClause.Selector;

            Assert.That(((QuerySourceReferenceExpression)newSelector.Object).ReferencedQuerySource, Is.SameAs(newQueryModel.MainFromClause));
        }