コード例 #1
0
        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");
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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);
        }