public void TearDownMockRepository() { this.mockRepository.VerifyAll(); this.mockRepository = null; this.MockServiceLocator = null; this.kernel = null; }
public void TearDownMockRepository() { try { // Verify all calls were made this.MockServiceLocator.VerifyAll(); } finally { // Don't leak into the next test this.MockServiceLocator = null; } }
public void SetupMockRepository() { // MockBehavior.Strict says "I have to impliment every use" // DefaultValue.Mock means "recursive fakes" NinjectSettings settings = new NinjectSettings(); settings.SetMockBehavior( MockBehavior.Strict ); this.kernel = new MoqMockingKernel( settings ); this.mockRepository = this.kernel.MockRepository; this.mockRepository.DefaultValue = DefaultValue.Mock; this.MockServiceLocator = new MockServiceLocator( this.kernel ); }
public void SetupMockRepository() { // MockBehavior.Strict says "I have to impliment every use" // DefaultValue.Mock means "recursive fakes" MockBehavior mockBehavior = MockBehavior.Strict; DefaultValue defaultValue = DefaultValue.Mock; // Ninject, why you gotta make this so hard? NinjectSettings settings = new NinjectSettings(); settings.SetMockBehavior( mockBehavior ); MoqMockingKernel kernel = new MoqMockingKernel( settings ); kernel.MockRepository.DefaultValue = defaultValue; // Initialize the mock service locator this.MockServiceLocator = new MockServiceLocator( kernel, mockBehavior ); }