public void GetsTheWorkerAsExpected() { cache.Setup(o => o.Get()).Returns(worker.Object); using var target = new WorkerPool(cache.Object, cacheMonitor.Object); var result = target.Get(OnRun, OnCompleted); Assert.IsNotNull(result); Assert.IsInstanceOf <PooledWorker>(result); }
public void DoesNotThrowAnExceptionWhenThePostCompletedCallbackIsNull() { using var target = new WorkerPool(cache.Object, cacheMonitor.Object); Assert.DoesNotThrow(() => target.Get(OnRun, null)); }
public void ThrowsAnExceptionWhenTheOnRunCallbackIsNull() { using var target = new WorkerPool(cache.Object, cacheMonitor.Object); Assert.Throws <ArgumentNullException>(() => target.Get(null, OnCompleted)); }
public void CreatesThePoolAsExpected() { using var target = WorkerPool.Create(); Assert.IsNotNull(target); }