@@ -57,7 +57,8 @@ public void ConstructorWithNullName()
57
57
taskLocation : @"c:\my tasks\mytask.dll" ,
58
58
taskParameters : null ,
59
59
globalParameters : null ,
60
- warningsAsErrors : null ) ;
60
+ warningsAsErrors : null ,
61
+ warningsAsMessages : null ) ;
61
62
}
62
63
) ;
63
64
}
@@ -90,7 +91,8 @@ public void ConstructorWithEmptyName()
90
91
taskLocation : @"c:\my tasks\mytask.dll" ,
91
92
taskParameters : null ,
92
93
globalParameters : null ,
93
- warningsAsErrors : null ) ;
94
+ warningsAsErrors : null ,
95
+ warningsAsMessages : null ) ;
94
96
}
95
97
) ;
96
98
}
@@ -123,7 +125,8 @@ public void ConstructorWithNullLocation()
123
125
taskLocation : null ,
124
126
taskParameters : null ,
125
127
globalParameters : null ,
126
- warningsAsErrors : null ) ;
128
+ warningsAsErrors : null ,
129
+ warningsAsMessages : null ) ;
127
130
}
128
131
) ;
129
132
}
@@ -158,7 +161,8 @@ public void ConstructorWithEmptyLocation()
158
161
taskLocation : String . Empty ,
159
162
taskParameters : null ,
160
163
globalParameters : null ,
161
- warningsAsErrors : null ) ;
164
+ warningsAsErrors : null ,
165
+ warningsAsMessages : null ) ;
162
166
}
163
167
) ;
164
168
}
@@ -191,26 +195,32 @@ public void TestValidConstructors()
191
195
taskLocation : @"c:\MyTasks\MyTask.dll" ,
192
196
taskParameters : null ,
193
197
globalParameters : null ,
194
- warningsAsErrors : null ) ;
198
+ warningsAsErrors : null ,
199
+ warningsAsMessages : null ) ;
195
200
196
201
TaskHostConfiguration config2 = new TaskHostConfiguration (
197
- 1 ,
198
- Directory . GetCurrentDirectory ( ) ,
199
- null ,
200
- Thread . CurrentThread . CurrentCulture ,
201
- Thread . CurrentThread . CurrentUICulture ,
202
+ nodeId : 1 ,
203
+ startupDirectory : Directory . GetCurrentDirectory ( ) ,
204
+ buildProcessEnvironment : null ,
205
+ culture : Thread . CurrentThread . CurrentCulture ,
206
+ uiCulture : Thread . CurrentThread . CurrentUICulture ,
207
+ #if FEATURE_APPDOMAIN
208
+ appDomainSetup :
202
209
#if FEATURE_APPDOMAIN
203
210
null ,
211
+ #endif
212
+ lineNumberOfTask:
204
213
#endif
205
214
1 ,
206
- 1 ,
207
- @"c:\my project\myproj.proj" ,
208
- _continueOnErrorDefault ,
209
- "TaskName" ,
210
- @"c:\MyTasks\MyTask.dll" ,
211
- null ,
212
- null ,
213
- null ) ;
215
+ columnNumberOfTask : 1 ,
216
+ projectFileOfTask : @"c:\my project\myproj.proj" ,
217
+ continueOnError : _continueOnErrorDefault ,
218
+ taskName : "TaskName" ,
219
+ taskLocation : @"c:\MyTasks\MyTask.dll" ,
220
+ taskParameters : null ,
221
+ globalParameters : null ,
222
+ warningsAsErrors : null ,
223
+ warningsAsMessages : null ) ;
214
224
215
225
IDictionary < string , object > parameters = new Dictionary < string , object > ( ) ;
216
226
TaskHostConfiguration config3 = new TaskHostConfiguration (
@@ -234,7 +244,8 @@ public void TestValidConstructors()
234
244
taskLocation : @"c:\MyTasks\MyTask.dll" ,
235
245
taskParameters : parameters ,
236
246
globalParameters : null ,
237
- warningsAsErrors : null ) ;
247
+ warningsAsErrors : null ,
248
+ warningsAsMessages : null ) ;
238
249
239
250
IDictionary < string , object > parameters2 = new Dictionary < string , object > ( ) ;
240
251
parameters2 . Add ( "Text" , "Hello!" ) ;
@@ -263,7 +274,8 @@ public void TestValidConstructors()
263
274
taskLocation : @"c:\MyTasks\MyTask.dll" ,
264
275
taskParameters : parameters2 ,
265
276
globalParameters : null ,
266
- warningsAsErrors : null ) ;
277
+ warningsAsErrors : null ,
278
+ warningsAsMessages : null ) ;
267
279
268
280
HashSet < string > WarningsAsErrors = new HashSet < string > ( ) ;
269
281
WarningsAsErrors . Add ( "MSB1234" ) ;
@@ -292,7 +304,8 @@ public void TestValidConstructors()
292
304
taskLocation : @"c:\MyTasks\MyTask.dll" ,
293
305
taskParameters : parameters2 ,
294
306
globalParameters : null ,
295
- warningsAsErrors : WarningsAsErrors ) ;
307
+ warningsAsErrors : WarningsAsErrors ,
308
+ warningsAsMessages : null ) ;
296
309
}
297
310
298
311
/// <summary>
@@ -328,7 +341,8 @@ public void TestTranslationWithNullDictionary()
328
341
taskLocation : @"c:\MyTasks\MyTask.dll" ,
329
342
taskParameters : null ,
330
343
globalParameters : expectedGlobalProperties ,
331
- warningsAsErrors : null ) ;
344
+ warningsAsErrors : null ,
345
+ warningsAsMessages : null ) ;
332
346
333
347
( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
334
348
INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -371,7 +385,8 @@ public void TestTranslationWithEmptyDictionary()
371
385
taskLocation : @"c:\MyTasks\MyTask.dll" ,
372
386
taskParameters : new Dictionary < string , object > ( ) ,
373
387
globalParameters : new Dictionary < string , string > ( ) ,
374
- warningsAsErrors : null ) ;
388
+ warningsAsErrors : null ,
389
+ warningsAsMessages : null ) ;
375
390
376
391
( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
377
392
INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -419,7 +434,8 @@ public void TestTranslationWithValueTypesInDictionary()
419
434
taskLocation : @"c:\MyTasks\MyTask.dll" ,
420
435
taskParameters : parameters ,
421
436
globalParameters : null ,
422
- warningsAsErrors : null ) ;
437
+ warningsAsErrors : null ,
438
+ warningsAsMessages : null ) ;
423
439
424
440
( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
425
441
INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -465,7 +481,8 @@ public void TestTranslationWithITaskItemInDictionary()
465
481
taskLocation : @"c:\MyTasks\MyTask.dll" ,
466
482
taskParameters : parameters ,
467
483
globalParameters : null ,
468
- warningsAsErrors : null ) ;
484
+ warningsAsErrors : null ,
485
+ warningsAsMessages : null ) ;
469
486
470
487
( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
471
488
INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -510,7 +527,8 @@ public void TestTranslationWithITaskItemArrayInDictionary()
510
527
taskLocation : @"c:\MyTasks\MyTask.dll" ,
511
528
taskParameters : parameters ,
512
529
globalParameters : null ,
513
- warningsAsErrors : null ) ;
530
+ warningsAsErrors : null ,
531
+ warningsAsMessages : null ) ;
514
532
515
533
( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
516
534
INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -562,7 +580,8 @@ public void TestTranslationWithWarningsAsErrors()
562
580
taskLocation : @"c:\MyTasks\MyTask.dll" ,
563
581
taskParameters : null ,
564
582
globalParameters : null ,
565
- warningsAsErrors : WarningsAsErrors ) ;
583
+ warningsAsErrors : WarningsAsErrors ,
584
+ warningsAsMessages : null ) ;
566
585
567
586
( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
568
587
INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
@@ -578,6 +597,50 @@ public void TestTranslationWithWarningsAsErrors()
578
597
579
598
}
580
599
600
+ /// <summary>
601
+ /// Test serialization / deserialization when the parameter dictionary contains warningsasmessages
602
+ /// </summary>
603
+ [ Fact ]
604
+ public void TestTranslationWithWarningsAsMessages ( )
605
+ {
606
+ HashSet < string > WarningsAsMessages = new HashSet < string > ( ) ;
607
+ WarningsAsMessages . Add ( "MSB1234" ) ;
608
+ WarningsAsMessages . Add ( "MSB1235" ) ;
609
+ WarningsAsMessages . Add ( "MSB1236" ) ;
610
+ WarningsAsMessages . Add ( "MSB1237" ) ;
611
+ TaskHostConfiguration config = new TaskHostConfiguration (
612
+ nodeId : 1 ,
613
+ startupDirectory : Directory . GetCurrentDirectory ( ) ,
614
+ buildProcessEnvironment : null ,
615
+ culture : Thread . CurrentThread . CurrentCulture ,
616
+ uiCulture : Thread . CurrentThread . CurrentUICulture ,
617
+ #if FEATURE_APPDOMAIN
618
+ appDomainSetup :
619
+ #if FEATURE_APPDOMAIN
620
+ null ,
621
+ #endif
622
+ lineNumberOfTask:
623
+ #endif
624
+ 1 ,
625
+ columnNumberOfTask : 1 ,
626
+ projectFileOfTask : @"c:\my project\myproj.proj" ,
627
+ continueOnError : _continueOnErrorDefault ,
628
+ taskName : "TaskName" ,
629
+ taskLocation : @"c:\MyTasks\MyTask.dll" ,
630
+ taskParameters : null ,
631
+ globalParameters : null ,
632
+ warningsAsErrors : null ,
633
+ warningsAsMessages : WarningsAsMessages ) ;
634
+
635
+ ( ( ITranslatable ) config ) . Translate ( TranslationHelpers . GetWriteTranslator ( ) ) ;
636
+ INodePacket packet = TaskHostConfiguration . FactoryForDeserialization ( TranslationHelpers . GetReadTranslator ( ) ) ;
637
+
638
+ TaskHostConfiguration deserializedConfig = packet as TaskHostConfiguration ;
639
+
640
+ Assert . NotNull ( deserializedConfig . WarningsAsMessages ) ;
641
+ config . WarningsAsMessages . SequenceEqual ( deserializedConfig . WarningsAsMessages , StringComparer . Ordinal ) . ShouldBeTrue ( ) ;
642
+ }
643
+
581
644
/// <summary>
582
645
/// Helper methods for testing the task host-related packets.
583
646
/// </summary>
0 commit comments