public string this[string columnName] { get { string result = null; CoordonnateurLogin coordonnateurLogin = CoordonnateurLogin.GetInstance(); switch (columnName) { case "username": if (String.IsNullOrEmpty(this.username)) { result = ERR_USERNAME_EMPTY; } else if (coordonnateurLogin.VerifierNomUtilisateurBD(this.username)) { result = ERR_USERNAME_ALREADY_EXIST; } break; case "password": if (string.IsNullOrEmpty(this.password)) { result = ERR_PASSWORD_EMPTY; } break; case "confirmPassword": if (this.confirmPassword != null && !this.confirmPassword.Equals(this.password)) { result = ERR_CONFIRM_PASSWORD_NOT_MATCH; } break; case "firstName": if (String.IsNullOrEmpty(this.firstName)) { result = ERR_FIRST_NAME_EMPTY; } else if (!Regex.IsMatch(this.firstName, NAMES_PATTERN)) { result = ERR_FIRST_NAME_INVALID; } break; case "lastName": if (String.IsNullOrEmpty(this.lastName)) { result = ERR_LAST_NAME_EMPTY; } else if (!Regex.IsMatch(this.lastName, NAMES_PATTERN)) { result = ERR_LAST_NAME_INVALID; } break; case "email": if (String.IsNullOrEmpty(this.email)) { result = ERR_EMAIL_EMPTY; } else if (!Regex.IsMatch(this.email, EMAIL_PATTERN)) { result = ERR_EMAIL_INVALID; } break; default: result = null; break; } return(result); } }
public void testRegister() { Assert.IsTrue(coord.VerifierNomUtilisateurBD("mel007")); }