I\'m having trouble getting the Dispatcher to run a delegate I\'m passing to it when unit testing. Everything works fine when I\'m running the program, but, during a unit te
Winforms has a very easy and WPF compatible solution.
From your unit test project, reference System.Windows.Forms.
From your unit test when you want to wait for dispatcher events to finish processing, call
System.Windows.Forms.Application.DoEvents();
If you have a background thread that keeps adding Invokes to the dispatcher queue, then you'll need to have some sort of test and keep calling DoEvents until the background some other testable condition is met
while (vm.IsBusy)
{
System.Windows.Forms.Application.DoEvents();
}