Ejemplo n.º 1
0
        public void ShouldReturnTrueForCorrectEmail()
        {
            string[] testValues = new string[] { "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" };

            foreach (string item in testValues)
            {
                Assert.IsTrue(ValidateRegex.IsEmail(item));
            }
        }
Ejemplo n.º 2
0
        public void ShouldReturnFalseForIncorrectEmail()
        {
            string[] testValues = new string[] { "jan.kowalski", "jan@kowalski", "jan@kowalski@com" };

            foreach (string item in testValues)
            {
                Assert.IsFalse(ValidateRegex.IsEmail(item));
            }
        }
Ejemplo n.º 3
0
        public void ShouldReturnFalseForValueType()
        {
            decimal testValue = 12345;

            Assert.IsFalse(ValidateRegex.IsEmail(testValue));
        }
Ejemplo n.º 4
0
        public void ShouldReturnFalseForEmptyObject()
        {
            object testValue = new object();

            Assert.IsFalse(ValidateRegex.IsEmail(testValue));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// The method validates whether a supplied object is valid against an email pattern.
 /// </summary>
 /// <param name="objectToValidate">An object to be valdiated against regex pattern of an email address.</param>
 /// <returns>True - if object is valid, false - if object is invalid.</returns>
 public override bool Validate(object objectToValidate)
 {
     return(ValidateRegex.IsEmail(objectToValidate, pattern));
 }