Example #1
0
        public void ReadRow_AutoMappedEnumerable_ReturnsExpected()
        {
            using (var importer = Helpers.GetImporter("SplitWithComma.xlsx"))
            {
                ExcelSheet sheet = importer.ReadSheet();
                sheet.ReadHeading();

                AutoSplitWithSeparatorClass row1 = sheet.ReadRow <AutoSplitWithSeparatorClass>();
                Assert.Equal(new string[] { "1", "2", "3" }, row1.Value);

                AutoSplitWithSeparatorClass row2 = sheet.ReadRow <AutoSplitWithSeparatorClass>();
                Assert.Equal(new string[] { "1", null, "2" }, row2.Value);
            }
        }
Example #2
0
        public void ReadRow_IEnumerableSeparatorsMap_ReturnsExpected()
        {
            using (var importer = Helpers.GetImporter("SplitWithCustomSeparators.xlsx"))
            {
                importer.Configuration.RegisterClassMap <SplitWithEnumerableSeparatorsMap>();

                ExcelSheet sheet = importer.ReadSheet();
                sheet.ReadHeading();

                AutoSplitWithSeparatorClass row1 = sheet.ReadRow <AutoSplitWithSeparatorClass>();
                Assert.Equal(new string[] { "1", "2", "3", "4", "5" }, row1.Value);

                AutoSplitWithSeparatorClass row2 = sheet.ReadRow <AutoSplitWithSeparatorClass>();
                Assert.Equal(new string[] { "1", "2", "3" }, row2.Value);
            }
        }