コード例 #1
0
        public void ReadRows_AutoMappedCustomIndexNullableEnumField_ReturnsExpected()
        {
            using var importer = Helpers.GetImporter("Primitives.xlsx");

            ExcelSheet sheet = importer.ReadSheet();

            sheet.ReadHeading();

            CustomIndexNullableEnumFieldClass row1 = sheet.ReadRow <CustomIndexNullableEnumFieldClass>();

            Assert.Equal(CustomEnum.a, row1.CustomIndex);

            Assert.Throws <ExcelMappingException>(() => sheet.ReadRow <CustomIndexNullableEnumFieldClass>());
        }
コード例 #2
0
        public void ReadRows_CustomMappedCustomIndexNullableEnumField_ReturnsExpected()
        {
            using var importer = Helpers.GetImporter("Primitives.xlsx");
            importer.Configuration.RegisterClassMap <CustomCustomIndexNullableEnumFieldClassMap>();

            ExcelSheet sheet = importer.ReadSheet();

            sheet.ReadHeading();

            CustomIndexNullableEnumFieldClass row1 = sheet.ReadRow <CustomIndexNullableEnumFieldClass>();

            Assert.Equal(CustomEnum.a, row1.CustomIndex);

            CustomIndexNullableEnumFieldClass row2 = sheet.ReadRow <CustomIndexNullableEnumFieldClass>();

            Assert.Equal(CustomEnum.B, row2.CustomIndex);
        }