silverlight - Unit Testing with Deployment.Current.Dispatcher.BeginInvoke -


I have a Windows Phone 7 Silverlight app that I'm trying for a unit test. My test failed with the following error:

The system. Dividbizroxation: Attempted to divide by zero.

On the following line:

  Deployment. Present. Dispatcher. BenninWolk (() => RaisePropertyChanged ("Lat"));  

I think the reason is that there is no UI thread, do I need to summarize the BeginInvoke call, so that they joke in my trial Can you?

Update:

I ended the sarcine, so I could have been fake in the unit test. works great. What do you think?

  Public category UiDispatcher: IUiDispatcher {Public Zero InvokeOnUiThread (Action Action) {Deployment. Present. Dispatcher.BeginInvoke (action); }}  

You've got it. You also want to add a Dispatcher.CheckAccess () conditional, which can save you from them if you do not need it:

  Public Zero InvokeOnUiThread {verb action} {if deployed. Dispatcher. Check Away (Action) (Action); } Other {Deployment. Present. Dispatch. Basic Invoc (action); }}  

Comments