Mocking EventAggregator with MOQ

Topics: Prism v2 - WPF 4, Prism v4 - WPF 4
Sep 12, 2010 at 9:26 AM
Edited Sep 12, 2010 at 9:35 AM

Hi all

Wondering if anybody has an example of how to Mock the EventAggregator with MOQ and NOT use the MockEventAggregator

I am learning the EventAggregator in Prism and I would like to build something in typical TDD fashion as this is what we do everyday in my office however I was looking for some examples and could not find anything on the net.

Can anybody help with a snippet ?

I was trying to convert 01 TestMethod with the EventAggregator Quickstart Example NOT using  the MockEventAggregator

Any suggestions?


Sep 12, 2010 at 12:25 PM


I've tried this in the past without to much luck. I've even worked up an idea with Typemock Isolator, there is just to much trouble to set it up at the beginning at each test it will make your test look very complicated.

So in the end I've settled at the MockUnityContainer implementation in the StockTrader reference implementation. Did some enchantments to support some of my scenarios and it works great.


This was my solution, if you do come with a better done do let us know.