How can my strings have different hash codes but the same text value of "16 777 216"?
The test method does not pass:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestStringEquals
{
[TestClass]
public class FormatterTests
{
[TestMethod]
public void Double_Test_1()
{
Assert.AreEqual("16 777 216", FormatDoubleWithThousandSeparator(16777216, 0));
}
public string FormatDoubleWithThousandSeparator(double value, int digits)
{
double result = Math.Round((double)value, digits);
System.Globalization.NumberFormatInfo nfi = (System.Globalization.NumberFormatInfo)System.Globalization.NumberFormatInfo.InvariantInfo.Clone();
nfi.NumberGroupSeparator = " ";
return result.ToString("###,###,###,###,###,###,##0.#####", nfi);
}
}
}