Example #1
0
        public static SerialNumber ToString(UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric)
        {
            var unvalidatedSerialNumber = Utilities.ToUnvalidatedString(unvalidatedSerialNumberNumeric);

            var serialNumber = Utilities.Validate(unvalidatedSerialNumber);

            return(serialNumber);
        }
Example #2
0
        public static UnvalidatedSerialNumberNumeric ToUnvalidatedNumeric(SerialNumber serialNumber)
        {
            var unvalidatedSerialNumberNumericValue = Utilities.DefaultSerialNumberToNumericConverter(serialNumber.Value);

            var unvalidatedSerialNumberNumeric = new UnvalidatedSerialNumberNumeric(unvalidatedSerialNumberNumericValue);

            return(unvalidatedSerialNumberNumeric);
        }
Example #3
0
        public static UnvalidatedSerialNumber ToUnvalidatedString(UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric)
        {
            var valueString = Utilities.DefaultSerialNumberToStringConverter(unvalidatedSerialNumberNumeric.Value);

            var unvalidatedSerialNumber = new UnvalidatedSerialNumber(valueString);

            return(unvalidatedSerialNumber);
        }
Example #4
0
        public static SerialNumberNumeric Validate(UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric)
        {
            var isValid = Utilities.TryValidate(unvalidatedSerialNumberNumeric, out var serialNumberNumeric);

            if (!isValid.Value)
            {
                throw new ArgumentException(isValid.Message, nameof(unvalidatedSerialNumberNumeric));
            }

            return(serialNumberNumeric);
        }
Example #5
0
        public static DescribedResult <bool> TryValidate(UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric, out SerialNumberNumeric serialNumberNumeric)
        {
            var isValid = Utilities.IsValid(unvalidatedSerialNumberNumeric);

            if (isValid.Value)
            {
                serialNumberNumeric = new SerialNumberNumeric(unvalidatedSerialNumberNumeric.Value);
            }
            else
            {
                serialNumberNumeric = SerialNumberNumeric.Invalid;
            }

            return(isValid);
        }
Example #6
0
        public static DescribedResult <bool> IsValid(UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric)
        {
            var output = Utilities.IsValidSerialNumber(unvalidatedSerialNumberNumeric.Value);

            return(output);
        }
        public static SerialNumberNumeric Validate(this UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric)
        {
            var serialNumberNumeric = Utilities.Validate(unvalidatedSerialNumberNumeric);

            return(serialNumberNumeric);
        }
        public static DescribedResult <bool> TryValidate(UnvalidatedSerialNumberNumeric unvalidatedSerialNumberNumeric, out SerialNumberNumeric serialNumberNumeric)
        {
            var isValid = Utilities.TryValidate(unvalidatedSerialNumberNumeric, out serialNumberNumeric);

            return(isValid);
        }