Ejemplo n.º 1
0
        public void ShouldReturnFalseForIncorrectWebPageName()
        {
            string[] testValues = new string[] { "test.com.pl", "test.com", "some random text", string.Empty };

            foreach (string item in testValues)
            {
                Assert.IsFalse(ValidateRegex.IsWebPage(item));
            }
        }
Ejemplo n.º 2
0
        public void ShouldReturnTrueForCorrectWebPageName()
        {
            string[] testValues = new string[] { "www.test.com", "http://test.com", "https://test.com", "http://www.test.com", "https://www.test.com", "www.test.com.pl", "http://test.com.pl", "https://test.com.pl", "http://www.test.com.pl", "https://www.test.com.pl" };

            foreach (string item in testValues)
            {
                Assert.IsTrue(ValidateRegex.IsWebPage(item));
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// The method validates whether a supplied object is valid against a web page regex pattern.
 /// </summary>
 /// <param name="objectToValidate">An object to be valdiated against regex pattern of a web page address.</param>
 /// <returns>True - if object is valid, false - if object is invalid.</returns>
 public override bool Validate(object objectToValidate)
 {
     return(ValidateRegex.IsWebPage(objectToValidate, pattern));
 }
Ejemplo n.º 4
0
        public void Webpage_ShouldReturnFalseForValueType()
        {
            decimal testValue = 12345;

            Assert.IsFalse(ValidateRegex.IsWebPage(testValue));
        }
Ejemplo n.º 5
0
        public void Webpage_ShouldReturnFalseForEmptyObject()
        {
            object testValue = new object();

            Assert.IsFalse(ValidateRegex.IsWebPage(testValue));
        }