1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| Quintiq file version 2.0
| #parent: #root
| Method VerifyMinMaxDailyCapacity (
| Unit unit,
| DateTime start,
| DateTime end,
| Real expectedMin,
| Real expectedMax
| )
| {
| Description: 'Verify planning unit periods min and max capacity based on daily capacity.'
| TextBody:
| [*
| // Select all planning unit periods within the range of dates
| unitPeriods := selectset( unit, PlanningUnitPeriod.astype( UnitPeriodQuantity ), up, up.Start() >= start and up.End() <= end );
| traverse( unitPeriods, Elements, unitPeriod )
| {
| minCapacityExpected := unitPeriod.Period_MP().DurationInDays() * expectedMin;
| maxCapacityExpected := unitPeriod.Period_MP().DurationInDays() * expectedMax; // Cater of leap years
|
| // Verify min and max capacities
| this.Run().AssertEqual( minCapacityExpected, unitPeriod.TotalMinCapacity(), this.GetMinCapacityErrorMessage( unit, minCapacityExpected, unitPeriod ) );
| this.Run().AssertEqual( maxCapacityExpected, unitPeriod.TotalMaxCapacity(), this.GetMaxCapacityErrorMessage( unit, maxCapacityExpected, unitPeriod ) );
| }
| *]
| InterfaceProperties { Accessibility: 'Module' }
| }
|
|