/// <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"); } }
/// <summary> /// Constructs a tolerance given an amount and <see cref="ToleranceMode"/> /// </summary> private Tolerance(object amount, ToleranceMode mode) { Amount = amount; Mode = mode; }
/// <summary> /// Constructs a tolerance given an amount and ToleranceMode /// </summary> private Tolerance(object amount, ToleranceMode mode) { this.amount = amount; this.mode = mode; }