コード例 #1
0
        public void DoubleToString()
        {
            Assert.AreEqual("17,6", StringConversion.DoubleToString(17.6, new ValueFormat()
            {
                GroupSeparator   = ".",
                DecimalSeparator = ",",
                NumberFormat     = "#,####.0"
            }));
            Assert.AreEqual("1.237,6", StringConversion.DoubleToString(1237.6, new ValueFormat()
            {
                GroupSeparator   = ".",
                DecimalSeparator = ",",
                NumberFormat     = "#,####.0"
            }));

            Assert.AreEqual("17,6", StringConversion.DecimalToString(17.6m, new ValueFormat()
            {
                GroupSeparator   = ".",
                DecimalSeparator = ",",
                NumberFormat     = "#,####.0"
            }));
            Assert.AreEqual("1.237,6", StringConversion.DecimalToString(1237.6m, new ValueFormat()
            {
                GroupSeparator   = ".",
                DecimalSeparator = ",",
                NumberFormat     = "#,####.0"
            }));
        }
コード例 #2
0
        public void DecimalToString()
        {
            Assert.AreEqual("53.336,24",
                            StringConversion.DecimalToString((decimal)53336.2373, new ImmutableValueFormat(groupSeparator: ".", decimalSeparator: ",", numberFormat: "#,####.00")));

            Assert.AreEqual("20-000-000-000",
                            StringConversion.DecimalToString((decimal)2E10, new ImmutableValueFormat(numberFormat: "#,####", groupSeparator: "-")));

            Assert.AreEqual("1237,6",
                            StringConversion.DecimalToString(1237.6m, new ImmutableValueFormat(groupSeparator: "", decimalSeparator: ",", numberFormat: "#,####.0")));
            Assert.AreEqual("17,6",
                            StringConversion.DecimalToString(17.6m, new ImmutableValueFormat(groupSeparator: ".", decimalSeparator: ",", numberFormat: "#,####.0")));
        }
コード例 #3
0
        public void DecimalToString()
        {
            Assert.AreEqual("53.336,24", StringConversion.DecimalToString((decimal)53336.2373, new ValueFormat()
            {
                GroupSeparator   = ".",
                DecimalSeparator = ",",
                NumberFormat     = "#,####.00"
            }));

            Assert.AreEqual("20-000-000-000", StringConversion.DecimalToString((decimal)2E10, new ValueFormat()
            {
                GroupSeparator = "-",
                NumberFormat   = "#,####"
            }));
        }