I have the following class
public static class MyClass
{
public static double Converter(int mpg)
{
return Math.Round((double)mpg / ((double)36 / 12.74), 2);
}
}
And NUnit unit test
[TestFixture]
public class ConverterTests
{
[Test]
public void Basic_Tests()
Assert.AreEqual(8.50, MyClass.Converter(24));
}
}
My Unit tests fails with
Expected: 8.5d
But was: 8.4900000000000002d
When I debug the method return 8.5 so where does the unit test get the strange number from?
Aucun commentaire:
Enregistrer un commentaire