I know the basic idea of the thunder principle (one object enters, one object leaves), but I have not seen any real example of this in asp.net mvc. Is this a good example of a lightning rod principle
public ActionResult Index(Employee employee)
{
return View(employeeViewModel);
}
But what about the statement
Controller classes will never be directly exposed to anything related to the HttpContext
What does an action invoker look like? Could you give some examples and unit tests for this?
from http://codebetter.com/blogs/jeremy.miller/archive/2008/10/23/our-opinions-on-the-asp-net-mvc-introducing-the-thunderdome-principle.aspx
"Thunderdome principle" - all controller methods take one ViewModel object (or in some cases zero objects) and return one ViewModel object (one object enters, one object leaves). Controller classes will NEVER be directly affected by the HttpContext-related action. Nothing makes me cry like seeing people trying to write tests that make fun or close this new IHttpContextWrapper interface. Similarly, controller methods do not return ViewResult objects and are typically disconnected from the entire MVC infrastructure. We adopted this strategy very early in order to simplify the mechanical testing of the controller.
But I want to know how to do this? how to write such an action invoker controller? because we usually have to mock httpcontext