2009-04-07 40 views
4

代码MbUnit:比较双打最优雅的方式?

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. 

什么是最优雅的方式在MbUnit的3.0比较两个双打的平等?我知道我可以把它们四舍五入,但是有没有一些MbUnit构造?

更新:我认为我目前的“解决方法”为非优雅:

Assert.LessThan(
    Math.Abs(9.97320998018748d - observerPosition.CenterLongitude), 
    0.0000001); 

回答