A test work item is a task that is invoked until it is complete. It maintains its own state to be able to notify the caller when it is finally complete, with no further work to be run. It is possible that some implementations of a TestWorkItem may actually contain a set of sub-tasks by implementing a composite pattern.
コード例 #1
0
        public override void EnqueueWorkItem(WorkItem testTaskObject) //CDB IWorkItem replaced with WorkItem
        {
            if (UnitTestBase.NumberOfTimeouts >= UnitTestBase.DefaultTimeoutThreshold)
            {
                Assert.Inconclusive("The test was not attempted because the number of tests that have timed-out has exceeded the threshold.");
            }

            base.EnqueueWorkItem(testTaskObject);
        }
コード例 #2
0
 /// <summary>
 /// Add a task object to the test queue.  For a test that is currently 
 /// executing, all tasks contained within the queue are executed to 
 /// completion (unless an Exception is thrown) -before- moving on to 
 /// the next test.
 /// 
 /// The test task queue replaces the PumpMessages(...) system that 
 /// permitted a single callback.  This enables specialized tasks, such 
 /// as DOM bridge tasks, sleep tasks, and conditional continue tasks.
 /// </summary>
 /// <param name="testTaskObject">Asynchronous test task 
 /// instance.</param>
 public virtual void EnqueueWorkItem(WorkItem testTaskObject)
 {
     if (UnitTestHarness.DispatcherStack.CurrentCompositeWorkItem != null)
     {
         UnitTestHarness.DispatcherStack.CurrentCompositeWorkItem.Enqueue(testTaskObject);
     }
     else
     {
         throw new InvalidOperationException(Properties.UnitTestMessage.WorkItemTest_EnqueueWorkItem_AsynchronousFeatureUnavailable);
     }
 }
コード例 #3
0
 /// <summary>
 /// Enqueues a work item into the task queue. The work item will run
 /// immediately following the previous work item, and may not leave any
 /// time before executing the next. This is a specialized method to be
 /// used for performance improvements.
 /// </summary>
 /// <param name="test">The work item test.</param>
 /// <param name="workItem">The unit of work.</param>
 public static void EnqueueQuickWorkItem(this WorkItemTest test, WorkItem workItem)
 {
     workItem.CanExecuteImmediately = true;
     test.EnqueueWorkItem(workItem);
 }