예제 #1
0
        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);
        }
예제 #2
0
 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);
 }