Esempio n. 1
0
        public void MockTwoDelegatesWithTheSameName()
        {
            ObjectDelegateWithNoParams d1 = MockRepository.Mock <ObjectDelegateWithNoParams>();

            Tests.ObjectDelegateWithNoParams d2 = MockRepository.Mock <Tests.ObjectDelegateWithNoParams>();

            d1.Expect(x => x())
            .Return(1);

            d2.Expect(x => x())
            .Return(2);

            Assert.Equal(1, d1());
            Assert.Equal(2, d2());

            d1.VerifyAllExpectations();
            d2.VerifyAllExpectations();
        }
Esempio n. 2
0
        public void MockTwoDelegatesWithTheSameName()
        {
            ObjectDelegateWithNoParams d1 = MockRepository.Mock <ObjectDelegateWithNoParams>();

            d1.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            Tests.ObjectDelegateWithNoParams d2 = MockRepository.Mock <Tests.ObjectDelegateWithNoParams>();
            d2.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            d1.Expect(x => x())
            .Return(1);

            d2.Expect(x => x())
            .Return(2);

            Assert.Equal(1, d1());
            Assert.Equal(2, d2());

            d1.VerifyAllExpectations();
            d2.VerifyAllExpectations();
        }