I have the following unit test:
[TestMethod]
public void Add_Returns_Edit_View()
{
// Act
ActionResult result = _controller.Add();
// Verify
result.AssertViewRendered().ForView("Edit");
}
This should be passing, since the Add action is returning the Edit view. However, this assertion fails with the following exception
MvcContrib.TestHelper.ActionResultAssertionException: Expected view name 'Edit', actual was '~/Views/JobSearch/Edit.cshtml'
Why is the view name coming back as the full path name? Could this be due to my usage of T4MVC, and if so how can I get this to pass?
Edit The Add view looks like this:
public virtual ActionResult Add()
{
return View(MVC.JobSearch.Views.Edit, new JobSearch());
}
You can test against the T4MVC value like this :
I think it's the cleaner solution... If you have better let me know :)