instantiating a MEF ViewModel in UnitTest

Topics: Bootstrappers & IoC
Apr 4, 2012 at 8:15 PM

What is the preferred method of instantiating new ViewModels that use IoC.Get<>() to function inside a MSTest unit test?  If the answer is to write your own bootstrapper for the unit tests how can I swap in new eventAggregatore or windowmanagers per test (for mocking)?  It seems there are some problems removing or changing exported values (

Are there any examples of creating a ViewModel in a unit test that use IoC.Get<>()?




Apr 9, 2012 at 6:56 PM

Did I ask one of those questions that are so simple no one could be bothered to answer?  Is it a RTFM thing?  I'd really appreciate some insight here.  Thanks!

Apr 11, 2012 at 6:19 PM

There's some good info here that helped me when setting up unit testing when using MEF. Perhaps it will be of some help.