public void Validate(CreateAccountMessages.Request request) { var username = request.Username; var password = request.Password; if (String.IsNullOrWhiteSpace(username) || username.Length < usernameRequiredLength) { throw CreateAccountValidationException.CreateException(CreateAccountValidationExceptions.InvalidUsername); } if (String.IsNullOrWhiteSpace(password) || password.Length < passwordRequiredLength) { throw CreateAccountValidationException.CreateException(CreateAccountValidationExceptions.InvalidPassword); } }
static public CreateAccountValidationException CreateException(CreateAccountValidationExceptions exception) { return(new CreateAccountValidationException(CreateAccountValidationException.ValidationMessageFor(exception))); }