In my MVC3 app, I'm testing stuff by creating a new controller and invoking methods like Index()
, and storing the resulting ViewResult
into a variable called result
.
How can I poke this object (or something else) to get the actual HTML returned to the browser?
I am surprised that result.ViewName
is empty, result.Model
is null, result.View
is null, and even result.TempData
is empty. (result.ViewBag
has stuff I put in the viewbag, so I know the whole stack is working properly.)
If it matters, I'm using the Visual Studio testing, along with NHibernate/ActiveRecord for my stack. But all that is initializing correctly in my test project. (I can get data from entities/objects.)