protected override ValidationResult?IsValid(object?value, ValidationContext validationContext) { var spaceSeparatedExpressions = value?.ToString(); if (string.IsNullOrWhiteSpace(spaceSeparatedExpressions)) { return(ValidationResult.Success); } var expressions = spaceSeparatedExpressions.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (var expression in expressions) { if (!GlobExpression.IsValid(expression)) { return(new ValidationResult("Invalid expression.")); } } return(ValidationResult.Success); }
public void IsValid(string expression, bool isPositive) { GlobExpression.IsValid(expression).Should().Be(isPositive); }