/// <summary>
        /// Asserts that <paramref name="value" /> is in the inclusive range of values specified by
        /// <paramref name="lowerBoundInclusive" /> and <paramref name="upperBoundInclusive" /> and throws an exception if it is
        /// not.
        /// </summary>
        /// <param name="value">The value to check.</param>
        /// <param name="argumentName">The name of the caller's argument passed in <paramref name="value" />.</param>
        /// <param name="validationType">The type of validation to perform.</param>
        /// <param name="lowerBoundInclusive">The inclusive lower bound.</param>
        /// <param name="upperBoundInclusive">
        /// The inclusive upper bound (must not be less than
        /// <paramref name="lowerBoundInclusive" />)..
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">'value' is outside the permitted range of values.</exception>
        public static void Validate(this double value, [InvokerParameterName][NotNull] string argumentName, NumberIs validationType, double lowerBoundInclusive, double upperBoundInclusive)
        {
            Debug.Assert(upperBoundInclusive >= lowerBoundInclusive, "Upper bound must not be less than lower bound.");

            if (((validationType == NumberIs.IsAtLeast) || (validationType == NumberIs.IsBetween)) && (value < lowerBoundInclusive))
            {
                throw new ArgumentOutOfRangeException(argumentName, value,
                                                      string.Format(CultureInfo.InvariantCulture, "'{0}' is less than the minimum value.  '{0}' must be in the range {1} to {2} (inclusive).",
                                                                    argumentName, lowerBoundInclusive, upperBoundInclusive));
            }

            if (((validationType == NumberIs.IsAtMost) || (validationType == NumberIs.IsBetween)) && (value > upperBoundInclusive))
            {
                throw new ArgumentOutOfRangeException(argumentName, value,
                                                      string.Format(CultureInfo.InvariantCulture, "'{0}' is greater than the maximum value.  '{0}' must be in the range {1} to {2} (inclusive).",
                                                                    argumentName, lowerBoundInclusive, upperBoundInclusive));
            }
        }
        /// <summary>
        /// Asserts that <paramref name="value" /> is in the inclusive range of values specified by
        /// <paramref name="lowerBoundInclusive" /> and <paramref name="upperBoundInclusive" /> and throws an exception if it is
        /// not.
        /// </summary>
        /// <param name="value">The value to check.</param>
        /// <param name="argumentName">The name of the caller's argument passed in <paramref name="value" />.</param>
        /// <param name="validationType">The type of validation to perform.</param>
        /// <param name="lowerBoundInclusive">The inclusive lower bound.</param>
        /// <param name="upperBoundInclusive">
        /// The inclusive upper bound (must not be less than
        /// <paramref name="lowerBoundInclusive" />)..
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">'value' is outside the permitted range of values.</exception>
        public static void Validate(this int value, [InvokerParameterName][NotNull] string argumentName, NumberIs validationType, int lowerBoundInclusive, int upperBoundInclusive)
        {
            Debug.Assert(upperBoundInclusive >= lowerBoundInclusive, "Upper bound must not be less than lower bound.");

            if (((validationType == NumberIs.IsAtLeast) || (validationType == NumberIs.IsBetween)) && (value < lowerBoundInclusive))
            {
                throw new ArgumentOutOfRangeException(argumentName, value,
                                                      $@"'{argumentName}' is less than the minimum value.  '{argumentName}' must be in the range {lowerBoundInclusive} to {upperBoundInclusive} (inclusive).");
            }

            if (((validationType == NumberIs.IsAtMost) || (validationType == NumberIs.IsBetween)) && (value > upperBoundInclusive))
            {
                throw new ArgumentOutOfRangeException(argumentName, value,
                                                      $@"'{argumentName}' is greater than the maximum value.  '{argumentName}' must be in the range {lowerBoundInclusive} to {upperBoundInclusive} (inclusive).");
            }
        }
        /// <summary>
        /// Asserts that <paramref name="value" /> is greater than, or less than, the value in <paramref name="limit" />,
        /// depending upon the setting in <paramref name="validationType" />.
        /// </summary>
        /// <param name="value">The value to check.</param>
        /// <param name="argumentName">The name of the caller's argument passed in <paramref name="value" />.</param>
        /// <param name="validationType">The type of validation to perform.</param>
        /// <param name="limit">
        /// The limit (maximum or minimum value depending upon the value in <paramref name="validationType" />
        /// ).
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">'value' is outside the permitted range of values.</exception>
        public static void Validate(this double value, [InvokerParameterName][NotNull] string argumentName, NumberIs validationType, double limit)
        {
            switch (validationType)
            {
            case NumberIs.IsAtLeast:
                if (value < limit)
                {
                    throw new ArgumentOutOfRangeException(argumentName, value, string.Format(CultureInfo.InvariantCulture, "'{0}' is less than the minimum value {1}.", argumentName, limit));
                }

                break;

            case NumberIs.IsAtMost:
                if (value > limit)
                {
                    throw new ArgumentOutOfRangeException(argumentName, value, string.Format(CultureInfo.InvariantCulture, "'{0}' is more than the maximum value {1}.", argumentName, limit));
                }

                break;

            default:
                throw new ArgumentOutOfRangeException("validationType", validationType, "'validationType' must be 'NumberIs.IsAtLeast' or 'NumberIs.IsAtMost'.");
            }
        }
        /// <summary>
        /// Asserts that <paramref name="value" /> is greater than, or less than, the value in <paramref name="limit" />,
        /// depending upon the setting in <paramref name="validationType" />.
        /// </summary>
        /// <param name="value">The value to check.</param>
        /// <param name="argumentName">The name of the caller's argument passed in <paramref name="value" />.</param>
        /// <param name="validationType">The type of validation to perform.</param>
        /// <param name="limit">
        /// The limit (maximum or minimum value depending upon the value in <paramref name="validationType" />
        /// ).
        /// </param>
        /// <exception cref="System.ArgumentOutOfRangeException">'value' is outside the permitted range of values.</exception>
        public static void Validate(this int value, [InvokerParameterName][NotNull] string argumentName, NumberIs validationType, int limit)
        {
            switch (validationType)
            {
            case NumberIs.IsAtLeast:
                if (value < limit)
                {
                    throw new ArgumentOutOfRangeException(argumentName, value, $@"'{argumentName}' is less than the minimum value {limit}.");
                }

                break;

            case NumberIs.IsAtMost:
                if (value > limit)
                {
                    throw new ArgumentOutOfRangeException(argumentName, value, $@"'{argumentName}' is more than the maximum value {limit}.");
                }

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(validationType), validationType, $@"'{nameof(validationType)}' must be 'NumberIs.IsAtLeast' or 'NumberIs.IsAtMost'.");
            }
        }