public void ThrowsAnExceptionWhenAfterDispose() { var target = new TestableWorkerPool(cache.Object, cacheMonitor.Object); target.Dispose(); Assert.Throws <ObjectDisposedException>(() => target.Get(OnRun, OnCompleted)); }
public void ThrowsAnExceptionWhenTheWorkerIsNull() { cache.Setup(o => o.Get()).Returns(worker.Object); using var target = new TestableWorkerPool(cache.Object, cacheMonitor.Object) { OnBaseCreatePooledWorkerCallback = o => null }; Assert.Throws <ArgumentNullException>(() => target.Get(OnRun, OnCompleted)); cache.Verify(o => o.Release(worker.Object), Times.Once); }