Mocking the Controller Context using Rhino Mock
When using ASP.NET MVC 5, its easy to write unit tests around the framework due to the various abstractions provided.
Stephen Walther provides a good overview of the different objects. Whenever you need to interact with the request, response, session or browser, the following objects can be mocked using your mocking framework of choice:
Here of some examples using of mocking the various classes using Rhino Mock:
Stephen Walther provides a good overview of the different objects. Whenever you need to interact with the request, response, session or browser, the following objects can be mocked using your mocking framework of choice:
- HttpRequestBase
- HttpResponseBase
- HttpSessionBase
- HttpBrowserCapabilitiesBase
Here of some examples using of mocking the various classes using Rhino Mock: