WPFMessageBoxService Help

Jan 6, 2012 at 2:51 PM

Hey everyone,

I'm using the WPFMessageBoxService and understand the concept behind queuing results during unit tests, but can't seem to follow the coding samples in the CodeProject article.  In the sample it uses the following:

TestMessageBoxService testMessageBoxService = (TestMessageBoxService)ViewModelBase.ServiceProvider.Resolve<IMessageBoxService>();

When I tried to implement the same line of code however, ViewModelBase doesn't contain a definition for ServiceProvider.  I also tried to cast my instance of WPFMessageBoxService to an IMessageBoxService then to a TestMessageBoxService, but get a type conversion error when I run the test...so I'm not entirely sure how to get the current instance of the IMessageBoxService from my unit test.

While on the topic, does anyone happen to know if during the same situation, if there's a way to retrieve the message from the WPFMessageBoxInstance that's being satisfied (hope I asked that correctly)?

Jan 13, 2012 at 12:57 PM

Anyone?  I'm willing to go with educated guesses...anything will help at this point.




Jan 29, 2012 at 8:24 AM

What version of Cinch are you using? That link you post to is for Cinch V1, Cinch V2 is complete rewrite and it no longer has the ServiceProvider in ViewModelBase. Sounds like you are using CinchV2 Dlls and that you are reading CinchV1 article. You could easily check this, if your Dll that you reference has this interface "IViewStatusAwareWindowInjectionAware" you are using V2.


I have just checked my code and V1 100% still has the ServiceProvider property. I suspect you have just referenced V2 Dll by mistake

For V2 I use MEF, so you just new up your ViewModel in a testcase passing in whatever test versions or mocks you want to use to the ViewModel constructor