I have an ASP.NET web application that follows the Model-View-Presenter pattern. I am trying to mock some calls in the Presenter. Under normal conditions the presenter makes calls to a web service to source some data for the view, but I want to provide a known set of data without the web service call for testing purposes.
If I unit test the Presenter itself, I can mock the call to the web service successfully.
I am also trying to unit test the View as it is dynamically constructed depending on the data provided by the Presenter. To do this properly the page needs to be requested from a web server, and so I instantiate the MS development server within NUnit, and then request the page. My understanding is that this server launches itself in a new AppDomain. The test then requests the page, which the web server processes and returns.
Before requesting the page, I set up the same mocking on the Presenter to mock the call to the web service, however all mocking appears to be completely ignored in this scenario.
Is it possible to mock objects that are created in a separate AppDomain? Is there any way to achieve this type of mocking.