Add Not Found Writing Test

This commit is contained in:
Sergey Chebotar 2023-05-21 15:13:17 +03:00
parent fbb36fb00d
commit d4ef078b9d
3 changed files with 18 additions and 0 deletions

View File

@ -51,6 +51,24 @@ public class CanWriteProducts : IDisposable
Assert.True(Enumerable.SequenceEqual(products.First().Item2, targetProducts.First().Item2)); Assert.True(Enumerable.SequenceEqual(products.First().Item2, targetProducts.First().Item2));
} }
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationNotFound.xlsx")]
public void CanWriteNotFound()
{
Worksheet sourceSheet = Util.Workbook.Worksheets[1];
RhSolutionsAddIn.Configuration.SetPriceListPath(Path.GetFullPath(@"..\..\..\TestWorkbooks\TargetSpecificationNotFound.xlsx"));
var products = _reader.ReadProducts(new[] { sourceSheet });
var _writer = new ExcelWriter(Util.Application, RhSolutionsAddIn.Configuration);
_writer.WriteProducts(products);
Worksheet targetSheet = Util.Application.ActiveWindow.ActiveSheet;
Assert.Equal("???", targetSheet.Range["B4"].Value2);
Assert.Contains("Молот Тора", targetSheet.Range["C4"].Value2);
Assert.Contains("15555551555", targetSheet.Range["C4"].Value2);
}
public void Dispose() public void Dispose()
{ {
_addIn.AutoClose(); _addIn.AutoClose();