public void Validate_GivenAllPropertiesAreValid_ExpectValidationSuccess() { var cmd = new VerifyAccountAndSetPasswordCommand("token", "new-password"); var validator = new VerifyAccountAndSetPasswordCommandValidator(); var result = validator.Validate(cmd); Assert.True(result.IsValid); }
public void Validate_GivenNewPasswordIsEmpty_ExpectValidationFailure() { var cmd = new VerifyAccountAndSetPasswordCommand("token", string.Empty); var validator = new VerifyAccountAndSetPasswordCommandValidator(); var result = validator.Validate(cmd); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.ErrorCode.Equals(ValidationCodes.FieldIsRequired) && failure.PropertyName == "NewPassword"); }
public void Validate_GivenTokenIsNull_ExpectValidationFailure() { var cmd = new VerifyAccountAndSetPasswordCommand(null, "new-password"); var validator = new VerifyAccountAndSetPasswordCommandValidator(); var result = validator.Validate(cmd); Assert.False(result.IsValid); Assert.Contains( result.Errors, failure => failure.ErrorCode.Equals(ValidationCodes.FieldIsRequired) && failure.PropertyName == "Token"); }