コード例 #1
0
        /// <summary>
        /// Adds a validation message if the current validatable object is not within range.
        /// </summary>
        /// <param name="valObj">The value object.</param>
        /// <param name="min"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        public static FluentValidationObject <IEnumerable <T> > IsWithinRange <T>(
            this FluentValidationObject <IEnumerable <T> > valObj,
            int min,
            int max
            )
        {
            valObj.IsBiggerThen(min - 1);
            valObj.IsSmallerThen(max + 1);

            return(valObj);
        }
コード例 #2
0
        /// <summary>
        /// Adds a validation message if the current validatable object is not within range.
        /// </summary>
        /// <param name="valObj">The value object.</param>
        /// <param name="min"></param>
        /// <param name="max"></param>
        /// <returns></returns>
        public static FluentValidationObject <T> IsBetween <T>(
            this FluentValidationObject <T> valObj,
            T min,
            T max
            )
            where T : IComparable <T>
        {
            valObj.IsBiggerThen(min);
            valObj.IsSmallerThen(max);

            return(valObj);
        }