Exemple #1
0
 /// <summary>
 /// The method validates whether a supplied object is not a null, whitespace or empty.
 /// </summary>
 /// <param name="objectToValidate">An object to be valdiated.</param>
 /// <returns>True - if object is valid, false - if object is invalid.</returns>
 public override bool Validate(object objectToValidate)
 {
     return(ValidateDataProperties.IsExists(objectToValidate));
 }
        public void ShouldReturnFalseForReferenceType()
        {
            object testValue = new object();

            Assert.IsFalse(ValidateDataProperties.IsExists(testValue));
        }
        public void ShouldReturnFalseForWhitespaceString()
        {
            string testValue = "";

            Assert.IsFalse(ValidateDataProperties.IsExists(testValue));
        }
        public void ShouldReturnFalseForEmptyString()
        {
            string testValue = string.Empty;

            Assert.IsFalse(ValidateDataProperties.IsExists(testValue));
        }
        public void ShouldReturnTrueForStringType()
        {
            string testValue = "Some string";

            Assert.IsTrue(ValidateDataProperties.IsExists(testValue));
        }
        public void ShouldReturnTrueForValueType()
        {
            int testValue = 1;

            Assert.IsTrue(ValidateDataProperties.IsExists(testValue));
        }