Example #1
0
        public void StrictMockWithIndexedProp()
        {
            MockRepository       mocks = new MockRepository();
            IWithIndexedProperty index = (IWithIndexedProperty)mocks.StrictMock(typeof(IWithIndexedProperty));

            Expect.Call(index.get_Foo("Blah")).Return(5);
            index.set_Foo("Foo", 2);
            mocks.ReplayAll();

            Assert.Equal(5, index.get_Foo("Blah"));
            index.set_Foo("Foo", 2);

            mocks.VerifyAll();
        }
        public void StrictMockWithIndexedProp()
        {
            IWithIndexedProperty index = MockRepository.Mock <IWithIndexedProperty>();

            index.Expect(x => x.get_Foo("Blah"))
            .Return(5);

            index.Expect(x => x.set_Foo("Foo", 2));

            Assert.Equal(5, index.get_Foo("Blah"));
            index.set_Foo("Foo", 2);

            index.VerifyExpectations(true);
        }
        public void StrictMockWithIndexedProp()
        {
            IWithIndexedProperty index = MockRepository.Mock <IWithIndexedProperty>();

            index.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            index.Expect(x => x.get_Foo("Blah"))
            .Return(5);

            index.Expect(x => x.set_Foo("Foo", 2));

            Assert.Equal(5, index.get_Foo("Blah"));
            index.set_Foo("Foo", 2);

            index.VerifyExpectations(true);
        }