public void QueueWorkItemShouldAddANewWorkerThreadWhenMaxThreadCountIsNotReached()
        {
            ManualFinishWorkItemQueueStub workItemQueue = new ManualFinishWorkItemQueueStub();

            workItemQueue.Enqueue(new ManualFinishWorkItem());

            WorkerThreadPool workerThreadPool = new WorkerThreadPool(workItemQueue, 0, 2);

            Assert.AreEqual(1, workerThreadPool.WorkerThreadsCount);

            workItemQueue.WaitAllStart(500);

            Assert.AreEqual(1, workerThreadPool.WorkerThreadsCount);

            ManualFinishWorkItem newWorkItem = new ManualFinishWorkItem();

            workerThreadPool.QueueWorkItem(newWorkItem);
            newWorkItem.WaitStart(500);

            Assert.AreEqual(2, workerThreadPool.WorkerThreadsCount);
            Assert.AreEqual(2, workerThreadPool.WorkerThreads.Count(x => x.IsBusy));

            workItemQueue.StopAll();

            workerThreadPool.Shutdown(true, 500);
        }
        public void QueueWorkItemShouldAddANewWorkerThreadWhenMaxThreadCountIsNotReached()
        {
            ManualFinishWorkItemQueueStub workItemQueue = new ManualFinishWorkItemQueueStub();
            workItemQueue.Enqueue(new ManualFinishWorkItem());

            WorkerThreadPool workerThreadPool = new WorkerThreadPool(workItemQueue, 0, 2);

            Assert.AreEqual(1, workerThreadPool.WorkerThreadsCount);

            workItemQueue.WaitAllStart(500);

            Assert.AreEqual(1, workerThreadPool.WorkerThreadsCount);

            ManualFinishWorkItem newWorkItem = new ManualFinishWorkItem();
            workerThreadPool.QueueWorkItem(newWorkItem);
            newWorkItem.WaitStart(500);

            Assert.AreEqual(2, workerThreadPool.WorkerThreadsCount);
            Assert.AreEqual(2, workerThreadPool.WorkerThreads.Count(x => x.IsBusy));

            workItemQueue.StopAll();

            workerThreadPool.Shutdown(true, 500);
        }