public void Throws_ValidationException_DateOfBirth_Default()
        {
            // Arrange
            var sut = new CreateContactValidator();
            var cmd = new CreateContactCommand {
                Name = "A", Address = "A"
            };

            // Act
            var result = sut.Validate(cmd);

            // Assert
            Assert.False(result.IsValid);
            Assert.Contains(result.Errors, e => e.PropertyName == nameof(cmd.DateOfBirth));
        }
        public void Throws_ValidationException_Address_Empty()
        {
            // Arrange
            var sut = new CreateContactValidator();
            var cmd = new CreateContactCommand {
                Name = "A", Address = string.Empty, DateOfBirth = DateTime.Now
            };

            // Act
            var result = sut.Validate(cmd);

            // Assert
            Assert.False(result.IsValid);
            Assert.Contains(result.Errors, e => e.PropertyName == nameof(cmd.Address));
        }
        public void Validation_OK()
        {
            // Arrange
            var sut = new CreateContactValidator();
            var cmd = new CreateContactCommand {
                Name = "A", Address = "A", DateOfBirth = DateTime.Now.AddDays(-1)
            };

            // Act
            var result = sut.Validate(cmd);

            // Assert
            Assert.True(result.IsValid);
            Assert.Empty(result.Errors);
        }
        public void Throws_ValidationException_Address_Too_Long()
        {
            // Arrange
            var sut = new CreateContactValidator();
            var cmd = new CreateContactCommand
            {
                Name        = "A",
                Address     = new String('0', Constants.MaxLengths.ContactName + 1),
                DateOfBirth = DateTime.Now
            };

            // Act
            var result = sut.Validate(cmd);

            // Assert
            Assert.False(result.IsValid);
            Assert.Contains(result.Errors, e => e.PropertyName == nameof(cmd.Address));
        }