Use the TestHelpers MvcContrib library to make statements that a specific view is returned from your action:
var sampleController = new SampleController(); sampleController.New().AssertViewRendered().ForView("New").WithViewData<SomeModel>();
To make statements so that you return the correct data to the view, pull the model from ActionResult :
var result = (ViewResult)sampleController.New(); ((SomeModel)result.ViewData.Model).SomeProperty.ShouldNotBeNull();
This is until the device is tested.
For end-to-end automated function / GUI testing, you might consider using a tool like Selenium .
source share