예제 #1
0
        private ValidationMessage LessThan <TProp>(
            TProp value,
            TProp valueToCompare,
            IComparer comparer = null,
            ValidationMessageType validationMessageType = ValidationMessageType.Error)
            where TProp : IComparable <TProp>
        {
            var lessThanValidator = new LessThanValidator <TestValidatableObject, TProp>(_ => valueToCompare, comparer, validationMessageType);
            var context           = new ValidationContext <TestValidatableObject, TProp>(null, nameof(TestValidatableObject.Number), null, value);
            var validationMessage = lessThanValidator.ValidateProperty(context).FirstOrDefault();

            return(validationMessage);
        }