public void Have_A_Fency_Converter_Which_Prefers_Injected_Culture() { var cultureDe = new CultureInfo("de-DE"); var converter = new NZazuDoubleField.DoubleToStringConverter(culture: cultureDe); converter.Convert(23.34, null, null, new CultureInfo("en-US")).Should().Be("23,34"); }
public void Have_A_Fency_Converter_Which_Prefers_Parameter_Culture() { var cultureDe = new CultureInfo("de-DE"); var converter = new NZazuDoubleField.DoubleToStringConverter(); converter.Convert(23.34, null, null, cultureDe).Should().Be("23,34"); }
private static void Have_A_Fency_Converter() { var culture = Thread.CurrentThread.CurrentUICulture; var separator = culture.NumberFormat.CurrencyDecimalSeparator; var converter = new NZazuDoubleField.DoubleToStringConverter(culture: culture); // lets do some fake edits which means the string is entered char by char VerifyConvert(converter, "", null); VerifyConvert(converter, "3", 3); VerifyConvert(converter, "35", 35); VerifyConvert(converter, "35" + separator, 35); VerifyConvert(converter, "35" + separator + "3", 35.3); VerifyConvert(converter, "35" + separator, 35); VerifyConvert(converter, "35" + separator + separator, null); VerifyConvert(converter, "35" + separator, 35); VerifyConvert(converter, "35" + separator + "3", 35.3); }