Пример #1
0
        public void MockVoidDelegateWithNoParams()
        {
            VoidDelegateWithParams d = MockRepository.Mock <VoidDelegateWithParams>();

            d.Expect(x => x("abc"));
            d.Expect(x => x("efg"));

            d("abc");
            d("efg");
            d("hij");

            Assert.Throws <ExpectationViolationException>(
                () => d.VerifyExpectations(true));
        }
Пример #2
0
        public void MockVoidDelegateWithNoParams()
        {
            VoidDelegateWithParams d = MockRepository.Mock <VoidDelegateWithParams>();

            d.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            d.Expect(x => x("abc"));
            d.Expect(x => x("efg"));

            d("abc");
            d("efg");
            d("hij");

            Assert.Throws <ExpectationViolationException>(
                () => d.VerifyExpectations(true));
        }
Пример #3
0
        public void MockVoidDelegateWithNoParams()
        {
            VoidDelegateWithParams d = (VoidDelegateWithParams)mocks.StrictMock(typeof(VoidDelegateWithParams));

            d("abc");
            d("efg");

            mocks.Replay(d);

            d("abc");
            d("efg");

            try
            {
                d("hij");
                Assert.False(true, "Expected an expectation violation to occur.");
            }
            catch (ExpectationViolationException)
            {
                // Expected.
            }
        }