Example #1
0
        /// <summary>
        /// Calculates the difference between 2 values in absolute/percent mode.
        /// </summary>
        /// <param name="expected">The expected value</param>
        /// <param name="actual">The actual value</param>
        /// <param name="toleranceMode">Tolerance mode to specify difference representation</param>
        /// <returns>The difference between the values</returns>
        internal static object Difference(object expected, object actual, ToleranceMode toleranceMode)
        {
            switch (toleranceMode)
            {
            case ToleranceMode.Linear:
                return(Difference(expected, actual, true));

            case ToleranceMode.Percent:
                return(Difference(expected, actual, false));

            default:
                throw new InvalidOperationException("Cannot calculate a difference for specified tolerance mode");
            }
        }
Example #2
0
 /// <summary>
 /// Constructs a tolerance given an amount and <see cref="ToleranceMode"/>
 /// </summary>
 private Tolerance(object amount, ToleranceMode mode)
 {
     Amount = amount;
     Mode   = mode;
 }
Example #3
0
 /// <summary>
 ///     Constructs a tolerance given an amount and ToleranceMode
 /// </summary>
 private Tolerance(object amount, ToleranceMode mode)
 {
     this.amount = amount;
     this.mode   = mode;
 }
Example #4
0
 /// <summary>
 /// Constructs a tolerance given an amount and ToleranceMode
 /// </summary>
 private Tolerance(object amount, ToleranceMode mode)
 {
     this.amount = amount;
     this.mode = mode;
 }