Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method VerifyInventoryLevelEndAndAge ( 
 | 
  ProductInStockingPoint_MP pisp, 
 | 
  Date startdate, 
 | 
  Real inventorylevel, 
 | 
  String age, 
 | 
  Boolean isproductshelflifeok, 
 | 
  Boolean isequal 
 | 
) 
 | 
{ 
 | 
  Description: 'Verify the inventory level and age of the inventory' 
 | 
  TextBody: 
 | 
  [* 
 | 
    pispip := select(  pisp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pisipip, pisipip.Start().Date() = startdate ); 
 | 
     
 | 
    if( this.Run().AssertNotIsNull( pispip, 'PISPIP for ' + pisp.Name() + " on " + startdate.Format( "D-M-Y" ) + " not found." ) ) 
 | 
    { 
 | 
      shelflife := pispip.ShelfLife(); 
 | 
      if( this.Run().AssertNotIsNull( shelflife, " Shelf life is null." ) ) 
 | 
      {     
 | 
        agestr := this.GetShelflifeInventoryAge( shelflife ); 
 | 
        if ( isequal ) 
 | 
        { 
 | 
         this.Run().AssertEqual( inventorylevel, pispip.InventoryLevelEnd(), "Inventory level end not match for PISPIP start on " + startdate.Format( "D-M-Y" ) ); 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
         this.Run().AssertLessOrEqual( inventorylevel, pispip.InventoryLevelEnd(), "Inventory level end not match for PISPIP start on " + startdate.Format( "D-M-Y" ) ); 
 | 
        }  
 | 
         
 | 
        this.Run().AssertEqual( age, agestr, " Age not match for PISPIP start on " +  startdate.Format( "D-M-Y") );  
 | 
        this.Run().AssertEqual( isproductshelflifeok, pispip.IsProductShelfLifeOK(), "PISPIP.IsProductShelfLifeOK not as expected for PISPIP start on " +  startdate.Format( "D-M-Y" ) );  
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |