If I target a message from ViewModelA to ViewModelB, is there a way to catch this notification from my unit test that is testing ViewModelA where the Message is raised?
Messenger.Default.Send<string, ViewModelB>("Something Happened");
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I see two options:
First, you could mark ViewModelB with a “marker” interface, and use that instead of your actual class name.
This is not my favorite solution, but it should work.
Or, you could register for messages with a specific token in ViewModelB while sending the disambiguated message from ViewModelA:
In ViewModelA:
In ViewModelB:
Much cleaner, and will still allow you to mock out ViewModelB for testing purposes.
There could be more options, but these are the ones that pop to the top of my head at this late hour…