public CustomerName(string value)
        {
            if (value == string.Empty)
            {
                InvalidCustomerNameException.FromEmpty();
            }

            if (value.Length > MAX_LENGHT)
            {
                InvalidCustomerNameException.FromMaxLenght();
            }

            this.value = value;
        }
Example #2
0
        private bool IsNotValid(string customerName)
        {
            try
            {
                if (customerName.Length == 0)
                {
                    InvalidCustomerNameException.FromEmpty();
                    return(true);
                }

                if (customerName.Length > CustomerName.MAX_SIZE)
                {
                    InvalidCustomerNameException.FromMaxLength();
                    return(true);
                }

                return(false);
            }
            catch
            {
                return(true);
            }
        }