public static void IsLt <T>(this Param <T> param, T limit, IComparer <T> comparer) { if (!Ensure.IsActive) { return; } if (!param.Value.IsLt(limit, comparer)) { throw ExceptionFactory.CreateForComparableParamValidation(param, ExceptionMessages.Comp_IsNotLt.Inject(param.Value, limit)); } }
public static void IsLte <T>(this Param <T> param, T limit) where T : IComparable <T> { if (!Ensure.IsActive) { return; } if (param.Value.IsGt(limit)) { throw ExceptionFactory.CreateForComparableParamValidation(param, ExceptionMessages.Comp_IsNotLte.Inject(param.Value, limit)); } }
public static void IsInRange <T>(this Param <T> param, T min, T max, IComparer <T> comparer) { if (!Ensure.IsActive) { return; } if (param.Value.IsLt(min, comparer)) { throw ExceptionFactory.CreateForComparableParamValidation(param, ExceptionMessages.Comp_IsNotInRange_ToLow.Inject(param.Value, min)); } if (param.Value.IsGt(max, comparer)) { throw ExceptionFactory.CreateForComparableParamValidation(param, ExceptionMessages.Comp_IsNotInRange_ToHigh.Inject(param.Value, max)); } }