예제 #1
0
 /// <summary>
 /// Determines if the specified value is in range lowerRangeLimit higherRangeLimit paramName.
 /// </summary>
 /// <returns><c>true</c> if is in range the specified value lowerRangeLimit higherRangeLimit paramName; otherwise, <c>false</c>.</returns>
 /// <param name="value">Value.</param>
 /// <param name="lowerRangeLimit">Lower range limit.</param>
 /// <param name="higherRangeLimit">Higher range limit.</param>
 /// <param name="paramName">Parameter name.</param>
 /// <typeparam name="TComparable">The 1st type parameter.</typeparam>
 public static void IsInRange <TComparable>(TComparable value, TComparable lowerRangeLimit, TComparable higherRangeLimit, string paramName)
     where TComparable : IComparable
 {
     if (ComparableHelper.Compare(value, lowerRangeLimit) < 0 ||
         ComparableHelper.Compare(value, higherRangeLimit) > 0)
     {
         string message = string.Format("{0} must be between {1} and {2}. {0} was {3}", paramName, lowerRangeLimit, higherRangeLimit, value);
         throw new ArgumentOutOfRangeException(message, (Exception)null);
     }
 }
예제 #2
0
        /// <summary>
        /// Determines whether the specified value is after the other one.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <param name="givenValue">The other value.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The current value is not after the other one.</exception>
        public static ICheckLink <ICheck <IComparable> > IsAfter(this ICheck <IComparable> check, IComparable givenValue)
        {
            var checker = ExtensibilityHelper.ExtractChecker(check);

            return(checker.ExecuteCheck(
                       () =>
            {
                ComparableHelper.IsAfter(checker.Value, givenValue);
            },
                       FluentMessage.BuildMessage("The {0} is after the reference value whereas it must not.").On(checker.Value).And.Expected(givenValue).Comparison("before").ToString()));
        }
예제 #3
0
        #pragma warning disable 169

        //// ---------------------- WARNING ----------------------
        //// AUTO-GENERATED FILE WHICH SHOULD NOT BE MODIFIED!
        //// To change this class, change the one that is used
        //// as the golden source/model for this autogeneration
        //// (i.e. the one dedicated to the integer values).
        //// -----------------------------------------------------

        #pragma warning restore 169

        /// <summary>
        /// Determines whether the specified value is before the other one.
        /// </summary>
        /// <param name="check">The fluent check to be extended.</param>
        /// <param name="givenValue">The other value.</param>
        /// <returns>
        /// A check link.
        /// </returns>
        /// <exception cref="FluentCheckException">The current value is not before the other one.</exception>
        public static ICheckLink <ICheck <ulong> > IsBefore(this ICheck <ulong> check, ulong givenValue)
        {
            var         checker      = ExtensibilityHelper.ExtractChecker(check);
            IComparable checkedValue = checker.Value as IComparable;

            return(checker.ExecuteCheck(
                       () =>
            {
                ComparableHelper.IsBefore(checkedValue, givenValue);
            },
                       FluentMessage.BuildMessage("The {0} is before the reference value whereas it must not.").On(checkedValue).And.Expected(givenValue).Comparison("after").ToString()));
        }
예제 #4
0
        public static bool operator !=(DVRPTRVersion a, DVRPTRVersion b)
        {
            int result = ComparableHelper.Compare(a, b);

            return(result != 0);
        }