コード例 #1
0
        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));
            }
        }
コード例 #2
0
        public void WhenEmailIsTooLongAsync()
        {
            string longmail = "a";

            for (int i = 0; i < 256; i++)
            {
                longmail += "a";
            }
            Assert.Throws <ArgumentOutOfRangeException>(() => EmailValidator.ValidateEmailAsync(longmail));
        }
コード例 #3
0
 public void WhenEmailContainsAtInAddressAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("email@[email protected]"));
 }
コード例 #4
0
 public void WhenEmailContainsDomainOnlyAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("email.example.com"));
 }
コード例 #5
0
 public void WhenEmailAddressIsNullAsync()
 {
     Assert.Throws <ArgumentNullException>(() => EmailValidator.ValidateEmailAsync("@example.com"));
 }
コード例 #6
0
 public void WhenEmailConsistsOfInvalidCharactersAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("#@%^%#$@#$@#.com"));
 }
コード例 #7
0
 public void WhenEmailDomainPartIsInvalidIpAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("[email protected]"));
 }
コード例 #8
0
 public void WhenEmailDomainPartContainsGraterThanAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("Joe Smith <*****@*****.**>"));
 }
コード例 #9
0
 public void WhenEmailDomainPartContainsSpaceAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("[email protected] (Joe Smith)"));
 }
コード例 #10
0
 public void WhenEmailDomainPartStartsWithInvalidCharacterAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("*****@*****.**"));
 }
コード例 #11
0
 public void WhenEmailDomainPartNotContainDotAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("email@example"));
 }
コード例 #12
0
 public void WhenEmailDoesNotHaveAtCharacterAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("plainaddress"));
 }
コード例 #13
0
 public void WhenEmailIsNullAsync()
 {
     Assert.Throws <ArgumentNullException>(() => EmailValidator.ValidateEmailAsync(null));
 }
コード例 #14
0
 public void WhenEmailContainsInvalidCharactersInAddressAsync()
 {
     Assert.Throws <ArgumentException>(() => EmailValidator.ValidateEmailAsync("あいうえお@example.com"));
 }