diff --git a/RhSolutions.Tests/CanWriteProducts.cs b/RhSolutions.Tests/CanWriteProducts.cs index 3792914..a6ddf38 100644 --- a/RhSolutions.Tests/CanWriteProducts.cs +++ b/RhSolutions.Tests/CanWriteProducts.cs @@ -17,7 +17,7 @@ public class CanWriteProducts : IDisposable _reader = RhSolutionsAddIn.ServiceProvider.GetRequiredService(); } - [ExcelFact(Workbook = @"TestWorkbooks\TestSpecification.xlsx")] + [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecification.xlsx")] public void CanWriteSingle() { Worksheet sourceSheet = Util.Workbook.Worksheets[1]; @@ -34,6 +34,22 @@ public class CanWriteProducts : IDisposable Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum()); } + [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationMultipleProductLines.xlsx")] + public void CanWriteMultipleProductLines() + { + Worksheet sourceSheet = Util.Workbook.Worksheets[1]; + RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationMultipleProductLines.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("TestSpecificationMultipleProductLines", products.First().Item1); + Assert.Equal("TargetSpecificationMultipleProductLines", targetProducts.First().Item1); + Assert.True(Enumerable.SequenceEqual(products.First().Item2, targetProducts.First().Item2)); + } + public void Dispose() { _addIn.AutoClose(); diff --git a/RhSolutions.Tests/TestWorkbooks/TargetSpecificationMultipleProductLines.xlsx b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationMultipleProductLines.xlsx new file mode 100644 index 0000000..a83ff99 Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationMultipleProductLines.xlsx differ diff --git a/RhSolutions.Tests/TestWorkbooks/TestSpecificationMultipleProductLines.xlsx b/RhSolutions.Tests/TestWorkbooks/TestSpecificationMultipleProductLines.xlsx new file mode 100644 index 0000000..0360be6 Binary files /dev/null and b/RhSolutions.Tests/TestWorkbooks/TestSpecificationMultipleProductLines.xlsx differ