예제 #1
0
            public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess()
            {
                var model = new InitialUserSetup.Model
                {
                    EmailAddress         = "*****@*****.**",
                    Password             = "******",
                    PasswordConfirmation = "password",
                    FirstName            = "first-name",
                    LastName             = "last-name",
                };
                var validator = new InitialUserSetup.Validator();
                var result    = validator.Validate(model);

                Assert.True(result.IsValid);
            }
예제 #2
0
            public void Validate_GivenLastNameIsNull_ExpectValidationFailure()
            {
                var model = new InitialUserSetup.Model
                {
                    EmailAddress         = null,
                    Password             = "******",
                    PasswordConfirmation = "password",
                    FirstName            = "first-name",
                    LastName             = null,
                };
                var validator = new InitialUserSetup.Validator();
                var result    = validator.Validate(model);

                Assert.False(result.IsValid);
                Assert.Contains(result.Errors, x => x.PropertyName == "LastName");
            }
예제 #3
0
            public void Validate_GivenPasswordIsEmpty_ExpectValidationFailure()
            {
                var model = new InitialUserSetup.Model
                {
                    EmailAddress         = "*****@*****.**",
                    Password             = string.Empty,
                    PasswordConfirmation = string.Empty,
                    FirstName            = "first-name",
                    LastName             = "last-name",
                };
                var validator = new InitialUserSetup.Validator();
                var result    = validator.Validate(model);

                Assert.False(result.IsValid);
                Assert.Contains(result.Errors, x => x.PropertyName == "Password");
            }