public void Should_have_error_when_confirmPassword_is_null_or_empty() { var _customerSettings = new CustomerSettings(); var _stateProvinceService = new Mock <IStateProvinceService>(); var _validator = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings); var model = new RegisterModel { ConfirmPassword = null }; _validator.ShouldHaveValidationErrorFor(x => x.ConfirmPassword, model); model.ConfirmPassword = ""; _validator.ShouldHaveValidationErrorFor(x => x.ConfirmPassword, model); }
public void Should_have_error_when_email_is_null_or_empty() { var model = new RegisterModel(); model.Email = null; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); model.Email = ""; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); }
public void Should_have_error_when_lastName_is_null_or_empty() { var _customerSettings = new CustomerSettings { LastNameEnabled = true, LastNameRequired = true }; var _stateProvinceService = new Mock <IStateProvinceService>(); var _validator = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings); var model = new RegisterModel { LastName = null }; _validator.ShouldHaveValidationErrorFor(x => x.LastName, model); model.LastName = ""; _validator.ShouldHaveValidationErrorFor(x => x.LastName, model); }
public void ShouldHaveErrorWhenFirstnameIsNullOrEmpty() { var customerSettings = new CustomerSettings { FirstNameEnabled = true, FirstNameRequired = true }; var validator = new RegisterValidator(GetService <ILocalizationService>(), GetService <IStateProvinceService>(), customerSettings); var model = new RegisterModel { FirstName = null }; validator.ShouldHaveValidationErrorFor(x => x.FirstName, model); model.FirstName = string.Empty; validator.ShouldHaveValidationErrorFor(x => x.FirstName, model); }
public void ShouldHaveErrorWhenEmailIsNullOrEmpty() { var model = new RegisterModel { Email = null }; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); model.Email = string.Empty; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); }
public void Should_have_error_when_email_is_wrong_format() { var _customerSettings = new CustomerSettings(); var _stateProvinceService = new Mock <IStateProvinceService>(); var _validator = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings); var model = new RegisterModel { Email = "adminexample.com" }; _validator.ShouldHaveValidationErrorFor(x => x.Email, model); }
public void Should_have_error_when_password_doesnot_equal_confirmationPassword() { var _customerSettings = new CustomerSettings(); var _stateProvinceService = new Mock <IStateProvinceService>(); var _validator = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings); var model = new RegisterModel { Password = "******", ConfirmPassword = "******" }; _validator.ShouldHaveValidationErrorFor(x => x.ConfirmPassword, model); }
public void Should_validate_password_min_uppercase_chars() { _customerSettings.MinUppercaseCharsInPassword = 4; _validator = new RegisterValidator(T, _customerSettings, _taxSettings); var model = new RegisterModel(); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_validate_password_min_special_chars() { _customerSettings.MinSpecialCharsInPassword = 2; _validator = new RegisterValidator(T, _customerSettings, _taxSettings); var model = new RegisterModel(); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_validate_password_min_digits() { _customerSettings.MinDigitsInPassword = 3; _validator = new RegisterValidator(T, _customerSettings, _taxSettings); var model = new RegisterModel(); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_validate_password_is_length() { _customerSettings.PasswordMinLength = 5; _validator = new RegisterValidator(T, _customerSettings, _taxSettings); var model = new RegisterModel(); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; model.ConfirmPassword = model.Password; _validator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void ShouldValidateOnRegisterModelIsAllRule() { var model = new RegisterModel { Password = "******" }; //we know that password should equal confirmation password model.ConfirmPassword = model.Password; _registerValidator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; //we know that password should equal confirmation password model.ConfirmPassword = model.Password; _registerValidator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_validate_password_is_length() { _customerSettings.PasswordMinLength = 5; _validator = new RegisterValidator(_localizationService, _customerSettings); var model = new RegisterModel(); model.Password = "******"; //we know that password should equal confirmation password model.ConfirmPassword = model.Password; _validator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; //we know that password should equal confirmation password model.ConfirmPassword = model.Password; _validator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_validate_on_RegisterModel_is_all_rule() { _registerValidator = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings); var model = new RegisterModel { Password = "******" }; //we know that password should equal confirmation password model.ConfirmPassword = model.Password; _registerValidator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; //we know that password should equal confirmation password model.ConfirmPassword = model.Password; _registerValidator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_validate_on_RegisterModel_is_all_rule() { _registerValidator = new RegisterValidator(_userSettings); var model = new RegisterViewModel() { Password = "******" }; //password should equal confirmation password model.ConfirmPassword = model.Password; _registerValidator.ShouldHaveValidationErrorFor(x => x.Password, model); model.Password = "******"; //password should equal confirmation password model.ConfirmPassword = model.Password; _registerValidator.ShouldNotHaveValidationErrorFor(x => x.Password, model); }
public void Should_have_error_when_email_is_null_or_empty() { var model = new RegisterViewModel { Email = null }; _validator.ShouldHaveValidationErrorFor(vm => vm.Email, model); model.Email = ""; _validator.ShouldHaveValidationErrorFor(vm => vm.Email, model); }