diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-05-21 15:17:49 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-05-21 15:17:49 +0300 |
commit | de73af8b7d10fe67aca2eac38e415a76d3d35350 (patch) | |
tree | 18985ba468c7ac9003a04fc3e38e52206edf1b13 /RhSolutions.Tests | |
parent | d4ef078b9db6e54d74effcee77f787bf86dabd4c (diff) |
Add Replaced Writing Test
Diffstat (limited to 'RhSolutions.Tests')
-rw-r--r-- | RhSolutions.Tests/CanWriteProducts.cs | 17 | ||||
-rw-r--r-- | RhSolutions.Tests/TestWorkbooks/TargetSpecificationReplaced.xlsx | bin | 0 -> 9351 bytes | |||
-rw-r--r-- | RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx | bin | 0 -> 9174 bytes |
3 files changed, 17 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 0000000..af7d045 --- /dev/null +++ b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationReplaced.xlsx diff --git a/RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx b/RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx Binary files differnew file mode 100644 index 0000000..7900714 --- /dev/null +++ b/RhSolutions.Tests/TestWorkbooks/TestSpecificationReplaced.xlsx |