Esempio n. 1
0
 public static GuardThis <string> AgainstNullOrEmpty(this GuardThis <string> guard, string errorMessage)
 {
     return(guard.WithRule(val => !string.IsNullOrEmpty(val), errorMessage));
 }
Esempio n. 2
0
        public static GuardThis <string> AgainstNonIpAddressFormat(this GuardThis <string> guard, string errorMessage)
        {
            var match = Regex.Match(guard.Obj, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}");

            return(guard.WithRule(val => val.ToLowerInvariant() == "localhost" || match.Success, errorMessage));
        }