What would a simple unit test look like to confirm that a certain controller exists if I am using Rhino Mocks, NUnit and ASP.NET MVC 2? I'm trying to wrap my head around the concept of TDD, but I can't see to figure out how a simple test like "Controller XYZ Exists" would look. In addition, what would the unit test look like to test an Action Result off a view?
TDD a controller with ASP.NET MVC 2, NUnit and Rhino Mocks
asp.net-mvc-2nunitrhino-mockstdd
Best Answer
Having unit tests on its actions is a strong suggestion that the controller exists which brings us to:
Here's an example:
And the corresponding unit test:
MVCContrib has some great features allowing you to mock HttpContext and also test your routes.