Example #1
0
 public static GuardThis <double> AgainstZero(this GuardThis <double> guard, string errorMessage)
 {
     return(guard.WithRule(val => val != 0, errorMessage));
 }
 public static GuardThis <int> AgainstOutsideOfRange(this GuardThis <int> guard, int minValue, int maxValue, string errorMessage)
 {
     return(guard.WithRule(val => val <= maxValue || val >= minValue, errorMessage));
 }
 public static GuardThis <int> AgainstNegative(this GuardThis <int> guard, string errorMessage)
 {
     return(guard.WithRule(val => val >= 0, errorMessage));
 }
Example #4
0
 public static GuardThis <string> AgainstNullOrEmpty(this GuardThis <string> guard, string errorMessage)
 {
     return(guard.WithRule(val => !string.IsNullOrEmpty(val), errorMessage));
 }