Esempio n. 1
0
 public static void AssertApproximatelySame(object value, object expect, string msg = null)
 {
     if (CellUtility.IsNumberData(value) && CellUtility.IsNumberData(expect))
     {
         AssertTrue(Math.Abs((double)Convert.ChangeType(value, typeof(double)) - (double)Convert.ChangeType(expect, typeof(double))) < 0.00001, msg);
     }
     //else if (value is System.Drawing.Color && expect is System.Drawing.Color)
     //{
     //	AssertEquals(((System.Drawing.Color)value).ToArgb(), ((System.Drawing.Color)expect).ToArgb(), msg);
     //}
     else if (double.TryParse(Convert.ToString(value), out double v1) && double.TryParse(Convert.ToString(expect), out double v2))
     {
         AssertTrue(Math.Abs(v1 - v2) < 0.00001, msg);
     }
     else
     {
         AssertEquals(value, expect, msg);
     }
 }