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); } }
/// <summary> /// Creates the message bus to be used for test execution. By default, it inspects /// the options for the <see cref="TestOptionsNames.Execution.SynchronnousMessageReporting"/> /// flag, and if present, creates a message bus that ensures all messages are delivered /// on the same thread. /// </summary> /// <returns>The message bus.</returns> protected virtual IMessageBus CreateMessageBus() { if (ExecutionOptions.GetValue(TestOptionsNames.Execution.SynchronousMessageReporting, false)) return new SynchronousMessageBus(MessageSink); return new MessageBus(MessageSink); }
void Initialize() { if (initialized) { return; } collectionBehaviorAttribute = TestAssembly.Assembly.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 = TestAssembly.Assembly.GetCustomAttributes(typeof(TestCaseOrdererAttribute)).SingleOrDefault(); if (ordererAttribute != null) { TestCaseOrderer = ExtensibilityPointFactory.GetTestCaseOrderer(ordererAttribute); } initialized = true; }