示例#1
0
        public void ConvertFromExcelTest()
        {
            var converter            = new NullableConverter(typeof(decimal?));
            var typeConverterOptions = new TypeConverterOptions {
                CultureInfo = CultureInfo.CurrentCulture
            };

            Assert.AreEqual((decimal?)12.3m, converter.ConvertFromExcel(typeConverterOptions, 12.3));
            Assert.AreEqual((decimal?)12.3m, converter.ConvertFromExcel(typeConverterOptions, "12.3"));
            Assert.AreEqual((decimal?)12.3m, converter.ConvertFromExcel(typeConverterOptions, "12.3"));
            Assert.AreEqual((decimal?)12.3m, converter.ConvertFromExcel(typeConverterOptions, " 12.3 "));
            Assert.AreEqual(null, converter.ConvertFromExcel(typeConverterOptions, ""));
        }