Add new variant writing test
This commit is contained in:
parent
de73af8b7d
commit
58f5c5ba4a
@ -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();
|
||||
|
Binary file not shown.
BIN
RhSolutions.Tests/TestWorkbooks/TestSpecificationNewVariant.xlsx
Normal file
BIN
RhSolutions.Tests/TestWorkbooks/TestSpecificationNewVariant.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user