public void ShouldNotHaveErrorWhenEmailIsCorrectFormat()
        {
            var model = new RegisterModel
            {
                Email = "*****@*****.**"
            };

            _validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
        }
        public void Should_not_have_error_when_email_is_correct_format()
        {
            var _customerSettings     = new CustomerSettings();
            var _stateProvinceService = new Mock <IStateProvinceService>();
            var _validator            = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings);
            var model = new RegisterModel
            {
                Email = "*****@*****.**"
            };

            _validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
        }
Exemple #3
0
        public void Should_not_have_error_when_email_is_correct_format()
        {
            var model = new RegisterModel();

            model.Email = "*****@*****.**";
            _validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
        }
        public void Should_not_have_error_when_password_equals_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.ShouldNotHaveValidationErrorFor(x => x.Password, model);
        }
Exemple #5
0
        public void Should_not_have_error_when_email_is_correct_format()
        {
            var model = new RegisterViewModel {
                Email = "*****@*****.**"
            };

            _validator.ShouldNotHaveValidationErrorFor(vm => vm.Email, model);
        }
        public void Should_not_have_error_when_confirmPassword_is_specified()
        {
            var _customerSettings     = new CustomerSettings();
            var _stateProvinceService = new Mock <IStateProvinceService>();
            var _validator            = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings);
            var model = new RegisterModel
            {
                ConfirmPassword = "******"
            };

            //we know that new password should equal confirmation password
            model.Password = model.ConfirmPassword;
            _validator.ShouldNotHaveValidationErrorFor(x => x.ConfirmPassword, model);
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        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);
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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_not_have_error_when_firstName_is_specified()
        {
            var _customerSettings = new CustomerSettings
            {
                FirstNameEnabled = true
            };
            var _stateProvinceService = new Mock <IStateProvinceService>();
            var _validator            = new RegisterValidator(_localizationService, _stateProvinceService.Object, _customerSettings);
            var model = new RegisterModel
            {
                FirstName = "John"
            };

            _validator.ShouldNotHaveValidationErrorFor(x => x.FirstName, model);
        }
Exemple #13
0
        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 ShouldNotHaveErrorWhenFirstnameIsSpecified()
        {
            var customerSettings = new CustomerSettings
            {
                FirstNameEnabled = true
            };

            var validator = new RegisterValidator(GetService <ILocalizationService>(), GetService <IStateProvinceService>(), customerSettings);

            var model = new RegisterModel
            {
                FirstName = "John"
            };

            validator.ShouldNotHaveValidationErrorFor(x => x.FirstName, 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_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);
        }