Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }