public static CheckDigitString ToString(UnvalidatedCheckDigit unvalidatedCheckDigit) { var unvalidatedCheckDigitString = Utilities.ToUnvalidatedString(unvalidatedCheckDigit); var checkDigitString = Utilities.Validate(unvalidatedCheckDigitString); return(checkDigitString); }
public static UnvalidatedCheckDigitString ToUnvalidatedString(UnvalidatedCheckDigit unvalidatedCheckDigit) { var unvalidatedCheckDigitStringValue = Utilities.DefaultCheckDigitToStringConverter(unvalidatedCheckDigit.Value); var unvalidatedCheckDigitString = new UnvalidatedCheckDigitString(unvalidatedCheckDigitStringValue); return(unvalidatedCheckDigitString); }
public static UnvalidatedCheckDigit ToUnvalidatedNumeric(CheckDigitString checkDigitString) { var unvalidatedCheckDigitValue = Utilities.DefaultCheckDigitToNumericConverter(checkDigitString.Value); var unvalidatedCheckDigit = new UnvalidatedCheckDigit(unvalidatedCheckDigitValue); return(unvalidatedCheckDigit); }
public static CheckDigit Validate(UnvalidatedCheckDigit unvalidatedCheckDigit) { var isValid = Utilities.TryValidate(unvalidatedCheckDigit, out var checkDigit); if (!isValid.Value) { throw new ArgumentException(isValid.Message, nameof(unvalidatedCheckDigit)); } return(checkDigit); }
public static DescribedResult <bool> TryValidate(UnvalidatedCheckDigit unvalidatedCheckDigit, out CheckDigit checkDigit) { var isValid = Utilities.IsValid(unvalidatedCheckDigit); if (isValid.Value) { checkDigit = new CheckDigit(unvalidatedCheckDigit.Value); } else { checkDigit = CheckDigit.Invalid; } return(isValid); }
public static DescribedResult <bool> IsValid(UnvalidatedCheckDigit unvalidatedCheckDigit) { var output = Utilities.IsValidCheckDigit(unvalidatedCheckDigit.Value); return(output); }