public void TestVerifyUser(string message, LoginModel loginModel, bool expected) { var service = new AccountService { UserRepository = new FakeUserRepository() }; var result = service.VerifyUser(loginModel); Assert.AreEqual(expected, result); }
public ActionResult Index(LoginModel loginModel) { if (ModelState.IsValid) { var service = new AccountService(); if (service.VerifyUser(loginModel)) { FormsAuthentication.SetAuthCookie(loginModel.UserName, false); return Redirect(Request.QueryString["ReturnUrl"] ?? "~/"); } ModelState.AddModelError("InvalidLogin","Invalid Login"); } return View(loginModel); }