Add one row guess test

This commit is contained in:
Sergey Chebotar 2023-05-23 14:39:49 +03:00
parent 9840e0fb24
commit 9d2f386a74
3 changed files with 18 additions and 1 deletions

View File

@ -18,7 +18,7 @@ public class CanDoGuess : IDisposable
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationGuess.xlsx")]
public void CanWrite()
public void CanWriteMultiplyRows()
{
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuess.xlsx"));
@ -34,6 +34,23 @@ public class CanDoGuess : IDisposable
Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum());
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationGuessOneRow.xlsx")]
public void CanWriteOneRow()
{
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuessOneRow.xlsx"));
var products = _reader.ReadProducts(new[] { sourceSheet });
var _writer = new ExcelWriter(Util.Application, RhSolutionsAddIn.Configuration);
_writer.WriteProducts(products);
Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet;
var targetProducts = _reader.ReadProducts(new[] { targetSheet });
Assert.Equal("TestSpecificationGuessOneRow", products.First().Item1);
Assert.Equal("TargetSpecificationGuessOneRow", targetProducts.First().Item1);
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()
{
_addIn.AutoClose();