how can i get the Model from an ViewResult in a asp.net mvc unittest?

Posted by Michel on Stack Overflow See other posts from Stack Overflow or by Michel
Published on 2010-04-22T10:33:00Z Indexed on 2010/04/22 11:03 UTC
Read the original article Hit count: 141

Filed under:
|

Hi,

i call a controller action in a unit test.

 ViewResult result = c.Index(null,null) as ViewResult;

I cast the result to a ViewResult, because that is what i'm returning in the controller:

return View(model);

But how can i access this model variable in my unit test?

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about asp.net-mvc