1

Closed

Errors in unit test

description

Test 'ToStringEnumerable' in ‘AlgorithmsTests’ class has errors. Errors are in lines 4331, 4333 and 4336. '.' (dot) is used in strings as a decimal separator(-8.9). I think that CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator should be used. Additionally in the Asserts, the first value should be the one that is expected, not the second one.
Closed Sep 8, 2007 at 11:39 PM by rogerdahlman

comments

rogerdahlman wrote Sep 8, 2007 at 11:38 PM

This has been correct in the latest code in source control. If you continue to have this problem with the new source let me know.

Thanks for the help...

wrote Sep 8, 2007 at 11:39 PM

kradewald wrote May 13, 2009 at 7:38 AM

The problem still exists: Without explicitly specifying a CultureInfo for ToString() and alike, numeric formatting may vary and thus the test fails.

AlgorithmsTests.ToStringEnumerable : Failed

NUnit.Framework.AssertionException: String lengths are both 22. Strings differ at index 19.
Expected: "{hello,8,{1,2,3},-8,9}"
But was: "{hello,8,{1,2,3},-8.9}"
------------------------------^

bei NUnit.Framework.Assert.That(Object actual, Constraint constraint, String message, Object[] args)
bei NUnit.Framework.Assert.AreEqual(Object expected, Object actual, String message, Object[] args)
bei NUnit.Framework.Assert.AreEqual(Object expected, Object actual)
bei Wintellect.PowerCollections.Tests.AlgorithmsTests.ToStringEnumerable() in AlgorithmsTests.cs: line 4331.

wrote Feb 21, 2013 at 11:40 PM

wrote May 16, 2013 at 11:38 AM