How do I test if a URL returns http 404 error in ASP.NET MVC 3? I would like to write a small test to check if a view is being called when I write a specific URL.
Thanks.
How do I test if a URL returns http 404 error in ASP.NET MVC 3? I would like to write a small test to check if a view is being called when I write a specific URL.
Thanks.
Mock the httpContextBase of your controller with mvcContrib-test helper and check what is the response status like that:
Response.StatusCode == 404;