Add new variant writing test

This commit is contained in:
Sergey Chebotar 2023-05-21 15:21:20 +03:00
parent de73af8b7d
commit 58f5c5ba4a
3 changed files with 19 additions and 1 deletions

View File

@ -51,7 +51,6 @@ public class CanWriteProducts : IDisposable
Assert.True(Enumerable.SequenceEqual(products.First().Item2, targetProducts.First().Item2));
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationNotFound.xlsx")]
public void CanWriteNotFound()
{
@ -86,6 +85,25 @@ public class CanWriteProducts : IDisposable
Assert.Contains("15555551555", product.Name);
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationNewVariant.xlsx")]
public void CanWriteNewVariant()
{
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationNewVariant.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("TestSpecificationNewVariant", products.First().Item1);
Assert.Equal("TargetSpecificationNewVariant", 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()
{
_addIn.AutoClose();