Exemplo n.º 1
0
        public void NotCallingExpectedMethodWillCauseVerificationError()
        {
            AppDomain appDomain = MockRepository.Mock <AppDomain>();

            appDomain.Expect(x => x.BaseDirectory)
            .Return("/home/user/ayende");

            Assert.Throws <ExpectationViolationException>(
                () => appDomain.VerifyAllExpectations());
        }
Exemplo n.º 2
0
        public void CanMockAppDomain()
        {
            AppDomain appDomain = MockRepository.Mock <AppDomain>();

            appDomain.Expect(x => x.BaseDirectory)
            .Return("/home/user/ayende");

            Assert.Equal(appDomain.BaseDirectory, "/home/user/ayende");
            appDomain.VerifyAllExpectations();
        }
Exemplo n.º 3
0
        public void CanMockAppDomain()
        {
            AppDomain appDomain = MockRepository.Mock <AppDomain>();

            appDomain.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            appDomain.Expect(x => x.BaseDirectory)
            .Return("/home/user/ayende");

            Assert.Equal(appDomain.BaseDirectory, "/home/user/ayende");
            appDomain.VerifyAllExpectations();
        }