コード例 #1
0
        public DataTable ConsumeFile(UploadExcelFileModel uploadFile)
        {
            var memoryStream = new MemoryStream();

            uploadFile.File.InputStream.CopyTo(memoryStream);
            return(ExcelParser.ExtractExcelSheetValues(memoryStream, ServiceOfferingSheetName));
        }
コード例 #2
0
        public void GivenANullWorkSheetName_WhenIParse_ThenADataTableWillBeReturned()
        {
            var filePath        = UploadFileTemplatePath + "NullStartEndDateAndNotesCol.xlsx";
            var destinationPath = CopyTestFile(filePath);

            using (FileStream fs = File.Open(destinationPath, FileMode.Open))
            {
                var dataTable = ExcelParser.ExtractExcelSheetValues(fs, null) as DataTable;

                Assert.IsNotNull(dataTable);
                Assert.IsTrue(dataTable.Rows.Count > 0);
            }

            DestroyTestFile(destinationPath);
        }