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);
}