I have a class that inherits from System.Web.Mvc.RedirectResult which overrides ExecuteResult. How do I unit test this?
I have a class that inherits from System.Web.Mvc.RedirectResult which overrides ExecuteResult . How do
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depends on what you override does.
In general, mock
HttpContextBase, create the necessaryRouteDataand use those two elements to create aControllerContext.Instantiate your custom
RedirectResult, callExecuteResultpassing in your previously createdControllerContextand 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.