public void TestDispose() { var o = MockRepository.GenerateMock <ObjectStub>(); o.Expect(m => m.Dispose()); itemStoreMock.Expect(m => m.Count).Return(1).Repeat.Once(); itemStoreMock.Expect(m => m.Fetch()).Return(o); itemStoreMock.Expect(m => m.Count).Return(0); manager.Dispose(); o.VerifyAllExpectations(); }
public void Dispose() { lock (manager) { if (IsDisposed) { return; } IsDisposed = true; manager.Dispose(); } poolSemaphore.Close(); }