public override void SetUp () { base.SetUp (); var selector = ExpressionHelper.CreateLambdaExpression<int, bool> (i => i > 5); _node = new OrderByExpressionNode (CreateParseInfo (), selector); }
public void GetResolvedSelector () { var selector = ExpressionHelper.CreateLambdaExpression<int, bool> (i => i > 5); var node = new OrderByExpressionNode (CreateParseInfo (), selector); var expectedResult = Expression.MakeBinary (ExpressionType.GreaterThan, SourceReference, Expression.Constant (5)); var result = node.GetResolvedKeySelector (ClauseGenerationContext); ExpressionTreeComparer.CheckAreEqualTrees (expectedResult, result); }
public void Resolve_PassesExpressionToSource () { var sourceMock = MockRepository.GenerateMock<IExpressionNode> (); var selector = ExpressionHelper.CreateLambdaExpression<int, int> (i => i); var node = new OrderByExpressionNode (CreateParseInfo (sourceMock), selector); var expression = ExpressionHelper.CreateLambdaExpression (); var parameter = ExpressionHelper.CreateParameterExpression (); var expectedResult = ExpressionHelper.CreateExpression (); sourceMock.Expect (mock => mock.Resolve (parameter, expression, ClauseGenerationContext)).Return (expectedResult); var result = node.Resolve (parameter, expression, ClauseGenerationContext); sourceMock.VerifyAllExpectations (); Assert.That (result, Is.SameAs (expectedResult)); }