Esempio n. 1
0
        public void Virtual_protected_method_called_from_ctor_is_not_called_during_partial_mock_construction()
        {
            string mockedResult = "mocked result";

            ConcreteProtectedMethodCalledFromCtor concreteProtectedMethodCalledFromCtor =
                MockRepository.Partial <ConcreteProtectedMethodCalledFromCtor>();

            concreteProtectedMethodCalledFromCtor.Expect(x => x.SimplyHereSoThereIsSomethingToMock())
            .Return(mockedResult);

            string result = concreteProtectedMethodCalledFromCtor.SimplyHereSoThereIsSomethingToMock();

            Assert.Equal(mockedResult, result);
            Assert.Equal(true, concreteProtectedMethodCalledFromCtor.WasAbstractMethodCalledFromCtor);

            concreteProtectedMethodCalledFromCtor.VerifyAllExpectations();
        }