/// <summary>
        /// Ensures the expression and corresponding value evaluates to between the specified values
        /// </summary>
        /// <param name="exp">The exp.</param>
        /// <param name="val">The value.</param>
        /// <param name="bound1">The bound1.</param>
        /// <param name="bound2">The bound2.</param>
        /// <param name="allowEitherOrder">if set to <c>true</c> [allow either order].</param>
        /// <param name="boundsType">Type of the bounds.</param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        public static void IsBetween(Expression <Func <long> > exp, long val, long bound1, long bound2, bool allowEitherOrder, IsBetweenBoundsType boundsType)
        {
            if (val.IsBetween(bound1, bound2, allowEitherOrder, boundsType))
            {
                return;
            }

            var memberName = ExpressionExtensions.GetMemberName(exp);

            throw new ArgumentOutOfRangeException(
                      memberName,
                      val,
                      string.Format("{0} must be {1}",
                                    memberName,
                                    string.Format(boundsType.GetLimitDescriptionFormat(),
                                                  MathsInt64Extensions.GetLowerBound(bound1, bound2, allowEitherOrder),
                                                  MathsInt64Extensions.GetUpperBound(bound1, bound2, allowEitherOrder)
                                                  )
                                    )
                      );
        }
 public long GetUpperBound(long min, long max, bool allowEitherOrder)
 {
     return(MathsInt64Extensions.GetUpperBound(min, max, allowEitherOrder));
 }