private void AssertHistorySheet(IXLWorksheet worksheet, ExportTagDto expectedTagData) { Assert.IsNotNull(worksheet); AssertHeadingsInHistorySheet(worksheet); var expectedData = expectedTagData.History; Assert.AreEqual(expectedData.Count + 1, worksheet.RowsUsed().Count()); var rowIdx = 2; // Start at 2 because Row(1) is the header foreach (var historyDto in expectedData) { var row = worksheet.Row(rowIdx++); Assert.AreEqual(expectedTagData.TagNo, row.Cell(ExcelConverter.HistorySheetColumns.TagNo).Value); Assert.AreEqual(historyDto.Description, row.Cell(ExcelConverter.HistorySheetColumns.Description).Value); AssertDateTime(historyDto.CreatedAtUtc, row.Cell(ExcelConverter.HistorySheetColumns.Date)); Assert.AreEqual(historyDto.CreatedBy, row.Cell(ExcelConverter.HistorySheetColumns.User).Value); AssertInt(historyDto.DueInWeeks, row.Cell(ExcelConverter.HistorySheetColumns.DueInWeeks).Value); } }
public void Setup() { _dut = new ExcelConverter(); _usedFilterDto = new UsedFilterDto( "presActions", new List <string> { "ac1", "ac2" }, "callOffStartsWith", "commPkgNoStartsWith", new List <string> { "dc1", "dc2" }, new List <string> { "df1", "df2" }, new List <string> { "j1", "j2" }, "mcPkgNoStartsWith", new List <string> { "m1", "m2" }, "preservationStatus", "projectDescription", "plant", "projectName", "purchaseOrderNoStartsWith", new List <string> { "rt1", "rt2" }, new List <string> { "r1", "r2" }, "storageAreaStartsWith", new List <string> { "tf" }, "tagNoStartsWith", "voidedFilter"); _exportTagDtoWithoutActionsAndHistory = new ExportTagDto( new List <ExportActionDto>(), "actionStatus1", 1, "areaCode1", 2, "commPkgNo1", "disciplineCode1", true, "journey1", "mcPkgNo1", "mode1", "nextDueAsYearAndWeek1", 4, 5, 6, "purchaseOrderTitle1", "remark1", "requirementTitles1", "responsibleCode1", "status1", "step1", "storageArea1", "tagDescription1", "tagNo1" ); var actionDtos1 = new List <ExportActionDto> { new ExportActionDto( 1, "A", "ADesc", true, new DateTime(1970, 1, 1, 1, 1, 1, DateTimeKind.Utc), null), new ExportActionDto( 2, "B", "BDesc", false, null, new DateTime(2020, 1, 1, 1, 1, 1, DateTimeKind.Utc)) }; _exportTagDtoWithTwoActionsAndTwoHistoryItems = new ExportTagDto( actionDtos1, "actionStatus2", 11, "areaCode2", 12, "commPkgNo2", "disciplineCode2", false, "journey2", "mcPkgNo2", "mode2", "nextDueAsYearAndWeek2", 14, 15, 16, "purchaseOrderTitle2", "remark2", "requirementTitles2", "responsibleCode2", "status2", "step2", "storageArea2", "tagDescription2", "tagNo2" ); _exportTagDtoWithTwoActionsAndTwoHistoryItems.History.Add( new ExportHistoryDto(1, "H1", new DateTime(2021, 2, 3, 4, 5, 6, DateTimeKind.Utc), "Espen Askeladd", null, null, null)); _exportTagDtoWithTwoActionsAndTwoHistoryItems.History.Add( new ExportHistoryDto(2, "H2", new DateTime(2021, 4, 5, 14, 15, 16, DateTimeKind.Utc), "Espen Askeladd", 2, "Details2", "Comment2")); var actionDtos2 = new List <ExportActionDto> { new ExportActionDto( 3, "C", "CDesc", false, null, null) }; _exportTagDtoWithOneActionAndOneHistoryItems = new ExportTagDto( actionDtos2, "actionStatus3", 110, "areaCode3", 120, "commPkgNo3", "disciplineCode3", false, "journey3", "mcPkgNo3", "mode3", "nextDueAsYearAndWeek3", 140, 150, 160, "purchaseOrderTitle3", "remark3", "requirementTitles3", "responsibleCode3", "status3", "step3", "storageArea3", "tagDescription3", "tagNo3" ); _exportTagDtoWithOneActionAndOneHistoryItems.History.Add( new ExportHistoryDto(3, "H3", new DateTime(2021, 4, 5, 14, 15, 16, DateTimeKind.Utc), "Espen Askeladd", 2, "Details3", "Comment3")); }