public void NoEmailFilledin() { ForgotPasswordController controller = new ForgotPasswordController(config); ForgotPassword forgotPassword = new ForgotPassword() { emailAddress = "" }; ControllerValidationHelper.BindViewModel(controller, forgotPassword); ViewResult result = controller.ForgotPassword() as ViewResult; Assert.AreEqual("Er is geen e-mailadres ingevuld", result.ViewData.ModelState["emailAddress"].Errors[0].ErrorMessage); }
public void NoEmailFilledIn() { LoginController controller = new LoginController(); Login login = new Login() { emailAddress = "", password = "******" }; ControllerValidationHelper.BindViewModel(controller, login); ViewResult result = controller.Login(login) as ViewResult; Assert.AreEqual("Er is geen e-mailadres ingevuld", result.ViewData.ModelState["emailAddress"].Errors[0].ErrorMessage); }
public void NoDoBFilledIn() { //Arrange RegisterController regController = new RegisterController(_logger); Register newAccount = new Register(); newAccount.Email = "*****@*****.**"; newAccount.Password = "******"; newAccount.ValidationPassword = "******"; newAccount.Geboortedatum = null; ControllerValidationHelper.BindViewModel(regController, newAccount); //Act ViewResult result = regController.Register(newAccount) as ViewResult; //Assert Assert.IsTrue(!result.ViewData.ModelState.IsValid); Assert.AreEqual(result.ViewData.ModelState["Geboortedatum"].Errors[0].ErrorMessage, "Er is geen geboortedatum ingevuld"); }