public void ExpressionOverridingAcceptMethod()
        {
            var visitorMock = MockRepository.GenerateMock <SpecificVisitor> ();

            var expression = new TestableExtensionExpressionWithSpecificVisitor(typeof(int));

            ExtensionExpressionTestHelper.CallAccept(expression, visitorMock);

            visitorMock.AssertWasCalled(mock => mock.VisitTestableExtensionExpression(expression));
        }
Пример #2
0
        public void Accept_CallsVisitExtension()
        {
            var visitorMock = _mockRepository.StrictMock <RelinqExpressionVisitor>();

            visitorMock
            .Expect(mock => PrivateInvoke.InvokeNonPublicMethod(visitorMock, "VisitExtension", _expression))
            .Return(_expression);
            visitorMock.Replay();

            ExtensionExpressionTestHelper.CallAccept(_expression, visitorMock);

            visitorMock.VerifyAllExpectations();
        }
Пример #3
0
        public void Accept_ReturnsResultOf_VisitExtension()
        {
            var visitorMock    = _mockRepository.StrictMock <RelinqExpressionVisitor> ();
            var expectedResult = Expression.Constant(0);

            visitorMock
            .Expect(mock => PrivateInvoke.InvokeNonPublicMethod(visitorMock, "VisitExtension", _expression))
            .Return(expectedResult);
            visitorMock.Replay();

            var result = ExtensionExpressionTestHelper.CallAccept(_expression, visitorMock);

            visitorMock.VerifyAllExpectations();
            Assert.That(result, Is.SameAs(expectedResult));
        }