//check get sheets num of same CIName void test_getdataprocess() { List <LEU> leus = new List <LEU>(); CIReportExcel excel = new CIReportExcel("", "", leus, null); Debug.Assert(excel.getsheetnum() == 0); for (int cin = 1; cin < 50; ++cin) { for (int i = 0; i < 500; ++i) { LEU leu = new LEU("leu1", i, $"CI{i % cin}"); leus.Add(leu); } MethodHelper.InvokePrivateMethod <CIReportExcel>(excel, "getdataprocess", new object[] { leus, null, "" }); Debug.Assert(excel.getsheetnum() == cin); } //lack test to check the record count }
/// <summary> /// check this test result need check excel file in Debug. /// </summary> void test_generateExcel() { List <LEU> leus = new List <LEU>(); List <LEU_filtered_values.leu> leuinfos = new List <LEU_filtered_values.leu>(); for (int i = 0; i < 5; ++i) { LEU leu = new LEU($"leu{i}", i, $"CI{i % 2}"); leus.Add(leu); LEU_filtered_values.leu leuinfo = FileLoader.Load <LEU_filtered_values.leu>("input//LEURFV.xml"); leuinfo.NAME = new StringData(leu.Name); leuinfos.Add(leuinfo); } CIReportExcel excel = new CIReportExcel("..//..//..//BMGenTool//bin//Debug//Config//CI-LEU一致性测试报告 CI-LEU correspondence test report.xlsx", ".//", leus, leuinfos); using (FileStream sw = new FileStream("CI-LEU一致性测试报告 CI-LEU correspondence test report.xlsx", FileMode.Open, FileAccess.ReadWrite)) { IWorkbook workBook = CIReportExcel.createworkbook(sw); for (int pagei = 0; pagei < 2; ++pagei) { ISheet sheet = workBook.GetSheetAt(workBook.NumberOfSheets - 1 - pagei); for (int rowi = 16; rowi < 30; ++rowi) { IRow row = sheet.GetRow(rowi); if (null != row && row.Cells.Count() == 8) { haschecked = true; ICell cell = row.GetCell(0); Debug.Assert(0 == cell.StringCellValue.IndexOf("leu")); } } Debug.Assert(haschecked == true); haschecked = false; } workBook.Close(); sw.Close(); } }
public void Print(LEU s) { Console.WriteLine(s.Name); }