public void LoginPerson_LoginPasswordFalse_UserNull() { //Arrange LoginVM modelTest = new LoginVM() { Login = "******", Password = "******" }; //Act Person user = authenticationBusinessToTest.LoginPerson(modelTest); //Assert Assert.IsNull(user); }
public ActionResult Login(LoginVM model) { AuthenticationBusiness userBL = new AuthenticationBusiness(); Person user = userBL.LoginPerson(model); if (user != null) { ConnexionService.SetSession(user); TempData["LoginMessage"] = "Welcome " + model.Login; if (user is Student) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } else if (user is Instructor) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } } else { ModelState.AddModelError("", "Invalid login or password"); return(View()); } return(View()); }