Hi,
I have a class that inherits from System.Web.Mvc.RedirectResult
which overrides ExecuteResult
. How do I unit test this?
Thanks.
Hi,
I have a class that inherits from System.Web.Mvc.RedirectResult
which overrides ExecuteResult
. How do I unit test this?
Thanks.
Depends on what you override does.
In general, mock HttpContextBase
, create the necessary RouteData
and use those two elements to create a ControllerContext
.
Instantiate your custom RedirectResult
, call ExecuteResult
passing in your previously created ControllerContext
and then make assertions on the various bits and pieces that you mocked.
If you want a more comprehensive answer, I would need more details as to exactly what your override does.