System.Collections.Tests.Queue_SynchronizedTests.PerformTest C# (CSharp) Метод

PerformTest() приватный Метод

private PerformTest ( Action action, int expected ) : void
action Action
expected int
Результат void
        private void PerformTest(Action action, int expected)
        {
            var tasks = new Task[_threadsToUse];

            for (int i = 0; i < _threadsToUse; i++)
            {
                tasks[i] = Task.Factory.StartNew(action, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);
            }

            _threadCount = _threadsToUse;
            Task.WaitAll(tasks);

            Assert.Equal(expected, _queue.Count);
        }