Exemplo n.º 1
0
        protected override void OnAssemblyStarting()
        {
            collectionBehaviorAttribute = AssemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            if (collectionBehaviorAttribute != null)
            {
                disableParallelization = collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization");
                maxParallelThreads     = collectionBehaviorAttribute.GetNamedArgument <int>("MaxParallelThreads");
            }

            disableParallelization = ExecutionOptions.GetValue <bool>(TestOptionsNames.Execution.DisableParallelization, disableParallelization);
            var maxParallelThreadsOption = ExecutionOptions.GetValue <int>(TestOptionsNames.Execution.MaxParallelThreads, 0);

            if (maxParallelThreadsOption > 0)
            {
                maxParallelThreads = maxParallelThreadsOption;
            }

            scheduler = GetTaskScheduler(maxParallelThreads);

            var ordererAttribute = AssemblyInfo.GetCustomAttributes(typeof(TestCaseOrdererAttribute)).SingleOrDefault();

            if (ordererAttribute != null)
            {
                TestCaseOrderer = GetXunitTestCaseOrderer(ordererAttribute);
            }
        }