public void VisitExtension_ReducedExpressionIsVisited()
        {
            RelinqExpressionVisitor visitor = new TestThrowingConstantExpressionVisitor();
            var constantExpression          = Expression.Constant(0);
            var expression = new ReducibleExtensionExpression(constantExpression);

            var result = visitor.Visit(expression);

            Assert.That(result, Is.Not.SameAs(constantExpression));
            Assert.That(((ConstantExpression)result).Value, Is.EqualTo("ConstantExpression was visited"));
        }
        public void VisitExtension_NonReducibleExpression()
        {
            RelinqExpressionVisitor visitor = new TestThrowingConstantExpressionVisitor();

#if !NET_3_5
            var nonReducibleExpression = MockRepository.GenerateStub <Expression>();
#else
            var nonReducibleExpression = MockRepository.GenerateStub <ExtensionExpression> (typeof(int));
#endif
            nonReducibleExpression
            .Stub(stub => ExtensionExpressionTestHelper.CallAccept(stub, Arg <RelinqExpressionVisitor> .Is.Anything))
            .WhenCalled(mi => PrivateInvoke.InvokeNonPublicMethod(mi.Arguments[0], "VisitExtension", nonReducibleExpression))
            .Return(nonReducibleExpression);
            nonReducibleExpression.Stub(stub => stub.CanReduce).Return(false);
            nonReducibleExpression.Stub(stub => stub.ToString()).Return("Test");

            visitor.Visit(nonReducibleExpression);
        }