public void CheckLoginCredentialsTest() { //Arrange var controller = new AdminUserLogic(new AdminUserDALStub()); var inputRight = new AdminUserModelBLL { UserName = "******", Password = "******" }; var inputWrong = new AdminUserModelBLL { UserName = "******", Password = "******" }; //Act var result1 = controller.CheckLoginCredentials(inputRight); var result2 = controller.CheckLoginCredentials(inputWrong); //Assert Assert.IsTrue(result1 && !result2); }
public ActionResult Index(AdminUserLoginViewModel userInput) { if (!ModelState.IsValid) { ViewBag.Message = "Please make sure all fields are filled out correctly"; return(View()); } bool isLoggedIn = _adminUserLogic.CheckLoginCredentials(ModelMapper.MapFromAdminUserViewModelToAdminUserModelBLL(userInput)); Session["LoggedIn"] = isLoggedIn; ViewBag.LoggedIn = isLoggedIn; if (!isLoggedIn) { ViewBag.Message = "Wrong username or password"; } return(View()); }