Add couplings calculator test
This commit is contained in:
parent
9fd1fd8266
commit
02d0b21a58
41
RhSolutions.Tests/CanFillCouplings.cs
Normal file
41
RhSolutions.Tests/CanFillCouplings.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
using RhSolutions.AddIn;
|
||||||
|
|
||||||
|
namespace RhSolutions.Tests;
|
||||||
|
|
||||||
|
[ExcelTestSettings(OutOfProcess = true)]
|
||||||
|
public class CanFillCouplings : IDisposable
|
||||||
|
{
|
||||||
|
private RhSolutionsAddIn _addIn;
|
||||||
|
private IFittingsCalculator _calculator;
|
||||||
|
private IReader _reader;
|
||||||
|
private IWriter _writer;
|
||||||
|
private Worksheet _worksheet;
|
||||||
|
|
||||||
|
public CanFillCouplings()
|
||||||
|
{
|
||||||
|
_addIn = new();
|
||||||
|
_addIn.AutoOpen();
|
||||||
|
_calculator = new CouplingsCalculator();
|
||||||
|
_reader = new ExcelReader(Util.Application, RhSolutionsAddIn.Configuration);
|
||||||
|
_writer = new CurrentPriceWriter(Util.Application, RhSolutionsAddIn.Configuration);
|
||||||
|
_worksheet = Util.Workbook.Worksheets[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
[ExcelFact(Workbook = @"..\..\..\TestWorkbooks\TestSpecificationCouplings.xlsx")]
|
||||||
|
public void CanCalculateSleeves()
|
||||||
|
{
|
||||||
|
var products = _reader.ReadProducts(new[] { _worksheet });
|
||||||
|
var couplings = _calculator.Calculate(products.First().Item2);
|
||||||
|
_writer.WriteProducts(couplings);
|
||||||
|
|
||||||
|
Assert.Equal(7, _worksheet.Range["E2"].Value);
|
||||||
|
Assert.Equal(1, _worksheet.Range["E3"].Value);
|
||||||
|
Assert.Equal(1, _worksheet.Range["E5"].Value);
|
||||||
|
Assert.Equal(1, _worksheet.Range["E7"].Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_addIn.AutoClose();
|
||||||
|
}
|
||||||
|
}
|
BIN
RhSolutions.Tests/TestWorkbooks/TestSpecificationCouplings.xlsx
Normal file
BIN
RhSolutions.Tests/TestWorkbooks/TestSpecificationCouplings.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user