Ejemplo n.º 1
0
            public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess()
            {
                var cmd = new Details.Model {
                    FirstName = "first-name", LastName = "last-name"
                };
                var validator = new Details.Validator();
                var result    = validator.Validate(cmd);

                Assert.True(result.IsValid);
            }
Ejemplo n.º 2
0
            public void Validate_GivenFirstNameIsNull_ExpectValidationFailure()
            {
                var cmd = new Details.Model {
                    FirstName = null, LastName = "last-name"
                };
                var validator = new Details.Validator();
                var result    = validator.Validate(cmd);

                Assert.False(result.IsValid);
                Assert.Contains(
                    result.Errors,
                    failure => failure.PropertyName == "FirstName");
            }
Ejemplo n.º 3
0
            public void Validate_GivenLastNameIsEmpty_ExpectValidationFailure()
            {
                var cmd = new Details.Model {
                    FirstName = "first-name", LastName = string.Empty
                };
                var validator = new Details.Validator();
                var result    = validator.Validate(cmd);

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