public void SaveExcelToOriginalFile_ColumnsChanged() { Excel.Application xlApp; Excel.Workbook xlWorkBook; bool result = ExcelImporterExporter.LoadExcelFromFile( Environment.CurrentDirectory + @"\TestData\TestALFScheduler", out xlApp, out xlWorkBook); if (!result) { Assert.Fail(); } Excel.Worksheet xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); xlWorkSheet.Cells[1, 1] = "TEST"; xlWorkSheet.Cells[1, 2] = "VALUES"; result = ExcelImporterExporter.SaveWorkbookToOriginalFile(xlWorkBook); if (!result) { Assert.Fail(); } ExcelImporterExporter.CloseExcelApp(xlApp, xlWorkBook); result = ExcelImporterExporter.LoadExcelFromFile( Environment.CurrentDirectory + @"\TestData\TestALFScheduler", out xlApp, out xlWorkBook); if (!result) { Assert.Fail(); } xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Assert.AreEqual("TEST", xlWorkSheet.Cells[1, 1].Value.ToString()); Assert.AreEqual("VALUES", xlWorkSheet.Cells[1, 2].Value.ToString()); ExcelImporterExporter.CloseExcelApp(xlApp, xlWorkBook); }
public void LoadExcelFromFile_Success() { Excel.Application xlApp; Excel.Workbook xlWorkBook; bool result = ExcelImporterExporter.LoadExcelFromFile( Environment.CurrentDirectory + @"\TestData\TestALFScheduler", out xlApp, out xlWorkBook); if (!result) { Assert.Fail(); } Assert.IsTrue(result); ExcelImporterExporter.CloseExcelApp(xlApp, xlWorkBook); }
public void LoadExcelFromFile_VerifyColumns_Success() { Excel.Application xlApp; Excel.Workbook xlWorkBook; bool result = ExcelImporterExporter.LoadExcelFromFile( Environment.CurrentDirectory + @"\TestData\TestALFScheduler", out xlApp, out xlWorkBook); if (!result) { Assert.Fail(); } Excel.Worksheet xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Assert.AreEqual("ID", xlWorkSheet.Cells[1, 1].Value.ToString()); Assert.AreEqual("Name", xlWorkSheet.Cells[1, 2].Value.ToString()); ExcelImporterExporter.CloseExcelApp(xlApp, xlWorkBook); }