Exemple #1
0
        /// <summary>
        /// Creates a new validator.
        /// </summary>
        /// <param name="validations">The scope of the validator.</param>
        /// <param name="predicate">A predicate that's used to validate arguments.</param>
        /// <param name="description">A description of the validator.</param>
        /// <returns>An ArgumentValidator.</returns>
        public static ArgumentValidator <T> Create(ArgumentValidatorScope <T> scope, Func <T, bool> predicate, string description)
        {
            Guard.IsNotNull(scope, "scope");
            Guard.IsNotNull(predicate, "predicate");
            Guard.IsNotNullOrEmpty(description, "description");

            return(new PredicateArgumentValidator(scope)
            {
                Validation = predicate, DescriptionField = description
            });
        }
Exemple #2
0
 public PredicateArgumentValidator(ArgumentValidatorScope <T> scope)
     : base(scope)
 {
 }
Exemple #3
0
 public NotArgumentValidatorScope(ArgumentValidatorScope <T> parentValidations)
 {
     this.ParentValidations = parentValidations;
 }
Exemple #4
0
 protected ArgumentValidator(ArgumentValidatorScope <T> scope)
 {
     this.Scope = scope;
 }
 public static ArgumentValidator <T> Create <T>(ArgumentValidatorScope <T> scope, Func <T, bool> predicate, string description)
 {
     return(ArgumentValidator.Create(scope, predicate, description));
 }