Пример #1
0
        public void ConvertFromExcelTest()
        {
            var converter            = new SingleConverter();
            var typeConverterOptions = new TypeConverterOptions {
                CultureInfo = CultureInfo.CurrentCulture
            };

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

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