public void TestZeroWithFloatDoubleAndDecimal() { // Assert.NotEqual(0f, 0.1f + 0.2f - 0.3f);//In VS 2015 update 2, compiler makes it zeror. Assert.NotEqual(0d, 0.1d + 0.2d - 0.3d); Assert.Equal(0m, 0.1m + 0.2m - 0.3m); Assert.Equal(0, api.GetFloatZero()); Assert.NotEqual(0, api.GetDoubleZero()); //.net core is consistent in both client side and server side. Assert.Equal(0, api.GetDecimalZero()); }
public void TestZeroWithFloatDoubleAndDecimal() { // Assert.NotEqual(0f, 0.1f + 0.2f - 0.3f);//In VS 2015 update 2, compiler makes it zeror. Assert.NotEqual(0d, 0.1d + 0.2d - 0.3d); Assert.Equal(0m, 0.1m + 0.2m - 0.3m); Assert.NotEqual(0, api.GetFloatZero()); Assert.NotEqual(0, api.GetDoubleZero()); Assert.Equal(0, api.GetDecimalZero()); }
public void TestZeroWithFloatDoubleAndDecimal() { Assert.Equal(0f, 0.1f + 0.2f - 0.3f);//In VS 2015 update 2, compiler makes it zeror. .net core and .net have different behaviors. Assert.NotEqual(0d, 0.1d + 0.2d - 0.3d); Assert.Equal(0m, 0.1m + 0.2m - 0.3m); var f = api.GetFloatZero(); Assert.Equal(0, f); // in .net, not equal var d = api.GetDoubleZero(); Assert.NotEqual(0, d); Assert.Equal(0, api.GetDecimalZero()); }