public void WhenEmailsAreCorrectAsync() { List <string> emails = new List <string>() { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "[email protected]", "email@[123.123.123.123]", "“email”@example.com", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" }; foreach (string item in emails) { Assert.DoesNotThrow(() => EmailValidator.ValidateEmailAsync(item)); } }
public void WhenEmailIsTooLongAsync() { string longmail = "a"; for (int i = 0; i < 256; i++) { longmail += "a"; } Assert.Throws <ArgumentOutOfRangeException>(() => EmailValidator.ValidateEmailAsync(longmail)); }
public void WhenEmailContainsAtInAddressAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("email@[email protected]")); }
public void WhenEmailContainsDomainOnlyAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("email.example.com")); }
public void WhenEmailAddressIsNullAsync() { Assert.Throws <ArgumentNullException>(() => EmailValidator.ValidateEmailAsync("@example.com")); }
public void WhenEmailConsistsOfInvalidCharactersAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("#@%^%#$@#$@#.com")); }
public void WhenEmailDomainPartIsInvalidIpAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("[email protected]")); }
public void WhenEmailDomainPartContainsGraterThanAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("Joe Smith <*****@*****.**>")); }
public void WhenEmailDomainPartContainsSpaceAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("[email protected] (Joe Smith)")); }
public void WhenEmailDomainPartStartsWithInvalidCharacterAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("*****@*****.**")); }
public void WhenEmailDomainPartNotContainDotAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("email@example")); }
public void WhenEmailDoesNotHaveAtCharacterAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("plainaddress")); }
public void WhenEmailIsNullAsync() { Assert.Throws <ArgumentNullException>(() => EmailValidator.ValidateEmailAsync(null)); }
public void WhenEmailContainsInvalidCharactersInAddressAsync() { Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("あいうえお@example.com")); }