private void WriteDifferenceLine(object expected, object actual, Tolerance tolerance) { // It only makes sense to display absolute/percent difference if (tolerance.Mode != ToleranceMode.Linear && tolerance.Mode != ToleranceMode.Percent) return; var differenceString = MsgUtils.FormatValue(Numerics.Difference(expected, actual, tolerance.Mode)); if (differenceString != double.NaN.ToString()) { Write(Pfx_Difference); Write(differenceString); if (tolerance.Mode != ToleranceMode.Linear) Write(" {0}", tolerance.Mode); WriteLine(); } }
private void WriteDifferenceLine(object expected, object actual, Tolerance tolerance) { // It only makes sense to display absolute/percent difference if (tolerance.Mode != ToleranceMode.Linear && tolerance.Mode != ToleranceMode.Percent) { return; } string differenceString = tolerance.Amount is TimeSpan ? MsgUtils.FormatValue(DateTimes.Difference(expected, actual)) // TimeSpan tolerance applied in linear mode only : MsgUtils.FormatValue(Numerics.Difference(expected, actual, tolerance.Mode)); if (differenceString != double.NaN.ToString()) { Write(Pfx_Difference); Write(differenceString); if (tolerance.Mode != ToleranceMode.Linear) { Write(" {0}", tolerance.Mode); } WriteLine(); } }