私は次の単体テストを持っています:
[TestMethod]
public void Add_Returns_Edit_View()
{
// Act
ActionResult result = _controller.Add();
// Verify
result.AssertViewRendered().ForView("Edit");
}
追加アクションは編集ビューを返すため、これは合格であるはずです。ただし、このアサーションは次の例外で失敗します
MvcContrib.TestHelper.ActionResultAssertionException: Expected view name 'Edit', actual was '~/Views/JobSearch/Edit.cshtml'
ビュー名がフルパス名として返されるのはなぜですか?これは私のT4MVCの使用によるものでしょうか?もしそうなら、どうすればこれを通過させることができますか?
編集追加ビューは次のようになります。
public virtual ActionResult Add()
{
return View(MVC.JobSearch.Views.Edit, new JobSearch());
}