예제 #1
0
        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);
        }
예제 #2
0
 public void DoesNotThrowAnExceptionWhenThePostCompletedCallbackIsNull()
 {
     using var target = new WorkerPool(cache.Object, cacheMonitor.Object);
     Assert.DoesNotThrow(() => target.Get(OnRun, null));
 }
예제 #3
0
 public void ThrowsAnExceptionWhenTheOnRunCallbackIsNull()
 {
     using var target = new WorkerPool(cache.Object, cacheMonitor.Object);
     Assert.Throws <ArgumentNullException>(() => target.Get(null, OnCompleted));
 }