I'm currently new in a project that was started 1 year ago.
This project is using C#, WPF, PRISM (CAL), Entity Framework, LINQ, etc. The application is done using the MVVM pattern.
There are some unit tests, but I was asked to do functional testing because most of the bugs were found when using all the components together.
I started making a MSTEST project. My goal was to start the entire application back-end (model and viewmodel), simulate UI events and check the model modifications accessing on or more viewmodel properties.
My first guest was to create the Entity context (the model), initialize all the PRISM modules and start publishing events in the view-model to modify my model and check back the results in the same or other viewmodels. I had to :
- Override the prism Boostrapper class
- Create a simple application (because under MSTEST it seems that
System.Windows.Application.Current
is null). I just derived a class fromSystem.Windows.Application
.
I can access all of my interfaces implementation using the UnityContainer. The problem I have now is that the IEventAggregator
is not working. Events are not fired. I don't want to mock the event aggregator because I want it to fire my events between the prism modules (I'm doing functional testing, not unit testing).
I found a way to make it work by playing with the Dispatcher
and DispatcherFrame
, but I get stock in the RegionManager
that seems to fail.
My questions is: is there a better way to do my functional/integration testing without necessarily showing the user interface?