Unit Testing

Mar 23, 2011 at 1:07 PM

I followed some recommendation to create the Database property under the App class but i'm now really sure how you should be unit testing that. I want to be able to test my ViewModels but i get a null reference exception when trying to access the database.

How would you do this?

Mar 23, 2011 at 1:58 PM

There are a number of ways to do it. For unit testing, best is to use a service locator or similar pattern and access it that way so you can wire up the test instance when needed. MEF is another possibility.