Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method CheckFulfillmentForManualPostponedSalesDemand ( 
 | 
  MacroPlan macroplan 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    salessegmentname := 'Carrefour Austria';  
 | 
    salessegment := select( macroplan, SalesSegment_MP, s, true, s.Name() = salessegmentname );  
 | 
     
 | 
    sopyear := macroplan.StartOfPlanning().Year();  
 | 
    startdate := Date::Construct( sopyear, 1, 1 );   
 | 
    postponeddate := Date::Construct( sopyear, 2, 1 );  
 | 
    product := select( macroplan, Product_MP, p, true, p.Name() = 'Lowfat Vanilla 6 pk' );  
 | 
     
 | 
    sd := select( salessegment, SalesDemand, sd, true, sd.StartDate() = startdate and sd.Product_MP() = product );  
 | 
     
 | 
    // Verify 100% fulfillment for sales demand with manual postponement 
 | 
    this.Run().AssertEqual( sd.Quantity(), sd.FulfilledQuantity(), 'Expecting complete fulfillment for ' + salessegmentname + ' ' + product.ID() + [String] startdate ); 
 | 
     
 | 
    // Verify manual postponed sdip is still present 
 | 
    this.Run().AssertEqual( 1,  
 | 
                            counter( sd, SalesDemandInPeriod, sdip, sdip.StartDate() = postponeddate and sdip.ProductID() = product.ID() and sdip.IsManuallyPostponed() ),  
 | 
                            'Expecting manual postponed sales demand to be kept in place' ); 
 | 
    // Verify it is the only manual postponed sales demand  
 | 
    this.Run().AssertEqual( 1,  
 | 
                            counter( macroplan, SalesDemand.SalesDemandInPeriod, sdip, sdip.IsManuallyPostponed() ),  
 | 
                            'Expecting only 1 manually postponed sales demand, namely the single one created for the test' ); 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |