public static bool AssertIsInvalid(string email, string message)
        {
            if (!Regex.IsMatch(email, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase))
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public static bool AssertArgumentContainsElement <T>(object list, string message)
        {
            if (list == null || !(list is IEnumerable) || ((List <T>)list).Count == 0)
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public static bool AssertArgumentGreaterThanZero(int value, string message)
        {
            if (value <= 0)
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 4
0
        public static bool AssertArgumentNotNull(object object1, string message)
        {
            if (object1 == null)
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 5
0
        public static bool AssertArgumentNotEquals(object object1, object object2, string message)
        {
            if (!object1.Equals(object2))
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 6
0
        public static bool AssertArgumentEmpty(string stringValue, string message)
        {
            if (stringValue == null || stringValue.Trim().Length == 0)
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        public static bool AssertArgumentRangeNumeric(int value, int min, int max, string message)
        {
            if (value < min || value > max)
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }
Esempio n. 8
0
        public static bool AssertArgumentLength(string stringValue, int maximum, string message)
        {
            int length = stringValue.Trim().Length;

            if (length > maximum)
            {
                DomainValidationManagement.Add(new DomainValidation(message));
                return(false);
            }

            return(true);
        }