Ejemplo n.º 1
0
        public void WorkerPool_Validate_Maximum_Size()
        {
            IList <IWorker> workers = new List <IWorker>();

            try
            {
                // Arrange
                int     workerCount   = 0;
                IWorker currentWorker = null;

                // Act
                while ((currentWorker = _testedPool.Peek()) != null)
                {
                    workerCount++;
                    workers.Add(currentWorker);
                }

                // Assert
                Assert.AreEqual(10, workerCount);
            }
            finally
            {
                foreach (var worker in workers)
                {
                    _testedPool.Return(worker, false);
                }
            }
        }