Beispiel #1
0
        public void ConvertFromExcelTest()
        {
            var converter            = new DoubleConverter();
            var typeConverterOptions = new TypeConverterOptions {
                CultureInfo = CultureInfo.CurrentCulture
            };

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

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