/// <summary> /// Checks if value is not match regex /// </summary> public static IValidationCondition <string> IsNotMatch( this IValidationCondition <string> condition, string regex, RegexOptions options = RegexOptions.None) { return(condition.IsNot(value => Regex.IsMatch(value, regex, options))); }
/// <summary> /// Checks value is not in range (min: inclusive, max: exclusive) /// </summary> public static IValidationCondition <TValue> IsNotInRange <TValue>( this IValidationCondition <TValue> condition, TValue min, TValue max) where TValue : IComparable <TValue> { return(condition.IsNot(value => value.CompareTo(min) >= 0 && value.CompareTo(max) < 0)); }
/// <summary> /// Checks if value is not valid /// </summary> public static IValidationCondition <TValue> IsNot <TValue>( this IValidationCondition <TValue> condition, Func <TValue, bool> predicate) { return(condition.IsNot(() => predicate(condition.Value))); }
/// <summary> /// Checks values has a value /// </summary> public static IValidationCondition <TValue> IsNotIn <TValue>( this IValidationCondition <TValue> condition, params TValue[] values) { return(condition.IsNot(value => values.Contains(condition.Value))); }
/// <summary> /// Checks values has a value /// </summary> public static IValidationCondition <TValue> IsNotIn <TValue>( this IValidationCondition <TValue> condition, IEnumerable <TValue> values) { return(condition.IsNot(value => values.Contains(condition.Value))); }
/// <summary> /// Checks value is false /// </summary> public static IValidationCondition <bool> IsFalse( this IValidationCondition <bool> condition) { return(condition.IsNot(value => value)); }
/// <summary> /// Checks collection is not contains /// </summary> public static IValidationCondition <ICollection <TElement> > IsNotContains <TElement>( this IValidationCondition <ICollection <TElement> > condition, TElement element) { return(condition.IsNot(value => value?.Contains(element) ?? false)); }
/// <summary> /// Checks collection has count not /// </summary> public static IValidationCondition <ICollection <TElement> > HasCountNot <TElement>( this IValidationCondition <ICollection <TElement> > condition, int count) { return(condition.IsNot(value => value?.Count == count)); }
/// <summary> /// Checks if value is not valid email string /// </summary> public static IValidationCondition <string> IsNotEmail( this IValidationCondition <string> condition) { return(condition.IsNot(value => EmailAddress.IsValid(value))); }
public static IValidationCondition <string> IsNotNullOrWhitespace( this IValidationCondition <string> condition) { return(condition.IsNot(string.IsNullOrWhiteSpace)); }
/// <summary> /// Checks if value is not whitespace /// </summary> public static IValidationCondition <string> IsNotWhitespace( this IValidationCondition <string> condition) { return(condition.IsNot(value => value?.All(x => char.IsWhiteSpace(x)) ?? false)); }
public static IValidationCondition <string> IsNotEmpty( this IValidationCondition <string> condition, StringComparison stringComparison = StringComparison.InvariantCulture) { return(condition.IsNot(value => value.Equals(string.Empty, stringComparison))); }
/// <summary> /// Checks if value is not valid url string /// </summary> public static IValidationCondition <string> IsNotUrl( this IValidationCondition <string> condition, UriKind kind = UriKind.Absolute) { return(condition.IsNot(value => Uri.TryCreate(condition.Value, kind, out _))); }
/// <summary> /// Checks not all elements suites for predicate /// </summary> public static IValidationCondition <IEnumerable <TElement> > IsNotAll <TElement>( this IValidationCondition <IEnumerable <TElement> > condition, Func <TElement, bool> predicate) { return(condition.IsNot(value => value?.All(predicate) ?? false)); }
/// <summary> /// Checks enumerable has no elements /// </summary> public static IValidationCondition <IEnumerable <TElement> > IsNotAny <TElement>( this IValidationCondition <IEnumerable <TElement> > condition) { return(condition.IsNot(value => value?.Any() ?? false)); }
/// <summary> /// Checks DateTime kind not /// </summary> public static IValidationCondition <DateTime> IsNotDateTimeKind( this IValidationCondition <DateTime> validationCondition, DateTimeKind dateTimeKind) { return(validationCondition.IsNot(value => value.Kind == dateTimeKind)); }