Example #1
0
 /// <summary>
 /// Checks whether the value is greater as the reference value.
 /// </summary>
 /// <param name="value">The value to test.</param>
 /// <param name="referenceValue">The reference value to test.</param>
 /// <exception cref="ArgumentOutOfRangeException"><em>value</em> is out of
 /// range.</exception>
 public static void IsGreater(IComparable value, IComparable referenceValue)
 {
     if (!value.IsGreater(referenceValue))
     {
         throw new ArgumentOutOfRangeException();
     }
 }
Example #2
0
 /// <summary>
 /// Checks whether the value is greater as the reference value.
 /// </summary>
 /// <param name="value">The value to test.</param>
 /// <param name="referenceValue">The reference value to test.</param>
 /// <param name="paramName">The name of the parameter that caused the exception.</param>
 /// <param name="message">A message that describes the error.</param>
 /// <exception cref="ArgumentOutOfRangeException"><em>value</em> is out of
 /// range.</exception>
 public static void IsGreater(IComparable value, IComparable referenceValue, string paramName, string message)
 {
     if (!value.IsGreater(referenceValue))
     {
         throw new ArgumentOutOfRangeException(paramName, referenceValue, message);
     }
 }
        /// <summary>
        /// Indicates whether the instance is greater or equal to the reference value.
        /// </summary>
        /// <param name="value">The instance to test.</param>
        /// <param name="referenceValue">The reference value to test.</param>
        /// <returns><strong>true</strong> if the instance is greater or equal to the reference
        /// value; otherwise, <strong>false</strong>.</returns>
        /// <exception cref="ArgumentNullException"><em>value</em> or <em>referenceValue</em> is
        /// <strong>null</strong>.</exception>
        public static bool IsGreaterOrEqual(this IComparable value, IComparable referenceValue)
        {
            Precondition.IsNotNull(value, nameof(value));
            Precondition.IsNotNull(referenceValue, nameof(referenceValue));

            return(value.IsGreater(referenceValue) || value.IsEqual(referenceValue));
        }
 public void IsGreater_Throws_ArgumentNullException(IComparable value, IComparable referenceValue, string expectedParameter)
 {
     AssertThrowsException<ArgumentNullException>(() => value.IsGreater(referenceValue), expectedParameter);
 }
 public void IsGreater_Throws_ArgumentNullException(IComparable value, IComparable referenceValue, string expectedParameter)
 {
     AssertThrowsException <ArgumentNullException>(() => value.IsGreater(referenceValue), expectedParameter);
 }