I created a method that calculates the harmonic mean value based on a doubling list. But when I run the test, it continues to fail, even if the output is the same.
My harmonic method:
public static double GetHarmonicMean(List<double> parameters) { var cumReciprocal = 0.0d; var countN = parameters.Count; foreach( var param in parameters) { cumReciprocal += 1.0d/param; } return 1.0d/(cumReciprocal/countN); }
My testing method:
[TestMethod()] public void GetHarmonicMeanTest() { var parameters = new List<double> { 1.5d, 2.3d, 2.9d, 1.9d, 5.6d }; const double expected = 2.32432293165495; var actual = OwnFunctions.GetHarmonicMean(parameters); Assert.AreEqual(expected, actual); }
After starting the test, the following message appears:
Error Assert.AreEqual. Expected: <2.32432293165495>. In fact: <2,32432293165495>.
For me, these are the same meanings.
Can someone explain this? Or am I doing something wrong?
source share