How to access Dispatcher in Silverlight tests?
        Posted  
        
            by bluebit
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by bluebit
        
        
        
        Published on 2009-11-10T09:31:59Z
        Indexed on 
            2010/05/18
            12:20 UTC
        
        
        Read the original article
        Hit count: 261
        
I am using the SL unit test framework for tests (http://code.msdn.microsoft.com/silverlightut). My code is heavily client-server communications dependant, and I access the GUI dispatcher in several places to make sure important data is only accessed on a single thread (ie. the GUI thread).
This dispatcher seems unavailable in the unit tests - I have tried using Deployment.Current.Dispatcher and even created an instance of a blank control to try use its own dispatcher, but both don't work. The code inside of Dispatcher.BeginInvoke() just never executes, even if I include a Thread.Sleep afterwards.
© Stack Overflow or respective owner