haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
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
Quintiq file version 2.0
#parent: #root
Method VerifyIncludeExclude (
  MacroPlan macroplan,
  String scenario
)
{
  TextBody:
  [*
    // Setup optimizer puzzle and subset(s)
    this->( utf ) {
      opt := OptimizerPuzzle::Create( macroplan, 'OptTest', '', false, false, null( OptimizerPuzzleWIP ) );
      return opt;
    }
    ->( opt ) {
      this.VerifyIncludeExcludeSetupSubset( opt, scenario );
      return opt;
    }
    ->( opt ) {
      lines := scenario.Tokenize( String::NewLine() );
      expectedDefaultAllIncluded := this.VerifyIncludeExcludeGetDefaultAllIncluded( lines );
      
      expectedStockingPoints := this.VerifyIncludeExcludeSetupExpectationStockingPoints( macroplan, lines, expectedDefaultAllIncluded );
      expectedUnits := this.VerifyIncludeExcludeSetupExpectationUnits( macroplan, lines, expectedDefaultAllIncluded );
      
      // Assert
      actualUnits := opt.GetIncludedUnits();
      this.Run().AssertTrue( expectedUnits.Size() = actualUnits.Size() and expectedUnits.ContainsAll( actualUnits ),
                             'Expected $0 unit(s), but found $1.'.ReplaceAll( '$0', [String]expectedUnits.Size() ).ReplaceAll( '$1', [String]actualUnits.Size() ) );
      
      actualStockingPoints := opt.GetIncludedStockingPoints( actualUnits );
      this.Run().AssertTrue( expectedStockingPoints.Size() = actualStockingPoints.Size() and expectedStockingPoints.ContainsAll( actualStockingPoints ),
                             'Expected $0 stocking point(s), but found $1.'.ReplaceAll( '$0', [String]expectedStockingPoints.Size() ).ReplaceAll( '$1', [String]actualStockingPoints.Size() ) );
                             
      return opt;
    }
    ->( opt ) {
      opt.Delete();
    }
  *]
  InterfaceProperties { Accessibility: 'Module' }
}