コード例 #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));
 }
コード例 #4
0
 public void CreatesThePoolAsExpected()
 {
     using var target = WorkerPool.Create();
     Assert.IsNotNull(target);
 }