Esempio n. 1
0
        public static PersonalNumberVO Create(string input)
        {
            var instance = new PersonalNumberVO {
                Value = input
            };

            ValidateInstance(instance);

            return(instance);
        }
Esempio n. 2
0
        public static void ValidateInstance(PersonalNumberVO instance)
        {
            // Validations goes here

            if (
                string.IsNullOrWhiteSpace(instance.Value)
                ||
                instance.Value.Length != 11
                ||
                !Regex.Match(instance.Value, "^([0-9]+)$", RegexOptions.IgnoreCase).Success
                )
            {
                throw new DomainException(DomainExceptionCode.InvalidPersonalNumber);
            }
        }