diff --git a/RhSolutions.Tests/CanWriteProducts.cs b/RhSolutions.Tests/CanWriteProducts.cs index 9280d5f..c89bb71 100644 --- a/RhSolutions.Tests/CanWriteProducts.cs +++ b/RhSolutions.Tests/CanWriteProducts.cs @@ -67,7 +67,24 @@ public class CanWriteProducts : IDisposable 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() { diff --git a/RhSolutions.Tests/TestWorkbooks/TargetSpecificationReplaced.xlsx b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationReplaced.xlsx new file mode 100644 index 0000000..af7d045 Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationReplaced.xlsx differ diff --git a/RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx b/RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx new file mode 100644 index 0000000..7900714 Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx differ