0
如何爲我的Index ActionResult測試視圖結果進行單元測試?如何進行單元測試會話MVC
public ActionResult Index()
{
if (!new SessionStateCredentialStore().HasAllCredentials())
return RedirectToAction("Index", "OAuth");
return View("Index");
}
因爲在你的行動,你必須重定向 - 可能的解決方案之一就是對測試硒。 –
看這個鏈接https://stackoverflow.com/questions/18865257/how-to-unit-test-an-action-when-return-type-is-actionresult – Vecchiasignora