chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Quintiq file version 2.0
#parent: #root
Method VerifyData (
  MacroPlan macroplan
)
{
  Description: 'Verified imported data as per the export'
  TextBody:
  [*
    ssname := UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::SalesSegmentName();
    ss := select(  macroplan, SalesSegment_MP, segment, segment.Name() = ssname, true );
    
    nrofspec := counter( macroplan, SalesSegment_MP.PostponementSpecification, s, true, true );
    if ( this.Run().AssertEqual( 1, nrofspec, "Found " + [String]nrofspec + " postponement spec, expect 1." ) )
    {
      nrofrestriction := counter( macroplan, SalesSegment_MP.FulfillmentRestriction, r, true, true );
      if ( this.Run().AssertEqual( 1, nrofrestriction, "Found " + [String]nrofrestriction + " fulfillment restriction, expect 1." ) )
      {
        if ( this.Run().AssertNotIsNull( ss, "VerifyData: Sales segment " + ssname + " not found." ) )
        {
          pps := ss.PostponementSpecification();
          validspec := pps.HorizonTimeUnit() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::HorizonTimeUnit()
                       and pps.HorizonNrOfTimeUnit() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::HorizonTimeNumber()
                       and pps.MaxNrOfTimeUnit() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::MaxTimeNumber()
                       and pps.MaxTimeUnit() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::MaxTimeUnit();
          
          if ( this.Run().AssertTrue( validspec, 
                                      "Postponement spec with "
                                      + "SalesSegment " + ssname                              
                                      + ", HorizonTimeUnit " + UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::HorizonTimeUnit()
                                      + ", HorizonNrOfTimeUnit " + [String]UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::HorizonTimeNumber()
                                      + ", MaxNrOfTimeUnit " + [String]UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::MaxTimeNumber()
                                      + ", MaxTimeUnit " + UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::MaxTimeUnit()
                                      + " not found" ) )
          {
            validrestriction := exists( ss,
                                        FulfillmentRestriction,
                                        r,
                                        r.EndDate() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::RestrictionEndDate()
                                        and r.StartDate() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::RestrictionStartDate()
                                        and r.ProductID() = UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::RestrictionProductID() );
          
            this.Run().AssertTrue( validrestriction,
                                    "Fulfillment restriction with "                                                            
                                    + "SalesSegment " + ssname                            
                                    + ", EndDate " + [String]UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::RestrictionEndDate()
                                    + ", StartDate " + [String]UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::RestrictionStartDate()
                                    + ", ProductID " + UTF_UnitTestMPPostponementSpecAndFulfillmentRestrictionExcelImport::RestrictionProductID()
                                    + " not found" );
          }
        }
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}