/// <summary>
        /// Determines whether the specified value is within the interval.
        /// </summary>
        /// <typeparam name="TQuantity">The type of the quantity.</typeparam>
        /// <typeparam name="TUnitSelector">The type of the unit selector.</typeparam>
        /// <param name="quantity">The quantity.</param>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="unitSelector">The unit selector.</param>
        /// <param name="intervalMode">The interval mode.</param>
        /// <returns>
        ///   <c>true</c> if the specified quantity is within the interval, otherwise <c>false</c>.
        /// </returns>
        public static bool IsWithin <TQuantity, TUnitSelector>(
            this IQuantity <TQuantity, TUnitSelector> quantity,
            double min,
            double max,
            SelectUnit <TUnitSelector> unitSelector,
            IntervalMode intervalMode = IntervalMode.Inclusive)
            where TQuantity : IQuantity
        {
            var unit = UnitBuilder.BuildUnit(unitSelector(quantity.CreateUnitSelector()));

            return(quantity.ToDouble(unit).IsWithinInterval(min, max, intervalMode));
        }