示例#1
0
        /// <summary>
        /// DataTable to list
        /// </summary>
        public void ToListTest()
        {
            var    filePath       = "..\\..\\TestUseFile\\TestExport.xlsx";
            var    excelHelperTwo = new NpoiHelper(filePath);
            string message;
            var    tableTwo = excelHelperTwo.ExcelToDataTable(null, true, out message);
            List <PersonGattScheduleInfoDto> tableToList =
                DataTypeConvertHelper.ToList <PersonGattScheduleInfoDto>(tableTwo);

            tableTwo.Rows.Count.IsEqualTo(tableToList.Count);
        }
示例#2
0
        /// <summary>
        /// list to datatable slowly
        /// </summary>
        public void ToDataTableSlowlyTest()
        {
            var    filePath       = "..\\..\\TestUseFile\\TestExportLessData.xlsx";
            var    excelHelperTwo = new NpoiHelper(filePath);
            string message;
            var    tableTwo = excelHelperTwo.ExcelToDataTable("sheet1", true, out message);
            List <PersonGattScheduleInfoDto> personGantScheduleInfoDtosList =
                DataTypeConvertHelper.ToList <PersonGattScheduleInfoDto>(tableTwo);
            var storgeTable = DataTypeConvertHelper.ToDataTable(personGantScheduleInfoDtosList);

            tableTwo.Rows.Count.IsEqualTo(storgeTable.Rows.Count);
            var i = 5;
            var j = 4;

            tableTwo.Rows[i][j].IsEqualTo(storgeTable.Rows[i][j]);
        }