internal void Validate()
        {
            var format = TextBoxValidationExtensions.GetFormat(_textBox);

            var expectNonEmpty = format.HasFlag(ValidTextBoxFormats.NonEmpty);
            var isEmpty        = String.IsNullOrWhiteSpace(_textBox.Text);

            if (expectNonEmpty && isEmpty)
            {
                MarkInvalid();
                return;
            }

            var expectNumber = format.HasFlag(ValidTextBoxFormats.Numeric);

            if (expectNumber &&
                !isEmpty &&
                !IsNumeric())
            {
                MarkInvalid();
                return;
            }

            var expectPhone = format.HasFlag(ValidTextBoxFormats.Phone);

            if (expectPhone)
            {
                if (!isEmpty)
                {
                    IEnumerable <string> phones = PhoneNumbersInputParser.Parse(_textBox.Text);

                    string convertedNumber = String.Empty;
                    bool   isValid         = phones.All(number => PhoneNumberConverter.ConvertToIsdn(number, ref convertedNumber));

                    if (isValid)
                    {
                        MarkValid();
                    }
                    else
                    {
                        MarkInvalid();
                    }
                }
                else
                {
                    MarkInvalid();
                }

                return;
            }

            MarkValid();
        }
 /// <summary>
 /// Get array of <see cref="PhoneNumber"/> from PhoneNumbers property
 /// </summary>
 /// <returns>Array of <see cref="PhoneNumber"/></returns>
 protected IEnumerable <PhoneNumber> GetPhoneNumbers()
 {
     return(PhoneNumbersInputParser.Parse(PhoneNumbers).Select(x => PhoneNumberIsdnFormatValidator.ConvertToIsdn(x)).Distinct().Select(x => new PhoneNumber(x)));
 }