unit testing - C# DispatcherHelper.CheckBeginInvokeOnUI won't run on UnitTest -


I am using DispatcherHelper.CheckBeginInvokeOnUI for mvvm in a C # app, and I run msTests with it Trying any call that I do from a unitator which is DispatcherHelper.CheckBeginInvokeOnUI (Rep. {Do do stuff}); works when called from a unitate (after calling the dispatch helper, start.), Of course).

However, the problem occurs when the unit test is run in more context - if I run all the tests in that class (none of which is required to use Dispatcher Helper)

Without introducing the Dispatcher Helper, when he calls the representative, it throws an empty exception, as expected, so I need to initialize whether it is in the unit test Is there a problem getting started? I can not imagine why this would work in the context of a unit test, but not more than that.

Thanks

Edit: The real problem is that MsTest throws Units Is locked in separate threads at the same time so that they can complete all immediately, and "Initialize" for the Dispatcher has the following code:

  get started ( ) {If (UIDispatcher! = Null} {Return null} else // initialize}   

This means that you can start it without any clearing only once, For thread L can be started even when the unit test all the different threads, you end up with those issues where it passes any call Dispcr. I'm trying to find a built-in method to "de-initialize" it (thus setting the UIDPetter to empty), but as it is suggested that editing the code can be the best < / P>

Comments