Exemplo n.º 1
0
        public void MockObjCanHandleGetEventSubscribersCallsWithoutEventsRegistered()
        {
            WithParameters withParameters = MockRepository.GenerateStrictMock <WithParameters>(1);
            IMockedObject  mocked         = (IMockedObject)withParameters;

            Delegate eventSubscribers = mocked.GetEventSubscribers("ff");

            Assert.Null(eventSubscribers);
        }
Exemplo n.º 2
0
        public void CanMockWithCtorParams()
        {
            WithParameters withParameters = mocks.PartialMock <WithParameters>(1);

            Expect.Call(withParameters.Int).Return(4);
            mocks.ReplayAll();
            Assert.Equal(4, withParameters.Int);
            mocks.VerifyAll();
        }
Exemplo n.º 3
0
        public void CanMockWithCtorParams()
        {
            WithParameters withParameters = MockRepository.Partial <WithParameters>(1);

            withParameters.Expect(x => x.Int)
            .Return(4);

            Assert.Equal(4, withParameters.Int);
            withParameters.VerifyAllExpectations();
        }
Exemplo n.º 4
0
        public void CanMockWithCtorParams()
        {
            WithParameters withParameters = MockRepository.Partial <WithParameters>(1);

            withParameters.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            withParameters.Expect(x => x.Int)
            .Return(4);

            Assert.Equal(4, withParameters.Int);
            withParameters.VerifyAllExpectations();
        }
Exemplo n.º 5
0
        public void UsingCallOriginalWithSetter()
        {
            WithParameters withParameters = MockRepository.GenerateStrictMock <WithParameters>(1);

            withParameters.Expect(x => x.Int = 5)
            .PropertyBehavior();

            withParameters.Int = 12;
            withParameters.Int = 15;
            Assert.Equal(15, withParameters.Int);

            withParameters.VerifyAllExpectations();
        }
Exemplo n.º 6
0
        public void UsingCallOriginalWithSetter()
        {
            MockRepository mocks          = new MockRepository();
            WithParameters withParameters = mocks.StrictMock <WithParameters>(1);

            withParameters.Int = 5;
            LastCall.PropertyBehavior();
            mocks.ReplayAll();
            withParameters.Int = 12;
            withParameters.Int = 15;
            Assert.Equal(15, withParameters.Int);
            mocks.VerifyAll();
        }