Exemple #1
0
 public void TestValidInternationalAddresses()
 {
     for (int i = 0; i < ValidInternationalAddresses.Length; i++)
     {
         Assert.IsTrue(EmailValidator.Validate(ValidInternationalAddresses[i], true, true), "Valid International Address #{0}", i);
     }
 }
Exemple #2
0
 public void TestInvalidAddresses()
 {
     for (int i = 0; i < InvalidAddresses.Length; i++)
     {
         Assert.IsFalse(EmailValidator.Validate(InvalidAddresses[i], true), "Invalid Address #{0}: {1}", i, InvalidAddresses[i]);
     }
 }
Exemple #3
0
 public void TestValidAddresses()
 {
     for (int i = 0; i < ValidAddresses.Length; i++)
     {
         Assert.IsTrue(EmailValidator.Validate(ValidAddresses[i], true), "Valid Address #{0}: {1}", i, ValidAddresses[i]);
     }
 }
Exemple #4
0
        public void TestValidationIncorrectLengthTooLong()
        {
            const string emailEnd = "@test.com";

            var tooLongString = "";

            for (var i = 0; i < 1000; i++)
            {
                tooLongString += "a";
            }


            Assert.IsFalse(EmailValidator.Validate(tooLongString + emailEnd));
        }
Exemple #5
0
 public void TestThrowsExceptionIfNull()
 {
     Assert.Throws <ArgumentNullException> (() => EmailValidator.Validate(null, true, true), "Null Address");
 }
Exemple #6
0
        public void TestValidationQuoteWithoutEnd()
        {
            const string email = "\"*****@*****.**";

            Assert.IsFalse(EmailValidator.Validate(email, false, false));
        }
Exemple #7
0
        public void TestValidationQuoteWithNotAsciAndNotInternational()
        {
            const string email = "\"á\"@example.com";

            Assert.IsFalse(EmailValidator.Validate(email, false, false));
        }
Exemple #8
0
        public void TestValidationIpv6LessThanTwoColons()
        {
            const string email = "teszt@[IPv6:1111:1111]";

            Assert.IsFalse(EmailValidator.Validate(email));
        }
Exemple #9
0
        public void TestValidationIpv6WithWrongIpv4()
        {
            const string email = "teszt@[IPv6:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:555.666.777.888]";

            Assert.IsFalse(EmailValidator.Validate(email));
        }
Exemple #10
0
        public void TestValidationIpv6MissingClosingBracket()
        {
            const string email = "teszt@[IPv6:2607:f0d0:1002:51::4";

            Assert.IsFalse(EmailValidator.Validate(email));
        }
Exemple #11
0
        public void TestValidationNotAllowTopLevelDomains()
        {
            const string email = "A@b@[email protected]";

            Assert.IsFalse(EmailValidator.Validate(email, false));
        }
Exemple #12
0
        public void TestValidationMissingClosingBracket()
        {
            const string email = "aaa@[111.111.111.111";

            Assert.IsFalse(EmailValidator.Validate(email));
        }
Exemple #13
0
        public void TestValidationShortIpv4()
        {
            const string email = "a@[].";

            Assert.IsFalse(EmailValidator.Validate(email));
        }
Exemple #14
0
 public void TestValidationIncorrectLength0()
 {
     Assert.IsFalse(EmailValidator.Validate(""));
 }
Exemple #15
0
 public void TestValidationCorrectLength()
 {
     Assert.IsTrue(EmailValidator.Validate("*****@*****.**"));
 }
Exemple #16
0
 public void TestInvalidAddressTopLevelDomain()
 {
     Assert.IsFalse(EmailValidator.Validate("invalid@tld"), "Top-level domains not allowed.");
 }