Migrate ExcelIO from ClosedXML to NPOI
This commit is contained in:
@@ -1,89 +1,90 @@
|
||||
using ClosedXML.Excel;
|
||||
using JdeScoping.ExcelIO.Tests.Fixtures;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
namespace JdeScoping.ExcelIO.Tests.Integration;
|
||||
|
||||
public class SearchResultsSheetTests : IClassFixture<WithResultsFixture>
|
||||
{
|
||||
private readonly XLWorkbook _workbook;
|
||||
private readonly IXLWorksheet _sheet;
|
||||
private readonly List<string> _headers;
|
||||
|
||||
public SearchResultsSheetTests(WithResultsFixture fixture)
|
||||
{
|
||||
_workbook = fixture.Workbook;
|
||||
_sheet = _workbook.Worksheet("Search Results");
|
||||
_headers = ExcelTestHelpers.GetHeadersFromSheet(_sheet);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnCount_Is19()
|
||||
{
|
||||
_headers.Count.ShouldBe(19);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnHeaders_MatchExpected()
|
||||
{
|
||||
_headers.ShouldContain("Work Order Number");
|
||||
_headers.ShouldContain("Work Order Branch Code");
|
||||
_headers.ShouldContain("Lot Number");
|
||||
_headers.ShouldContain("Item Number");
|
||||
_headers.ShouldContain("Planning Family");
|
||||
_headers.ShouldContain("Stocking Type");
|
||||
_headers.ShouldContain("Order Quantity");
|
||||
_headers.ShouldContain("Held Quantity");
|
||||
_headers.ShouldContain("Scrapped Quantity");
|
||||
_headers.ShouldContain("Shipped Quantity");
|
||||
_headers.ShouldContain("Operation Step Branch Code");
|
||||
_headers.ShouldContain("Operation Step");
|
||||
_headers.ShouldContain("Operation Step Description");
|
||||
_headers.ShouldContain("Function Operation Description");
|
||||
_headers.ShouldContain("Operation Step Update Timestamp");
|
||||
_headers.ShouldContain("Status Code");
|
||||
_headers.ShouldContain("Status Description");
|
||||
_headers.ShouldContain("Status Update Timestamp");
|
||||
_headers.ShouldContain("Inclusion Reason");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnOrder_MatchesSpec()
|
||||
{
|
||||
_headers[0].ShouldBe("Work Order Number");
|
||||
_headers[1].ShouldBe("Work Order Branch Code");
|
||||
_headers[2].ShouldBe("Lot Number");
|
||||
_headers[3].ShouldBe("Item Number");
|
||||
_headers[4].ShouldBe("Planning Family");
|
||||
_headers[5].ShouldBe("Stocking Type");
|
||||
_headers[6].ShouldBe("Order Quantity");
|
||||
_headers[7].ShouldBe("Held Quantity");
|
||||
_headers[8].ShouldBe("Scrapped Quantity");
|
||||
_headers[9].ShouldBe("Shipped Quantity");
|
||||
_headers[10].ShouldBe("Operation Step Branch Code");
|
||||
_headers[11].ShouldBe("Operation Step");
|
||||
_headers[12].ShouldBe("Operation Step Description");
|
||||
_headers[13].ShouldBe("Function Operation Description");
|
||||
_headers[14].ShouldBe("Operation Step Update Timestamp");
|
||||
_headers[15].ShouldBe("Status Code");
|
||||
_headers[16].ShouldBe("Status Description");
|
||||
_headers[17].ShouldBe("Status Update Timestamp");
|
||||
_headers[18].ShouldBe("Inclusion Reason");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TableStyle_IsLight18()
|
||||
{
|
||||
var table = _sheet.Tables.First();
|
||||
table.Theme.ShouldBe(XLTableTheme.TableStyleLight18);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DataRow_ContainsExpectedValues()
|
||||
{
|
||||
_sheet.Cell(2, 1).Value.GetNumber().ShouldBe(12345);
|
||||
_sheet.Cell(2, 3).Value.GetText().ShouldBe("LOT-001");
|
||||
_sheet.Cell(2, 4).Value.GetText().ShouldBe("ITEM-001");
|
||||
}
|
||||
}
|
||||
using JdeScoping.ExcelIO.Tests.Fixtures;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
|
||||
namespace JdeScoping.ExcelIO.Tests.Integration;
|
||||
|
||||
public class SearchResultsSheetTests : IClassFixture<WithResultsFixture>
|
||||
{
|
||||
private readonly XSSFWorkbook _workbook;
|
||||
private readonly ISheet _sheet;
|
||||
private readonly List<string> _headers;
|
||||
|
||||
public SearchResultsSheetTests(WithResultsFixture fixture)
|
||||
{
|
||||
_workbook = fixture.Workbook;
|
||||
_sheet = _workbook.GetSheet("Search Results")!;
|
||||
_headers = ExcelTestHelpers.GetHeadersFromSheet(_sheet);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnCount_Is19()
|
||||
{
|
||||
_headers.Count.ShouldBe(19);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnHeaders_MatchExpected()
|
||||
{
|
||||
_headers.ShouldContain("Work Order Number");
|
||||
_headers.ShouldContain("Work Order Branch Code");
|
||||
_headers.ShouldContain("Lot Number");
|
||||
_headers.ShouldContain("Item Number");
|
||||
_headers.ShouldContain("Planning Family");
|
||||
_headers.ShouldContain("Stocking Type");
|
||||
_headers.ShouldContain("Order Quantity");
|
||||
_headers.ShouldContain("Held Quantity");
|
||||
_headers.ShouldContain("Scrapped Quantity");
|
||||
_headers.ShouldContain("Shipped Quantity");
|
||||
_headers.ShouldContain("Operation Step Branch Code");
|
||||
_headers.ShouldContain("Operation Step");
|
||||
_headers.ShouldContain("Operation Step Description");
|
||||
_headers.ShouldContain("Function Operation Description");
|
||||
_headers.ShouldContain("Operation Step Update Timestamp");
|
||||
_headers.ShouldContain("Status Code");
|
||||
_headers.ShouldContain("Status Description");
|
||||
_headers.ShouldContain("Status Update Timestamp");
|
||||
_headers.ShouldContain("Inclusion Reason");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ColumnOrder_MatchesSpec()
|
||||
{
|
||||
_headers[0].ShouldBe("Work Order Number");
|
||||
_headers[1].ShouldBe("Work Order Branch Code");
|
||||
_headers[2].ShouldBe("Lot Number");
|
||||
_headers[3].ShouldBe("Item Number");
|
||||
_headers[4].ShouldBe("Planning Family");
|
||||
_headers[5].ShouldBe("Stocking Type");
|
||||
_headers[6].ShouldBe("Order Quantity");
|
||||
_headers[7].ShouldBe("Held Quantity");
|
||||
_headers[8].ShouldBe("Scrapped Quantity");
|
||||
_headers[9].ShouldBe("Shipped Quantity");
|
||||
_headers[10].ShouldBe("Operation Step Branch Code");
|
||||
_headers[11].ShouldBe("Operation Step");
|
||||
_headers[12].ShouldBe("Operation Step Description");
|
||||
_headers[13].ShouldBe("Function Operation Description");
|
||||
_headers[14].ShouldBe("Operation Step Update Timestamp");
|
||||
_headers[15].ShouldBe("Status Code");
|
||||
_headers[16].ShouldBe("Status Description");
|
||||
_headers[17].ShouldBe("Status Update Timestamp");
|
||||
_headers[18].ShouldBe("Inclusion Reason");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TableStyle_IsLight18()
|
||||
{
|
||||
var table = ExcelTestHelpers.GetFirstTable(_sheet);
|
||||
table.StyleName.ShouldBe("TableStyleLight18");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DataRow_ContainsExpectedValues()
|
||||
{
|
||||
ExcelTestHelpers.GetCellNumber(_sheet, 2, 1).ShouldBe(12345);
|
||||
ExcelTestHelpers.GetCellText(_sheet, 2, 3).ShouldBe("LOT-001");
|
||||
ExcelTestHelpers.GetCellText(_sheet, 2, 4).ShouldBe("ITEM-001");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user