public void NotCallingExpectedMethodWillCauseVerificationError() { AppDomain appDomain = MockRepository.Mock <AppDomain>(); appDomain.Expect(x => x.BaseDirectory) .Return("/home/user/ayende"); Assert.Throws <ExpectationViolationException>( () => appDomain.VerifyAllExpectations()); }
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(); }
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(); }