public void ConstructorShouldSetWorkerThreadPoolIdThreadSafely()
        {
            const int count = 1000;

            WorkerThreadPool[] pools = new WorkerThreadPool[count];

            ParallelLoopResult parallelLoopResult = Parallel.For(0, count, x => pools[x] = new WorkerThreadPool(0, 1));

            Wait.While(() => !parallelLoopResult.IsCompleted, 500);

            Assert.AreEqual(count, pools.Select(x => x.WorkerThreadPoolId).Distinct().Count());
            Assert.AreEqual(count * (count + 1) / 2, pools.Sum(x => x.WorkerThreadPoolId));

            pools.ForEach(x => x.Shutdown(true, 500));
        }
        public void ConstructorShouldSetWorkerThreadPoolIdThreadSafely()
        {
            const int count = 1000;
            WorkerThreadPool[] pools = new WorkerThreadPool[count];

            ParallelLoopResult parallelLoopResult = Parallel.For(0, count, x => pools[x] = new WorkerThreadPool(0, 1));
            Wait.While(() => !parallelLoopResult.IsCompleted, 500);

            Assert.AreEqual(count, pools.Select(x => x.WorkerThreadPoolId).Distinct().Count());
            Assert.AreEqual(count * (count + 1) / 2, pools.Sum(x => x.WorkerThreadPoolId));

            pools.ForEach(x => x.Shutdown(true, 500));
        }