示例#1
0
 /// <summary>
 ///  Verifies that an input value matches an expected value, throwing an ArgumentException if not.
 /// </summary>
 /// <param name="expectedValue">The expected value.</param>
 /// <param name="actualValue">The actual value.</param>
 /// <param name="argumentName">The argument name.</param>
 /// <exception cref="System.ArgumentException">If the actual value does not match the expected value.</exception>
 public static void Equality(Object actualValue, Object expectedValue, string argumentName)
 {
     Insist.Equality(actualValue, expectedValue, argumentName, null);
 }
示例#2
0
 /// <summary>
 ///  Validates a type argument, throwing ArgumentException if it is not assignable from the specified type.
 /// </summary>
 /// <typeparam name="T">The type the argument must implement or inherit from.</typeparam>
 /// <param name="value">The type to be validated..</param>
 /// <param name="argumentName">The argument name.</param>
 public static void IsAssignableFrom <T>(Type value, string argumentName)
 {
     Insist.IsAssignableFrom <T>(value, argumentName, null);
 }
示例#3
0
 /// <summary>
 ///  Validates a integral argument, throwing ArgumentException if it falls outside
 ///  the acceptable bounds.
 /// </summary>
 /// <param name="value">The value to be validated.</param>
 /// <param name="argumentName">The argument name.</param>
 /// <param name="minValue">The minimum acceptable value.</param>
 /// <param name="maxValue">The maximum acceptable value.</param>
 public static void IsWithinBounds <T>(T value, T minValue, T maxValue, string argumentName) where T : IComparable <T>
 {
     Insist.IsWithinBounds(value, minValue, maxValue, argumentName, null);
 }
示例#4
0
 /// <summary>
 ///  Validates an integral argument, throwing ArgumentException if it is more than the acceptable
 ///  maximum value.
 /// </summary>
 /// <param name="value">The value to be validated.</param>
 /// <param name="argumentName">The argument name.</param>
 /// <param name="maxValue">The maximum accepted value.</param>
 public static void IsAtMost <T>(T value, T maxValue, string argumentName) where T : IComparable <T>
 {
     Insist.IsAtMost(value, maxValue, argumentName, null);
 }
示例#5
0
 /// <summary>
 ///  Validates a required argument, throwing an ArgumentException
 ///  if it is null, empty or whitespace.
 /// </summary>
 /// <param name="value">The argument value to be validated.</param>
 /// <param name="argumentName">The argument name to appear in the exception.</param>
 /// <exception cref="System.ArgumentException">If the value is null.</exception>
 public static void IsNotNullOrWhiteSpace(string value, string argumentName)
 {
     Insist.IsNotNullOrWhiteSpace(value, argumentName, null);
 }