Example #1
0
    /// <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 GetMaxParallelThreadsOrDefault(this ITestFrameworkExecutionOptions executionOptions)
    {
        var result = executionOptions.GetMaxParallelThreads();

        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 GetMaxParallelThreadsOrDefault(this ITestFrameworkExecutionOptions executionOptions)
 {
     return(executionOptions.GetMaxParallelThreads() ?? Environment.ProcessorCount);
 }