public void GivenNoRegistrationThenTheTransformationShouldReturnOriginalExpression() { var query = new TestQueryableWrapper(); var provider = new QueryInterceptingProvider <IdType>(query); var target = provider.Execute(Expression.Constant(2)); Assert.IsType <ConstantExpression>(target); Assert.Equal(2, (target as ConstantExpression).Value); }
public void GivenExpressionWhenExecuteCalledThenShouldTransformExpressionAndCallSourceProvider() { var query = new TestQueryableWrapper(); var provider = new QueryInterceptingProvider <IdType>(query); provider.RegisterInterceptor(e => Expression.Constant(1)); var target = provider.Execute(Expression.Constant(2)); Assert.IsType <ConstantExpression>(target); Assert.Equal(1, (target as ConstantExpression).Value); }