42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using RhSolutions.AddIn;
|
|
|
|
namespace RhSolutions.Tests;
|
|
|
|
[ExcelTestSettings(OutOfProcess = true)]
|
|
public class CanFillSleeves : IDisposable
|
|
{
|
|
private RhSolutionsAddIn _addIn;
|
|
private IFittingsCalculator _calculator;
|
|
private IReader _reader;
|
|
private IWriter _writer;
|
|
private Worksheet _worksheet;
|
|
|
|
public CanFillSleeves()
|
|
{
|
|
Environment.SetEnvironmentVariable("ISTESTING", "true");
|
|
_addIn = new();
|
|
_addIn.AutoOpen();
|
|
_calculator = new SleevesCalculator();
|
|
_reader = new ExcelReader(Util.Application, RhSolutionsAddIn.Configuration);
|
|
_writer = new CurrentPriceWriter(Util.Application, RhSolutionsAddIn.Configuration);
|
|
_worksheet = Util.Workbook.Worksheets[1];
|
|
}
|
|
|
|
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationSleeves.xlsx")]
|
|
public void CanCalculateSleeves()
|
|
{
|
|
var products = _reader.ReadProducts(new[] { _worksheet });
|
|
var sleeves = _calculator.Calculate(products.First().Item2);
|
|
_writer.WriteProducts(sleeves);
|
|
for (int i = 2; i < 14; i++)
|
|
{
|
|
Assert.Equal(_worksheet.Range[$"F{i}"].Value, _worksheet.Range[$"E{i}"].Value);
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_addIn.AutoClose();
|
|
}
|
|
}
|