public void Process() { var expression = Expression.Add(Expression.Constant(1), Expression.Constant(1)); var processor = new PartialEvaluatingExpressionTreeProcessor(); var result = processor.Process(expression); Assert.That(result, Is.TypeOf(typeof(ConstantExpression))); Assert.That(((ConstantExpression)result).Value, Is.EqualTo(2)); }
public void Process_WithFilter_PassesIntoVisitor() { var expression = Expression.Constant(1); var filterMock = MockRepository.GenerateStrictMock <IEvaluatableExpressionFilter>(); filterMock.Expect(_ => _.IsEvaluatableConstant(expression)).Return(true); filterMock.Replay(); var processor = new PartialEvaluatingExpressionTreeProcessor(filterMock); var result = processor.Process(expression); Assert.That(result, Is.SameAs(expression)); filterMock.VerifyAllExpectations(); }