public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess() { var cmd = new SecurityKeys.Model { Name = "name", Password = "******" }; var validator = new SecurityKeys.Validator(); var result = validator.Validate(cmd); Assert.True(result.IsValid); }
public void Validate_GivenPasswordIsEmpty_ExpectValidationFailure() { var cmd = new SecurityKeys.Model { Name = "name", Password = string.Empty }; var validator = new SecurityKeys.Validator(); var result = validator.Validate(cmd); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.PropertyName == "Password"); }
public void Validate_GivenNameIsNull_ExpectValidationFailure() { var cmd = new SecurityKeys.Model { Name = null, Password = "******" }; var validator = new SecurityKeys.Validator(); var result = validator.Validate(cmd); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.PropertyName == "Name"); }