Add Replaced Writing Test

This commit is contained in:
Sergey Chebotar 2023-05-21 15:17:49 +03:00
parent d4ef078b9d
commit de73af8b7d
3 changed files with 17 additions and 0 deletions

View File

@ -67,7 +67,24 @@ public class CanWriteProducts : IDisposable
Assert.Contains("15555551555", targetSheet.Range["C4"].Value2); Assert.Contains("15555551555", targetSheet.Range["C4"].Value2);
} }
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationReplaced.xlsx")]
public void CanWriteReplaced()
{
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationReplaced.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("TestSpecificationReplaced", products.First().Item1);
Assert.Equal("TargetSpecificationReplaced", targetProducts.First().Item1);
Assert.Single(targetProducts.First().Item2);
var product = targetProducts.First().Item2.First().Key;
Assert.Contains("Молот Тора", product.Name);
Assert.Contains("15555551555", product.Name);
}
public void Dispose() public void Dispose()
{ {