示例#1
0
        public void MockObjCanHandleGetEventSubscribersCallsWithoutEventsRegistered()
        {
            WithParameters withParameters = MockRepository.GenerateStrictMock <WithParameters>(1);
            IMockedObject  mocked         = (IMockedObject)withParameters;

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

            Assert.Null(eventSubscribers);
        }
示例#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();
        }
示例#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();
        }
示例#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();
        }
示例#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();
        }
示例#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();
        }