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); }
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"); }
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"); }