Ejemplo n.º 1
0
        public void ConvertFromExcelTest()
        {
            var converter            = new DecimalConverter();
            var typeConverterOptions = new TypeConverterOptions {
                CultureInfo = CultureInfo.CurrentCulture
            };

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

            try {
                converter.ConvertFromExcel(typeConverterOptions, "");
                Assert.Fail();
            } catch (ExcelTypeConverterException) {
            }
        }