/// <summary> /// Gets the maximum number of threads to use when running tests in parallel. If set to 0 (or not set), /// the value of <see cref="Environment.ProcessorCount"/> is used; if set to a value less /// than 0, does not limit the number of threads. /// </summary> public static int MaxParallelThreadsOrDefault(this ITestFrameworkExecutionOptions executionOptions) { var result = executionOptions.MaxParallelThreads(); if (result == null || result == 0) { return(Environment.ProcessorCount); } return(result.GetValueOrDefault()); }
/// <summary> /// Gets the maximum number of threads to use when running tests in parallel. If set to 0, does not /// limit the number of threads. If the value is not set, returns the default value /// (<see cref="Environment.ProcessorCount"/>). /// </summary> public static int MaxParallelThreadsOrDefault(this ITestFrameworkExecutionOptions executionOptions) { return(executionOptions.MaxParallelThreads() ?? Environment.ProcessorCount); }