Пример #1
0
        public static void Validate(this OwnerCode ownerCode)
        {
            var isValid = ownerCode.IsValid();

            if (!isValid.Value)
            {
                throw new ArgumentException(isValid.Message, nameof(ownerCode));
            }
        }
        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);
        }
Пример #3
0
        /// <summary>
        /// Returns <see cref="OwnerCode.Invalid"/> if invalid.
        /// </summary>
        public static DescribedResult <bool> TryValidate(UnvalidatedOwnerCode unvalidatedOwnerCode, out OwnerCode ownerCode)
        {
            var isValid = Utilities.IsValid(unvalidatedOwnerCode);

            if (isValid.Value)
            {
                ownerCode = new OwnerCode(unvalidatedOwnerCode.Value);
            }
            else
            {
                ownerCode = OwnerCode.Invalid;
            }

            return(isValid);
        }
Пример #4
0
        public static DescribedResult <bool> IsValid(OwnerCode ownerCode)
        {
            var output = Utilities.IsValidOwnerCode(ownerCode.Value);

            return(output);
        }
        public static ContainerIdentification NewFrom(OwnerCode ownerCode, EquipmentCategory equipmentCategory, SerialNumber serialNumber)
        {
            var containerIdentification = new ContainerIdentification().From(ownerCode, equipmentCategory, serialNumber);

            return(containerIdentification);
        }
Пример #6
0
        public static DescribedResult <bool> TryValidate(this UnvalidatedOwnerCode unvalidatedOwnerCode, out OwnerCode ownerCode)
        {
            var isValid = Utilities.TryValidate(unvalidatedOwnerCode, out ownerCode);

            return(isValid);
        }