perf: optimize ExcelIO tests with fixture-based consolidation
- Add WorkbookFixtureBase and 4 concrete fixtures for shared workbooks - Add ExcelTestHelpers with shared utility methods - Create Integration/ folder with 7 fixture-based test classes: - MinimalSearchTests (5 tests) - SearchResultsSheetTests (5 tests) - MisInfoSheetTests (11 tests) - InvestigationSheetTests (7 tests) - ProtectionAndStyleTests (7 tests) - LegacyFormatTests (5 tests) - LargeDataSetTests (1 test) - Delete redundant ExcelExportIntegrationTests.cs (26 tests) - Delete redundant LegacyComparisonTests.cs (16 tests) - Reduce workbook generations from ~42 to 4 fixtures - Test runtime reduced from ~18 min to ~4 min (76% improvement) - All 122 ExcelIO tests pass
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
using ClosedXML.Excel;
|
||||
using JdeScoping.ExcelIO.Tests.Fixtures;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
namespace JdeScoping.ExcelIO.Tests.Integration;
|
||||
|
||||
public class InvestigationSheetTests : IClassFixture<WithMisDataFixture>
|
||||
{
|
||||
private readonly XLWorkbook _workbook;
|
||||
private readonly IXLWorksheet _sheet;
|
||||
private readonly List<string> _headers;
|
||||
|
||||
public InvestigationSheetTests(WithMisDataFixture fixture)
|
||||
{
|
||||
_workbook = fixture.Workbook;
|
||||
_sheet = _workbook.Worksheet("Investigation");
|
||||
_headers = ExcelTestHelpers.GetHeadersFromSheet(_sheet);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InvestigationSheet_Exists()
|
||||
{
|
||||
_workbook.Worksheets.TryGetWorksheet("Investigation", out _).ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnCount_Is12()
|
||||
{
|
||||
_headers.Count.ShouldBe(12);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnHeaders_MatchExpected()
|
||||
{
|
||||
_headers.ShouldContain("Work Center Code");
|
||||
_headers.ShouldContain("Work Order Number");
|
||||
_headers.ShouldContain("Work Order Start Date");
|
||||
_headers.ShouldContain("Job Step Number");
|
||||
_headers.ShouldContain("Function Operation Description");
|
||||
_headers.ShouldContain("Job Step End Date");
|
||||
_headers.ShouldContain("Function Code");
|
||||
_headers.ShouldContain("Was Job Step Added?");
|
||||
_headers.ShouldContain("Matched Job Step Number");
|
||||
_headers.ShouldContain("Item Number");
|
||||
_headers.ShouldContain("Item Description");
|
||||
_headers.ShouldContain("Routing Type");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnOrder_MatchesSpec()
|
||||
{
|
||||
_headers[0].ShouldBe("Work Center Code");
|
||||
_headers[1].ShouldBe("Work Order Number");
|
||||
_headers[2].ShouldBe("Work Order Start Date");
|
||||
_headers[3].ShouldBe("Job Step Number");
|
||||
_headers[4].ShouldBe("Function Operation Description");
|
||||
_headers[5].ShouldBe("Job Step End Date");
|
||||
_headers[6].ShouldBe("Function Code");
|
||||
_headers[7].ShouldBe("Was Job Step Added?");
|
||||
_headers[8].ShouldBe("Matched Job Step Number");
|
||||
_headers[9].ShouldBe("Item Number");
|
||||
_headers[10].ShouldBe("Item Description");
|
||||
_headers[11].ShouldBe("Routing Type");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TableStyle_IsLight18()
|
||||
{
|
||||
var table = _sheet.Tables.First();
|
||||
table.Theme.ShouldBe(XLTableTheme.TableStyleLight18);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Protection_IsEnabled()
|
||||
{
|
||||
_sheet.Protection.IsProtected.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DataRow_ContainsExpectedValues()
|
||||
{
|
||||
_sheet.Cell(2, 2).Value.GetNumber().ShouldBe(12345);
|
||||
_sheet.Cell(2, 10).Value.GetText().ShouldBe("ITEM-001");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user