site/xunit.analyzers/rules/xUnit2016.md
Asserting on equality of two double or decimal values was declared with precision out of the acceptable range.
Assert.Equals uses System.Math.Round internally which imposes limits on the precision parameter of [0..15] for
doubles and [0..28] for decimals.
Keep the precision in [0..15] for doubles and [0..28] for decimals.
using Xunit;
public class xUnit2016
{
[Fact]
public void TestMethod()
{
var actual = 1.1;
Assert.Equal(1.1, actual, 16);
}
}
using Xunit;
public class xUnit2016
{
[Fact]
public void TestMethod()
{
var actual = 1.1;
Assert.Equal(1.1, actual, 15);
}
}