代码
Assert.AreEqual (9.97320998018748d, observerPosition.CenterLongitude);
生产
Expected Value & Actual Value : 9.97320998018748
Remark : Both values look the same when formatted but they
are distinct instances.
在MBUnit3.0中,比较两个双精度数是否相等是最优雅的方法?我知道我可以自己把它们围起来,但是有没有一些MBUnit构造?
更新:我认为我目前的“解决方法”并不优雅:
Assert.LessThan(
Math.Abs(9.97320998018748d - observerPosition.CenterLongitude),
0.0000001);