You can mock the functionality related to adding regions as well in this test, since that is part of the Prism tests. I made a small modification to the code and tried if it worked in the immediate window by asking for:
this.regionManager.Regions["MainRegion"], which gave me a non-null result. In order to get that working, I changed this line:
For this one:
Although this will make the Regions collection not empty, this might not make the test pass, as there is some functionality (such as the
RegisterViewWithRegion) method that has not been mocked, and could throw a
You can take a look at the Unit Test in the different Prism Quickstarts and
RI, which might provide some ideas for these mocks.
Please let me know if this helps.