Unit Test Event w/UIThread

Aug 5, 2008 at 2:18 PM
We have a couple presenters that subscribe to events using UIThread for the thread option. When unit testing the tests fail due to no UIDispatcher. Is there a way to keep UIThread without failing the unit tests?
Aug 5, 2008 at 3:14 PM
I found a solution looking at the event quickstart. A bit verbose but it will work.
Aug 5, 2008 at 3:55 PM

If anyone else is running into the same problem, you need to mock the EventAggregator service (by implementing the IEventAggregator interface) and your Event class.

You can check the ModuleB.Tests and ModuleA.Tests projects of the Event Aggregation QuickStart to see a possible way to tests Presenters that Subscribe and Publish events.

 

Please, let me know if it helps.

 

Mariano Converti

http://blogs.southworks.net/mconverti