我在一位名叫AdminController的管理人员中有一些守则。
public ActionResult Login()
{
AdminModel model = new AdminModel();
return View(model);
}
当我用测试方法检查观点......
var result = controller.Login();
//assert
Assert.IsInstanceOfType(result, typeof(ViewResult));
Assert.AreEqual("Login", ((ViewResult)result).ViewName);
它没有显示观点名称。 但是,Login认为肯定会返回。 我不禁要问,为什么没有定见名称? 我认为,它违反了行动结果方法的名称?