I have a windows phone 7 silverlight app that I'm trying to unit test. My tests fail with the following error:
System.DivideByZeroException : Attempted to divide by zero.
On the following line:
Deployment.Current.Dispatcher.BeginInvoke(() => RaisePropertyChanged("Lat"));
I assume this is because there is no ui thread. Do I need to abstract the BeginInvoke calls so they can be mocked in my test?
Update:
I ended up abstracting so I could mock in the unit test. Works great. What do you think?
public class UiDispatcher : IUiDispatcher
{
public void InvokeOnUiThread(Action action)
{
Deployment.Current.Dispatcher.BeginInvoke(action);
}
}