@@ -44,31 +44,34 @@ internal override void InternalExecute()
44
44
{
45
45
Trace . WriteLine ( string . Format ( "Copy: {0}" , sourceVar . Name ) ) ;
46
46
ITestVariable targetVar = GetVar ( targetTmc . Project . TestVariables , sourceVar . Name ) ;
47
- if ( targetVar ! = null )
47
+ if ( targetVar = = null )
48
48
{
49
- Trace . WriteLine ( string . Format ( " Exists: {0}" , sourceVar . Name ) ) ;
50
- // match values
51
- foreach ( var sourceVal in sourceVar . AllowedValues )
52
- {
53
- Trace . WriteLine ( string . Format ( " Seeking: {0}" , sourceVal . Value ) ) ;
54
- ITestVariableValue targetVal = GetVal ( targetVar , sourceVal . Value ) ;
55
- if ( targetVal != null )
56
- {
57
- Trace . WriteLine ( string . Format ( " Exists: {0}" , targetVal . Value ) ) ;
58
-
59
- } else
60
- {
61
- Trace . WriteLine ( string . Format ( " Need to create: {0}" , targetVal . Value ) ) ;
62
- throw new NotImplementedException ( ) ;
63
- }
64
- }
49
+ Trace . WriteLine ( string . Format ( " Need to create: {0}" , sourceVar . Name ) ) ;
50
+ targetVar = targetTmc . Project . TestVariables . Create ( ) ;
51
+ targetVar . Name = sourceVar . Name ;
52
+ targetVar . Save ( ) ;
65
53
}
66
54
else
67
55
{
68
- Trace . WriteLine ( string . Format ( " Need to create: {0}" , sourceVar . Name ) ) ;
69
- throw new NotImplementedException ( ) ;
56
+ Trace . WriteLine ( string . Format ( " Exists: {0}" , sourceVar . Name ) ) ;
57
+ }
58
+ // match values
59
+ foreach ( var sourceVal in sourceVar . AllowedValues )
60
+ {
61
+ Trace . WriteLine ( string . Format ( " Seeking: {0}" , sourceVal . Value ) ) ;
62
+ ITestVariableValue targetVal = GetVal ( targetVar , sourceVal . Value ) ;
63
+ if ( targetVal == null )
64
+ {
65
+ Trace . WriteLine ( string . Format ( " Need to create: {0}" , sourceVal . Value ) ) ;
66
+ targetVal = targetTmc . Project . TestVariables . CreateVariableValue ( sourceVal . Value ) ;
67
+ targetVar . AllowedValues . Add ( targetVal ) ;
68
+ targetVar . Save ( ) ;
69
+ }
70
+ else
71
+ {
72
+ Trace . WriteLine ( string . Format ( " Exists: {0}" , targetVal . Value ) ) ;
73
+ }
70
74
}
71
-
72
75
73
76
}
74
77
}
0 commit comments