public static void CheckAccept(ICodeGenerationExpression expression, Function <ICodeGenerationExpressionVisitor, Expression> expectation) { var visitorMock = MockRepository.GenerateMock <ICodeGenerationExpressionVisitor>(); var visitorResult = ExpressionTreeObjectMother.GetSomeExpression(); visitorMock.Expect(expectation).Return(visitorResult); var result = expression.Accept(visitorMock); visitorMock.VerifyAllExpectations(); Assert.That(result, Is.SameAs(visitorResult)); }
public static void CheckAccept( ICodeGenerationExpression expression, System.Linq.Expressions.Expression <Func <ICodeGenerationExpressionVisitor, Expression> > expectation) { var visitorMock = new Mock <ICodeGenerationExpressionVisitor>(); var visitorResult = ExpressionTreeObjectMother.GetSomeExpression(); visitorMock.Setup(expectation).Returns(visitorResult).Verifiable(); var result = expression.Accept(visitorMock.Object); visitorMock.Verify(); Assert.That(result, Is.SameAs(visitorResult)); }