I have an action like this:
public ViewResult Index()
{
var model = someFactory.CreateModel();
return View(model);
}
What is the simplest way to test it on “yellow screen of deth” appearance?
Ofсourse I’ll mock some Factory logic.
I just want to test ViewResult on some stupid syntax runtime errors.
Update: In controller logic is no exceptions, but some time I could get runtime exception while ExcecuteResult method excecution. In other words I what to test View rendring process.
You need to execute the view results, here is a blog post how to do it with Razor:
http://blog.davidebbo.com/2011/06/unit-test-your-mvc-views-using-razor.html
If you are using WebForms views you will have to use a similar method.