I would recommend you an excellent MVContrib test helper . Your test might look like this:
[TestMethod]
public void SomeTest()
{
var p1 = "foo";
var p2 = "bar";
var actual = controller.Index(p1, p2);
actual
.AssertViewRendered()
.WithViewData<SomeViewData>();
}
You can also claim model properties
actual
.AssertViewRendered()
.WithViewData<SomeViewData>()
.SomeProp
.ShouldEqual("some expected value");
source
share