public void TestMailboxUnavailable()
        {
            MailVerify mailVerify = new MailVerify();

            ValidationStatus result = mailVerify.Validate("*****@*****.**");

            Assert.AreEqual(ValidationStatus.MailboxUnavailable, result);
        }
Exemple #2
0
        private void btnValidate_Click(object sender, EventArgs e)
        {
            MailVerify mailVerify = new MailVerify();

            if (!string.IsNullOrEmpty(txtEmail.Text))
            {
                MessageBox.Show(mailVerify.Validate(txtEmail.Text).ToString());
            }
        }
        public void TestNoMailForDomain()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "*****@*****.**",
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                Assert.AreEqual(ValidationStatus.NoMailForDomain, result, email);
            }
        }
        public void TestUnableToTest()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "*****@*****.**",
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                Assert.AreEqual(ValidationStatus.MailServerUnavailable, result, email);
            }
        }
        public void TestAddressIsEmpty()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "",
                "  ",
                null,
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                Assert.AreEqual(ValidationStatus.AddressIsEmpty, result, email);
            }
        }
        public void TestInvalidDomain()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "*****@*****.**",
                "*****@*****.**",
                "mail@по-кружке.рф",
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                Assert.AreEqual(ValidationStatus.NoMailForDomain, result, email);
            }
        }
        public void TestInvalidFormat()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "mail.zelbike1.ru",
                "adoconnec [email protected]",
                "adoconnection@yandex1@",
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                Assert.AreEqual(ValidationStatus.InvalidFormat, result, email);
            }
        }
        public void TestDisposableMail()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**",
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                Assert.AreEqual(ValidationStatus.MailboxIsDisposable, result, email);
            }
        }
        public void TestAvailable()
        {
            MailVerify mailVerify = new MailVerify();

            IList <string> emails = new List <string>()
            {
                "*****@*****.**",
                "*****@*****.**",
                "*****@*****.**",
            };

            foreach (string email in emails)
            {
                ValidationStatus result = mailVerify.Validate(email);

                if (result != ValidationStatus.OK)
                {
                    Assert.Fail("Unable to test " + email);
                }

                Assert.AreEqual(ValidationStatus.OK, result, email);
            }
        }
Exemple #10
0
        public static bool MailVerify(this string email)
        {
            MailVerify mailVerify = new MailVerify();

            return(mailVerify.Validate(email) == ValidationStatus.OK);
        }
Exemple #11
0
        public static ValidationStatus MailValidate(this string email)
        {
            MailVerify mailVerify = new MailVerify();

            return(mailVerify.Validate(email));
        }