Пример #1
0
 /// <summary>
 /// Sets initial value from code behind. If isRequired is true, user needs to change the value before saving is possible.
 /// If isRequired is null, IsRequired will not be changed.
 /// </summary>
 public override void Initialise(string?text = null, bool?isRequired = false)
 {
     if (!string.IsNullOrEmpty(text) && !EmailValidator.IsValidEmail(text))
     {
         throw new Exception($"Error EmailTextBox.Initialise(): '{text}' is not a valid email address).");
     }
     base.Initialise(text, isRequired);
 }
Пример #2
0
        //      --------------

        protected override void OnTextBoxInitialized()
        {
            //verify the values set in XAML
            if (Text.Length > 0 && !EmailValidator.IsValidEmail(Text))
            {
                throw new Exception($"Error EmailTextBox: '{Text}' is not a valid email address).");
            }
        }
Пример #3
0
 public void TestIsValidDnsChar()
 {
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('\x00'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('\x1F'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('!'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('"'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('#'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('$'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('%'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('&'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('\''));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('('));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault(')'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('*'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('+'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault(','));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('-'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('.'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('/'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault(' '));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('0'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('1'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('8'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('9'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault(':'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault(';'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('<'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('='));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('>'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('?'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('@'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('A'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('B'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('Y'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('Z'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('['));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('\\'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault(']'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('^'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('_'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('`'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('a'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('b'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('y'));
     Assert.IsTrue(EmailValidator.IsValidEmailDnsDefault('z'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('{'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('|'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('}'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('~'));
     Assert.IsFalse(EmailValidator.IsValidEmailDnsDefault('\x7F'));
 }
Пример #4
0
        public void TestEmailAdr()
        {
            //default settings, must be reapplied because another test might have changed them
            EmailValidator.SetAsciiSpecialCharsDefault();
            EmailValidator.IsBlankAllowed = false;
            EmailValidator.IsInternationalCharSetAllowed = false;
            Assert.IsFalse(EmailValidator.IsValidEmail(""));
            Assert.IsFalse(EmailValidator.IsValidEmail("@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@b"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@b."));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("@b.cd"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ab.cd@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail(new string('a', 64) + "@" + "a." + new string('a', 255 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail(new string('a', 64) + "@" + "a." + new string('a', 256 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail(new string('a', 65) + "@" + "a." + new string('a', 255 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a#[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a&[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a'*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a*[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a/[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a^[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a`[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a{[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a|[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a}[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a\"*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a([email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a)[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a,[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a:[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a;[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a<*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a>[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a[[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a\\[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a][email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("\"a Z\"@b.cd"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ABC@[192.168.0.1]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ABC@[IPv6:2001:db8:1ff::a0b:dbd0]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("试.یشی@XN--0ZWM56D.XN--HGBK6AJ7F53BBA"));

            EmailValidator.SetExtendedAsciiSpecialChars();
            Assert.IsFalse(EmailValidator.IsValidEmail(""));
            Assert.IsFalse(EmailValidator.IsValidEmail("@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@b"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@b."));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("@b.cd"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ab.cd@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail(new string('a', 64) + "@" + "a." + new string('a', 255 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail(new string('a', 64) + "@" + "a." + new string('a', 256 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail(new string('a', 65) + "@" + "a." + new string('a', 255 - 2)));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a#[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a&[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a'*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a*[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a/[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a^[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a`[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a{[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a|[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a}[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a\"*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a([email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a)[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a,[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a:[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a;[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a<*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a>[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a[[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a\\[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a][email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("\"a Z\"@b.cd"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ABC@[192.168.0.1]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ABC@[IPv6:2001:db8:1ff::a0b:dbd0]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("试.یشی@XN--0ZWM56D.XN--HGBK6AJ7F53BBA"));

            EmailValidator.SetExtendedQuotedAsciiSpecialChars();
            EmailValidator.IsBlankAllowed = true;
            Assert.IsFalse(EmailValidator.IsValidEmail(""));
            Assert.IsFalse(EmailValidator.IsValidEmail("@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@b"));
            Assert.IsFalse(EmailValidator.IsValidEmail("a@b."));
            Assert.IsFalse(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("@b.cd"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ab.cd@"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsFalse(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail(new string('a', 64) + "@" + "a." + new string('a', 255 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail(new string('a', 64) + "@" + "a." + new string('a', 256 - 2)));
            Assert.IsFalse(EmailValidator.IsValidEmail(new string('a', 65) + "@" + "a." + new string('a', 255 - 2)));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a#[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a&[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a'*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a*[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a/[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a^[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a`[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a{[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a|[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a}[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a\"*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a([email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a)[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a,[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a:[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a;[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a<*****@*****.**"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a>[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a[[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a\\[email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("a][email protected]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("\"a Z\"@b.cd"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ABC@[192.168.0.1]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("ABC@[IPv6:2001:db8:1ff::a0b:dbd0]"));
            Assert.IsTrue(EmailValidator.IsValidEmail("[email protected]"));
            Assert.IsFalse(EmailValidator.IsValidEmail("试.یشی@XN--0ZWM56D.XN--HGBK6AJ7F53BBA"));

            EmailValidator.IsInternationalCharSetAllowed = true;
            Assert.IsTrue(EmailValidator.IsValidEmail("试.یشی@XN--0ZWM56D.XN--HGBK6AJ7F53BBA"));
        }
Пример #5
0
        public void TestEmailChar()
        {
            //default settings, must be reapplied because another test might have changed them
            EmailValidator.SetAsciiSpecialCharsDefault();
            EmailValidator.IsBlankAllowed = false;
            EmailValidator.IsInternationalCharSetAllowed = false;
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x00'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x1F'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('!'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('"'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('#'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('$'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('%'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('&'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\''));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('('));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(')'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('*'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('+'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(','));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('-'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('.'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('/'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(' '));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('0'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('1'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('8'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('9'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(':'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(';'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('<'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('='));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('>'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('?'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('@'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('A'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('B'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('Y'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('Z'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('['));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\\'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(']'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('^'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('_'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('`'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('a'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('b'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('y'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('z'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('{'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('|'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('}'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('~'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x7F'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('试'));

            EmailValidator.SetExtendedAsciiSpecialChars();
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x00'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x1F'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('!'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('"'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('#'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('$'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('%'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('&'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('\''));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('('));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(')'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('*'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('+'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(','));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('-'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('.'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('/'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(' '));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('0'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('1'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('8'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('9'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(':'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(';'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('<'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('='));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('>'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('?'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('@'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('A'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('B'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('Y'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('Z'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('['));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\\'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar(']'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('^'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('_'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('`'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('a'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('b'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('y'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('z'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('{'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('|'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('}'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('~'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x7F'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('试'));

            EmailValidator.SetExtendedQuotedAsciiSpecialChars();
            EmailValidator.IsBlankAllowed = true;
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x00'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x1F'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('!'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('"'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('#'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('$'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('%'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('&'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('\''));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('('));
            Assert.IsTrue(EmailValidator.IsValidEmailChar(')'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('*'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('+'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar(','));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('-'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('.'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('/'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar(' '));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('0'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('1'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('8'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('9'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar(':'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar(';'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('<'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('='));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('>'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('?'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('@'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('A'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('B'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('Y'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('Z'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('['));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('\\'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar(']'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('^'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('_'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('`'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('a'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('b'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('y'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('z'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('{'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('|'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('}'));
            Assert.IsTrue(EmailValidator.IsValidEmailChar('~'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('\x7F'));
            Assert.IsFalse(EmailValidator.IsValidEmailChar('试'));

            EmailValidator.IsInternationalCharSetAllowed = true;
            Assert.IsTrue(EmailValidator.IsValidEmailChar('试'));
        }