コード例 #1
0
ファイル: WorkItemTest.cs プロジェクト: fstn/WindowsPhoneApps
 /// <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);
   }
 }
コード例 #2
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);
 }