Exemplo n.º 1
0
        public void GivenValidate_WhenHavingAInValidEmail_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithEmail("florin");
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
        public void GivenNoPassword_WhenHavingInvalidInput_ThenResultShouldBeInvalid()
        {
            var model     = UserRegisterModelFactory.WithPasswordNull();
            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 3
0
        public void GivenValidate_WhenHavingYearEqualWith6_ThenResultShouldBeValid()
        {
            var model          = UserRegisterModelFactory.Default().WithYear(6);
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeTrue();
        }
Exemplo n.º 4
0
        public void GivenValidate_WhenHavingAnEmptyCity_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithCity(Guid.Empty);
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 5
0
        public void GivenValidate_WhenHavingYearMoreThan6_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithYear(7);
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 6
0
        public void GivenValidate_WhenHavingAgeEqualWith99_ThenResultShouldBeValid()
        {
            var model          = UserRegisterModelFactory.Default().WithAge(99);
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 7
0
        public void GivenValidate_WhenHavingUsernameLenghtMoreThan50_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithUsername(string.Create(51, '1', (a, b) => a.Fill(b)));
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 8
0
        public void GivenValidate_WhenHavingBucketListNameLenghtLessThan6_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithBucketListName("1");
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 9
0
        public void GivenValidate_WhenHavingANullPassword_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithPassword(null);
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 10
0
        public void GivenValidate_WhenHavingBucketListNameLenghEqual6_ThenResultShouldBeValid()
        {
            var model          = UserRegisterModelFactory.Default().WithBucketListName("123456");
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeTrue();
        }
        public void GivenUserRegisterModel_WhenHavingEmailWithMoreThan50Characters_ThenResultShouldBeInvalid()
        {
            var model     = UserRegisterModelFactory.WithEmailHavingMoreThan50Characters();
            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 12
0
        public void GivenValidate_WhenHavingAnPasswordLenghtLessThan8_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.Default().WithPassword(string.Create(2, '1', (a, b) => a.Fill(b)));
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
        public void GivenUserRegisterModel_WhenHavingAnInvalidEmailExtension_ThenResultShouldBeInvalid()
        {
            var model     = UserRegisterModelFactory.WithInvalidEmailExtension();
            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
Exemplo n.º 14
0
        public void GivenValidate_WhenHavingAnEmailLenghtEqualWith200_ThenResultShouldBeValid()
        {
            var model          = UserRegisterModelFactory.Default().WithEmail(string.Create(190, '1', (a, b) => a.Fill(b)) + "@gmail.com");
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeTrue();
        }
Exemplo n.º 15
0
        public void GivenValidate_WhenHavingBucketListLengthEqualWith100_ThenResultShouldBeValid()
        {
            var model          = UserRegisterModelFactory.Default().WithBucketListName(string.Create(100, '1', (a, b) => a.Fill(b)));
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeTrue();
        }
Exemplo n.º 16
0
        public void GivenValidate_WhenHavingANullUsername_ThenResultShouldBeInvalid()
        {
            var model          = UserRegisterModelFactory.WithUsernameNull();
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
        public void GivenUserRegisterModel_WhenHavingUsernameEmpty_ThenResultShouldBeInvalid()
        {
            var model = UserRegisterModelFactory.WithUsernameEmpty();

            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
        public void GivenUserRegisterModel_WhenHavingPasswordNotMatchingRegex_TheResultShouldBeInvalid()
        {
            var model = UserRegisterModelFactory.WithPasswordNotMatchingRegex();

            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
        public void GivenUserRegisterModel_WhenHavingInvalidAge_TheResultShouldBeInvalid()
        {
            var model = UserRegisterModelFactory.WithAgeBelow14();

            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeFalse();
        }
        public void GivenUserRegisterModel_WhenHavingValidPassword_TheResultShouldBeValid()
        {
            var model = UserRegisterModelFactory.Default();

            var validator = new UserRegisterModelValidator();

            var result = validator.Validate(model);

            result.IsValid.Should().BeTrue();
        }
Exemplo n.º 21
0
        public void GivenValidate_WhenHavingAValidInput_ThenResultShouldBeValid()
        {
            var model          = UserRegisterModelFactory.Default();
            var modelValidator = new UserRegisterModelValidator();

            var result = modelValidator.Validate(model);

            result.IsValid.Should().BeTrue();
            result.Errors.Count.Should().Be(0);
        }