aboutsummaryrefslogtreecommitdiff
path: root/RhSolutions.Tests
diff options
context:
space:
mode:
Diffstat (limited to 'RhSolutions.Tests')
-rw-r--r--RhSolutions.Tests/CanDoGuess.cs19
-rw-r--r--RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuessOneRow.xlsxbin0 -> 11602 bytes
-rw-r--r--RhSolutions.Tests/TestWorkbooks/TestSpecificationGuessOneRow.xlsxbin0 -> 9069 bytes
3 files changed, 18 insertions, 1 deletions
diff --git a/RhSolutions.Tests/CanDoGuess.cs b/RhSolutions.Tests/CanDoGuess.cs
index c801af7..8e2d71c 100644
--- a/RhSolutions.Tests/CanDoGuess.cs
+++ b/RhSolutions.Tests/CanDoGuess.cs
@@ -18,7 +18,7 @@ public class CanDoGuess : IDisposable
}
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationGuess.xlsx")]
- public void CanWrite()
+ public void CanWriteMultiplyRows()
{
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuess.xlsx"));
@@ -34,6 +34,23 @@ public class CanDoGuess : IDisposable
Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum());
}
+ [ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationGuessOneRow.xlsx")]
+ public void CanWriteOneRow()
+ {
+ Worksheet sourceSheet = Util.Workbook.Worksheets[1];
+ RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationGuessOneRow.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("TestSpecificationGuessOneRow", products.First().Item1);
+ Assert.Equal("TargetSpecificationGuessOneRow", targetProducts.First().Item1);
+ Assert.Equal(products.First().Item2.Count(), targetProducts.First().Item2.Count());
+ Assert.Equal(products.First().Item2.Values.Sum(), targetProducts.First().Item2.Values.Sum());
+ }
+
public void Dispose()
{
_addIn.AutoClose();
diff --git a/RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuessOneRow.xlsx b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuessOneRow.xlsx
new file mode 100644
index 0000000..4501c1e
--- /dev/null
+++ b/RhSolutions.Tests/TestWorkbooks/TargetSpecificationGuessOneRow.xlsx
Binary files differ
diff --git a/RhSolutions.Tests/TestWorkbooks/TestSpecificationGuessOneRow.xlsx b/RhSolutions.Tests/TestWorkbooks/TestSpecificationGuessOneRow.xlsx
new file mode 100644
index 0000000..723789f
--- /dev/null
+++ b/RhSolutions.Tests/TestWorkbooks/TestSpecificationGuessOneRow.xlsx
Binary files differ