public void ParallelExeutionStrategy_TestFixture(ParallelScope testScope, ParallelScope contextScope, string expectedStrategy) { _testFixture.Properties.Set(PropertyNames.ParallelScope, testScope); _context.ParallelScope = contextScope; WorkItem work = WorkItem.CreateWorkItem(_testFixture, TestFilter.Empty); work.InitializeContext(_context); // We use a string for expected because the ExecutionStrategy enum is internal and can't be an arg to a public method Assert.That(ParallelWorkItemDispatcher.GetExecutionStrategy(work).ToString(), Is.EqualTo(expectedStrategy)); }
public void ParallelExecutionStrategy_TestCase(ParallelScope testScope, ParallelScope contextScope, string expectedStrategy) { _testMethod.Properties.Set(PropertyNames.ParallelScope, testScope); _context.ParallelScope = contextScope; WorkItem work = WorkItem.CreateWorkItem(_testMethod, TestFilter.Empty); work.InitializeContext(_context); // We use a string for expected because the ExecutionStrategy enum is internal and can't be an arg to a public method Assert.That(ParallelWorkItemDispatcher.GetExecutionStrategy(work).ToString(), Is.EqualTo(expectedStrategy)); // Make context single threaded - should always be direct _context.IsSingleThreaded = true; Assert.That(ParallelWorkItemDispatcher.GetExecutionStrategy(work).ToString(), Is.EqualTo("Direct")); }