public static FluentValidation When <TValidator>
            (this ValidationCollected validationCollected,
            TValidator subject,
            Expression <Func <TValidator, bool> > expressionProperty)
        {
            Func <TValidator, bool> func = expressionProperty.Compile();
            bool hasValidation           = func(subject);

            return(new FluentValidation(validationCollected, hasValidation));
        }
Exemple #2
0
        public ValidationCollected WithMessage(string message)
        {
            _message = message;

            //collect validation
            if (_validationCollected == null)
            {
                _validationCollected = new ValidationCollected();
            }

            //Only store invalid values, in-case want to get all message
            _validationCollected.Add(_hasValidation, _validateFuncs, _message);


            return(_validationCollected);
        }
Exemple #3
0
 public FluentValidation(ValidationCollected validationCollected, bool hasValidation)
 {
     _hasValidation       = hasValidation;
     _validationCollected = validationCollected;
     _validateFuncs       = new List <Func <bool> >();
 }