0
다음과 같은 메소드에 대한 테스트 케이스를 생성했습니다. Action 결과 - json "Success"문자열을 반환합니다. 생성 된 스크립트를 수정하는 방법?작성 단위 작업 결과를 반환하는 메소드의 테스트 케이스
public ActionResult LoginClick(string username, string password)
{
LoginRepo loginrepo = new LoginRepo();
BL bl = new BL();
bool loginStatus = loginrepo.CheckLogin(username, password);
if (loginStatus)
{
bl.SetSessionVariable("Username", username);
return Json(new { Status = "Success" }, JsonRequestBehavior.AllowGet);
}
return Json(new { Status = "Failed" }, JsonRequestBehavior.AllowGet);
}
다음은 생성 된 테스트 케이스입니다.
[TestMethod()]
[HostType("ASP.NET")]
[UrlToTest("http://localhost:1280")]
public void LoginClickTest()
{
LoginController target = new LoginController(); // TODO: Initialize to an appropriate value
string username = null; // TODO: Initialize to an appropriate value
string password = null; // TODO: Initialize to an appropriate value
ActionResult expected = null ; // TODO: Initialize to an appropriate value
ActionResult actual;
actual = target.LoginClick(username, password);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
성공적으로 실행하려면 어떻게 수정해야합니까? 액션 결과와 데이터가 json string으로 예상되는 것이기 때문에 실제 결과는 어떻게 작성해야합니까?
이 되었습니까? – SBirthare