public void TestValidInternationalAddresses() { for (int i = 0; i < ValidInternationalAddresses.Length; i++) { Assert.IsTrue(EmailValidator.Validate(ValidInternationalAddresses[i], true, true), "Valid International Address #{0}", i); } }
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]); } }
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]); } }
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)); }
public void TestThrowsExceptionIfNull() { Assert.Throws <ArgumentNullException> (() => EmailValidator.Validate(null, true, true), "Null Address"); }
public void TestValidationQuoteWithoutEnd() { const string email = "\"*****@*****.**"; Assert.IsFalse(EmailValidator.Validate(email, false, false)); }
public void TestValidationQuoteWithNotAsciAndNotInternational() { const string email = "\"á\"@example.com"; Assert.IsFalse(EmailValidator.Validate(email, false, false)); }
public void TestValidationIpv6LessThanTwoColons() { const string email = "teszt@[IPv6:1111:1111]"; Assert.IsFalse(EmailValidator.Validate(email)); }
public void TestValidationIpv6WithWrongIpv4() { const string email = "teszt@[IPv6:aaaa:aaaa:aaaa:aaaa:aaaa:aaaa:555.666.777.888]"; Assert.IsFalse(EmailValidator.Validate(email)); }
public void TestValidationIpv6MissingClosingBracket() { const string email = "teszt@[IPv6:2607:f0d0:1002:51::4"; Assert.IsFalse(EmailValidator.Validate(email)); }
public void TestValidationNotAllowTopLevelDomains() { const string email = "A@b@[email protected]"; Assert.IsFalse(EmailValidator.Validate(email, false)); }
public void TestValidationMissingClosingBracket() { const string email = "aaa@[111.111.111.111"; Assert.IsFalse(EmailValidator.Validate(email)); }
public void TestValidationShortIpv4() { const string email = "a@[]."; Assert.IsFalse(EmailValidator.Validate(email)); }
public void TestValidationIncorrectLength0() { Assert.IsFalse(EmailValidator.Validate("")); }
public void TestValidationCorrectLength() { Assert.IsTrue(EmailValidator.Validate("*****@*****.**")); }
public void TestInvalidAddressTopLevelDomain() { Assert.IsFalse(EmailValidator.Validate("invalid@tld"), "Top-level domains not allowed."); }