Add asserts to write test
This commit is contained in:
parent
5babd30c03
commit
8902d51c14
@ -17,18 +17,21 @@ public class CanWriteProducts : IDisposable
|
|||||||
_reader = RhSolutionsAddIn.ServiceProvider.GetRequiredService<IReader>();
|
_reader = RhSolutionsAddIn.ServiceProvider.GetRequiredService<IReader>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[ExcelFact(Workbook = @"TestWorkbooks\TestSpecificaion.xlsx")]
|
[ExcelFact(Workbook = @"TestWorkbooks\TestSpecification.xlsx")]
|
||||||
public void CanWrite()
|
public void CanWriteSingle()
|
||||||
{
|
{
|
||||||
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
|
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
|
||||||
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecifictaion.xlsx"));
|
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecification.xlsx"));
|
||||||
var products = _reader.ReadProducts(new[] { sourceSheet });
|
var products = _reader.ReadProducts(new[] { sourceSheet });
|
||||||
var _writer = new ExcelWriter(Util.Application, RhSolutionsAddIn.Configuration);
|
var _writer = new ExcelWriter(Util.Application, RhSolutionsAddIn.Configuration);
|
||||||
_writer.WriteProducts(products);
|
_writer.WriteProducts(products);
|
||||||
Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet;
|
Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet;
|
||||||
var targetProducts = _reader.ReadProducts(new[] { targetSheet });
|
var targetProducts = _reader.ReadProducts(new[] { targetSheet });
|
||||||
|
|
||||||
|
Assert.Equal("TestSpecification", products.First().Item1);
|
||||||
|
Assert.Equal("TargetSpecification", targetProducts.First().Item1);
|
||||||
Assert.Equal(products.First().Item2.Count(), targetProducts.First().Item2.Count());
|
Assert.Equal(products.First().Item2.Count(), targetProducts.First().Item2.Count());
|
||||||
|
Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -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\TestSpecificaion.xlsx">
|
<None Update="TestWorkbooks\TestSpecification.xlsx">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user