代码
using System.Windows.Media.Media3D;
using NUnit.Framework;
...
Assert.That(result, Is.EqualTo(new Vector3D(4.2426, 4.2426, 3.4641)).Within(0.001));
...
单位测试结果失败的结果:
Expected: 4.2426,4.2426,3.4641 +/- 0.001d
But was: 4.24264068711928,4.24264068711928,3.46410161513775
在Vector3D
类型(或Matrix3D
等)上进行正确比较的最简单方法是什么?