Add Workbook read tests

This commit is contained in:
Sergey Chebotar 2023-05-16 18:05:35 +03:00
parent ade18e5e40
commit aca468c015
4 changed files with 9 additions and 6 deletions

View File

@ -45,14 +45,17 @@ public class CanReadProducts : IDisposable
Assert.Equal(3, products.Count()); Assert.Equal(3, products.Count());
} }
[ExcelFact(Workbook = @"TestWorkbooks\Specifications\HeatingFloor.xlsx")] [ExcelFact(Workbook = @"TestWorkbooks\TestSpecificaion.xlsx")]
public void CanReadWorkbook() public void CanReadWorkbook()
{ {
Worksheet worksheet = Util.Workbook.Worksheets[1]; Worksheet worksheet = Util.Workbook.Worksheets[1];
var products = _reader.ReadProducts(new[] { worksheet }); var result = _reader.ReadProducts(new[] { worksheet });
Assert.NotNull(result);
Assert.NotNull(products); Assert.NotEmpty(result);
Assert.NotEmpty(products); Assert.Equal("TestSpecificaion", result.First().Item1);
var products = result.First().Item2;
Assert.Equal(46, products.Count());
Assert.Equal(29266, products.Sum(p => p.Value));
} }
public void Dispose() public void Dispose()

View File

@ -27,7 +27,7 @@
<None Update="TestWorkbooks\ExcelTableTest.xlsx"> <None Update="TestWorkbooks\ExcelTableTest.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="TestWorkbooks\Specifications\HeatingFloor.xlsx"> <None Update="TestWorkbooks\TestSpecificaion.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

Binary file not shown.