Example #1
0
 /// <summary>
 /// Extends the Ensure class when the inspected object is a generic <c>IComparabe</c>
 /// and can be used to ensure that the inspected value is greater then an expected value.
 /// </summary>
 /// <typeparam name="T">The inspected value type.</typeparam>
 /// <param name="validator">The Ensure class to extend.</param>
 /// <param name="expected">The expected value to compare to.</param>
 /// <returns>
 /// The Ensure instance for fluent interface usage.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">An <c>ArgumentOutOfRangeException</c>
 /// is raised if the current inspected object is smaller then the expected value.</exception>
 public static IEnsure <T> IsGreaterThen <T>(this IEnsure <T> validator, T expected) where T : IComparable <T>
 {
     return(ComparableEnsureExtension.IsGreaterThen(validator, expected, Or.NotEqual));
 }
Example #2
0
 /// <summary>
 /// Extends the Ensure class when the inspected object is a generic <c>IComparabe</c>
 /// and can be used to ensure that the inspected value is within a given range.
 /// </summary>
 /// <typeparam name="T">The inspected value type.</typeparam>
 /// <param name="validator">The Ensure class to extend.</param>
 /// <param name="lowerBoundary">The lower boundary.</param>
 /// <param name="higherBoundary">The higher boundary.</param>
 /// <returns>
 /// The Ensure instance for fluent interface usage.
 /// </returns>
 /// <exception cref="ArgumentOutOfRangeException">An <c>ArgumentOutOfRangeException</c>
 /// is raised if the current inspected object is outside the expected range.</exception>
 public static IEnsure <T> IsWithin <T>(this IEnsure <T> validator, T lowerBoundary, T higherBoundary) where T : IComparable <T>
 {
     return(ComparableEnsureExtension.IsWithin(validator, lowerBoundary, higherBoundary, Boundary.ExcludeBounds));
 }