public static CheckDigitString ToString(CheckDigit checkDigit) { var unvalidatedCheckDigitString = Utilities.ToUnvalidatedString(checkDigit); var checkDigitString = Utilities.Validate(unvalidatedCheckDigitString); return(checkDigitString); }
public static UnvalidatedCheckDigitString ToUnvalidatedString(CheckDigit checkDigit) { var unvalidatedCheckDigitStringValue = Utilities.DefaultCheckDigitToStringConverter(checkDigit.Value); var unvalidatedCheckDigitString = new UnvalidatedCheckDigitString(unvalidatedCheckDigitStringValue); return(unvalidatedCheckDigitString); }
public static void Validate(this CheckDigit checkDigit) { var isValid = checkDigit.IsValid(); if (!isValid.Value) { throw new ArgumentException(isValid.Message, nameof(checkDigit)); } }
public static CheckedContainerIdentification From(this CheckedContainerIdentification containerIdentification, OwnerCode ownerCode, EquipmentCategory equipmentCategory, SerialNumber serialNumber, CheckDigit checkDigit) { containerIdentification.OwnerCode = ownerCode; containerIdentification.EquipmentCategory = equipmentCategory; containerIdentification.SerialNumber = serialNumber; containerIdentification.CheckDigit = checkDigit; return(containerIdentification); }
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(this CheckDigit checkDigit) { var output = Utilities.IsValid(checkDigit); return(output); }
public static CheckedContainerIdentification NewFrom(OwnerCode ownerCode, EquipmentCategory equipmentCategory, SerialNumber serialNumber, CheckDigit checkDigit) { var containerIdentification = new CheckedContainerIdentification().From(ownerCode, equipmentCategory, serialNumber, checkDigit); return(containerIdentification); }