Add unit test for AggregateException.GetBaseException that works on .net but is broke...
[mono.git] / mcs / class / Microsoft.Build.Tasks / Test / Microsoft.Build.Tasks / ManagedCompilerTest.cs
1 //
2 // ManagedCompilerTest.cs
3 //
4 // Author:
5 //   Marek Sieradzki (marek.sieradzki@gmail.com)
6 //
7 // (C) 2006 Marek Sieradzki
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 using System;
29 using System.Collections;
30 using Microsoft.Build.BuildEngine;
31 using Microsoft.Build.Framework;
32 using Microsoft.Build.Tasks;
33 using Microsoft.Build.Utilities;
34 using NUnit.Framework;
35
36 namespace MonoTests.Microsoft.Build.Tasks {
37
38         class MCExtended : ManagedCompiler {
39                 public MCExtended ()
40                         : base ()
41                 {
42                 }
43
44                 public void ARFC (CommandLineBuilderExtension commandLine)
45                 {
46                         base.AddResponseFileCommands (commandLine);
47                 }
48
49                 public void ACLC (CommandLineBuilderExtension commandLine)
50                 {
51                         base.AddCommandLineCommands (commandLine);
52                 }
53
54                 public new bool CheckAllReferencesExistOnDisk ()
55                 {
56                         return base.CheckAllReferencesExistOnDisk ();
57                 }
58                         
59
60                 protected override string ToolName {
61                         get { return "something"; }
62                 }
63
64                 protected override string GenerateFullPathToTool ()
65                 {
66                         return null;
67                 }
68         }
69
70         [TestFixture]
71         public class ManagedCompilerTest {
72                 
73                 [Test]
74                 public void TestAssignment ()
75                 {
76                         MCExtended mc = new MCExtended ();
77
78                         mc.AdditionalLibPaths = new string [1] { "1" };
79                         mc.AddModules = new string [1] { "2" };
80                         mc.CodePage = 3;
81                         mc.DebugType = "4";
82                         mc.DefineConstants = "5";
83                         mc.DelaySign = true;
84                         mc.EmitDebugInformation = true;
85                         mc.FileAlignment = 6;
86                         mc.KeyContainer = "7";
87                         mc.KeyFile = "8";
88                         mc.LinkResources = new ITaskItem [1] { new TaskItem ("9") };
89                         mc.MainEntryPoint = "10";
90                         mc.NoConfig = true;
91                         mc.NoLogo = true;
92                         mc.Optimize = true;
93                         mc.OutputAssembly = new TaskItem ("11");
94                         mc.References = new ITaskItem [1] { new TaskItem ("12") };
95                         mc.Resources = new ITaskItem [1] { new TaskItem ("13") };
96                         mc.ResponseFiles = new ITaskItem [1] { new TaskItem ("14") };
97                         mc.Sources = new ITaskItem [1] { new TaskItem ("15") };
98                         mc.TargetType = "16";
99                         mc.TreatWarningsAsErrors = true;
100                         mc.Utf8Output = true;
101                         mc.Win32Icon = "17";
102                         mc.Win32Resource = "18";
103
104                         Assert.AreEqual ("1", mc.AdditionalLibPaths [0], "A1");
105                         Assert.AreEqual ("2", mc.AddModules [0], "A2");
106                         Assert.AreEqual (3, mc.CodePage, "A3");
107                         Assert.AreEqual ("4", mc.DebugType, "A4");
108                         Assert.AreEqual ("5", mc.DefineConstants, "A5");
109                         Assert.AreEqual (true, mc.DelaySign, "A6");
110                         Assert.AreEqual (true, mc.EmitDebugInformation, "A7");
111                         Assert.AreEqual (6, mc.FileAlignment, "A8");
112                         Assert.AreEqual ("7", mc.KeyContainer, "A9");
113                         Assert.AreEqual ("8", mc.KeyFile, "A10");
114                         Assert.AreEqual ("9", mc.LinkResources [0].ItemSpec, "A11");
115                         Assert.AreEqual ("10", mc.MainEntryPoint, "A12");
116                         Assert.AreEqual (true, mc.NoConfig, "A13");
117                         Assert.AreEqual (true, mc.NoLogo, "A14");
118                         Assert.AreEqual (true, mc.Optimize, "A15");
119                         Assert.AreEqual ("11", mc.OutputAssembly.ItemSpec, "A16");
120                         Assert.AreEqual ("12", mc.References [0].ItemSpec, "A17");
121                         Assert.AreEqual ("13", mc.Resources [0].ItemSpec, "A18");
122                         Assert.AreEqual ("14", mc.ResponseFiles [0].ItemSpec, "A19");
123                         Assert.AreEqual ("15", mc.Sources [0].ItemSpec, "A20");
124                         Assert.AreEqual ("16", mc.TargetType, "A21");
125                         Assert.AreEqual (true, mc.TreatWarningsAsErrors, "A22");
126                         Assert.AreEqual (true, mc.Utf8Output, "A23");
127                         Assert.AreEqual ("17", mc.Win32Icon, "A24");
128                         Assert.AreEqual ("18", mc.Win32Resource, "A25");
129                 }
130
131                 [Test]
132                 public void TestDefaultValues ()
133                 {
134                         MCExtended mc = new MCExtended ();
135
136                         Assert.IsNull (mc.AdditionalLibPaths, "A1");
137                         Assert.IsNull (mc.AddModules, "A2");
138                         Assert.AreEqual (0, mc.CodePage, "A3");
139                         Assert.IsNull (mc.DebugType, "A4");
140                         Assert.IsNull (mc.DefineConstants, "A5");
141                         Assert.IsFalse (mc.DelaySign, "A6");
142                         Assert.IsFalse (mc.EmitDebugInformation, "A7");
143                         Assert.AreEqual (0, mc.FileAlignment, "A8");
144                         Assert.IsNull (mc.KeyContainer, "A9");
145                         Assert.IsNull (mc.KeyFile, "A10");
146                         Assert.IsNull (mc.LinkResources, "A11");
147                         Assert.IsNull (mc.MainEntryPoint, "A12");
148                         Assert.IsFalse (mc.NoConfig, "A13");
149                         Assert.IsFalse (mc.NoLogo, "A14");
150                         Assert.IsFalse (mc.Optimize, "A15");
151                         Assert.IsNull (mc.OutputAssembly, "A16");
152                         Assert.IsNull (mc.References, "A17");
153                         Assert.IsNull (mc.Resources, "A18");
154                         Assert.IsNull (mc.ResponseFiles, "A19");
155                         Assert.IsNull (mc.Sources, "A20");
156                         Assert.IsNull (mc.TargetType, "A21");
157                         Assert.IsFalse (mc.TreatWarningsAsErrors, "A22");
158                         Assert.IsFalse (mc.Utf8Output, "A23");
159                         Assert.IsNull (mc.Win32Icon, "A24");
160                         Assert.IsNull (mc.Win32Resource, "A25");
161                 }
162
163                 [Test]
164                 public void TestAdditionalLibPaths ()
165                 {
166                         MCExtended mc = new MCExtended ();
167                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
168                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
169
170                         mc.AdditionalLibPaths = new string [2] { "A", "B" };
171                         mc.ARFC (c1);
172                         mc.ACLC (c2);
173                         
174                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
175                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
176                 }
177
178                 [Test]
179                 public void TestAddModules ()
180                 {
181                         MCExtended mc = new MCExtended ();
182                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
183                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
184
185                         mc.AddModules = new string [2] { "A", "B" };
186                         mc.ARFC (c1);
187                         mc.ACLC (c2);
188                         
189                         Assert.AreEqual ("/addmodule:A,B", c1.ToString (), "A1");
190                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
191                 }
192
193                 [Test]
194                 public void TestCodePage1 ()
195                 {
196                         MCExtended mc = new MCExtended ();
197                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
198                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
199
200                         mc.CodePage = 1111;
201                         mc.ARFC (c1);
202                         mc.ACLC (c2);
203                         
204                         Assert.AreEqual ("/codepage:1111", c1.ToString (), "A1");
205                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
206                 }
207
208                 [Test]
209                 public void TestCodePage2 ()
210                 {
211                         MCExtended mc = new MCExtended ();
212                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
213                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
214
215                         mc.ARFC (c1);
216                         mc.ACLC (c2);
217                         
218                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
219                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
220                 }
221                 
222                 [Test]
223                 public void TestDebugType ()
224                 {
225                         MCExtended mc = new MCExtended ();
226                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
227                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
228
229                         mc.DebugType = "A";
230                         mc.ARFC (c1);
231                         mc.ACLC (c2);
232                         
233                         Assert.AreEqual ("/debug:A", c1.ToString (), "A1");
234                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
235                 }
236
237                 [Test]
238                 public void TestDefineConstants ()
239                 {
240                         MCExtended mc = new MCExtended ();
241                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
242                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
243
244                         mc.DefineConstants = "A;B";
245                         mc.ARFC (c1);
246                         mc.ACLC (c2);
247                         
248                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
249                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
250                 }
251
252                 [Test]
253                 public void TestDelaySign1 ()
254                 {
255                         MCExtended mc = new MCExtended ();
256                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
257                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
258
259                         mc.DelaySign = true;
260                         mc.ARFC (c1);
261                         mc.ACLC (c2);
262                         
263                         Assert.AreEqual ("/delaysign+", c1.ToString (), "A1");
264                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
265                 }
266
267                 [Test]
268                 public void TestDelaySign2 ()
269                 {
270                         MCExtended mc = new MCExtended ();
271                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
272                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
273
274                         mc.DelaySign = false;
275                         mc.ARFC (c1);
276                         mc.ACLC (c2);
277                         
278                         Assert.AreEqual ("/delaysign-", c1.ToString (), "A1");
279                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
280                 }
281
282                 [Test]
283                 public void TestEmitDebugInformation1 ()
284                 {
285                         MCExtended mc = new MCExtended ();
286                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
287                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
288
289                         mc.EmitDebugInformation = true;
290                         mc.ARFC (c1);
291                         mc.ACLC (c2);
292                         
293                         Assert.AreEqual ("/debug+", c1.ToString (), "A1");
294                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
295                 }
296
297                 [Test]
298                 public void TestEmitDebugInformation2 ()
299                 {
300                         MCExtended mc = new MCExtended ();
301                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
302                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
303
304                         mc.EmitDebugInformation = false;
305                         mc.ARFC (c1);
306                         mc.ACLC (c2);
307                         
308                         Assert.AreEqual ("/debug-", c1.ToString (), "A1");
309                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
310                 }
311
312                 [Test]
313                 [Category ("NotWorking")]
314                 public void TestFileAlignment1 ()
315                 {
316                         MCExtended mc = new MCExtended ();
317                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
318                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
319
320                         mc.FileAlignment = 100;
321                         mc.ARFC (c1);
322                         mc.ACLC (c2);
323                         
324                         Assert.AreEqual ("/filealign:100", c1.ToString (), "A1");
325                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
326                 }
327
328                 [Test]
329                 public void TestFileAlignment2 ()
330                 {
331                         MCExtended mc = new MCExtended ();
332                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
333                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
334
335                         mc.ARFC (c1);
336                         mc.ACLC (c2);
337                         
338                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
339                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
340                 }
341
342                 [Test]
343                 public void TestKeyContainer ()
344                 {
345                         MCExtended mc = new MCExtended ();
346                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
347                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
348
349                         mc.KeyContainer = "A";
350                         mc.ARFC (c1);
351                         mc.ACLC (c2);
352                         
353                         Assert.AreEqual ("/keycontainer:A", c1.ToString (), "A1");
354                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
355                 }
356
357                 [Test]
358                 public void TestKeyFile ()
359                 {
360                         MCExtended mc = new MCExtended ();
361                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
362                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
363
364                         mc.KeyFile = "A";
365                         mc.ARFC (c1);
366                         mc.ACLC (c2);
367                         
368                         Assert.AreEqual ("/keyfile:A", c1.ToString (), "A1");
369                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
370                 }
371
372                 [Test]
373                 public void TestLinkResources ()
374                 {
375                         MCExtended mc = new MCExtended ();
376                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
377                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
378
379                         mc.LinkResources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
380                         mc.ARFC (c1);
381                         mc.ACLC (c2);
382                         
383                         Assert.AreEqual ("/linkresource:A /linkresource:B", c1.ToString (), "A1");
384                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
385                 }
386
387                 [Test]
388                 public void TestMainEntryPoint ()
389                 {
390                         MCExtended mc = new MCExtended ();
391                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
392                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
393
394                         mc.MainEntryPoint = "A";
395                         mc.ARFC (c1);
396                         mc.ACLC (c2);
397                         
398                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
399                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
400                 }
401                 
402                 [Test]
403                 public void TestNoConfig1 ()
404                 {
405                         MCExtended mc = new MCExtended ();
406                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
407                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
408
409                         mc.NoConfig = true;
410                         mc.ARFC (c1);
411                         mc.ACLC (c2);
412                         
413                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
414                         Assert.AreEqual ("/noconfig", c2.ToString (), "A2");
415                 }
416
417                 [Test]
418                 public void TestNoConfig2 ()
419                 {
420                         MCExtended mc = new MCExtended ();
421                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
422                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
423
424                         mc.NoConfig = false;
425                         mc.ARFC (c1);
426                         mc.ACLC (c2);
427                         
428                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
429                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
430                 }
431
432                 [Test]
433                 public void TestNoLogo1 ()
434                 {
435                         MCExtended mc = new MCExtended ();
436                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
437                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
438
439                         mc.NoLogo = true;
440                         mc.ARFC (c1);
441                         mc.ACLC (c2);
442                         
443                         Assert.AreEqual ("/nologo", c1.ToString (), "A1");
444                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
445                 }
446
447                 [Test]
448                 public void TestNoLogo2 ()
449                 {
450                         MCExtended mc = new MCExtended ();
451                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
452                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
453
454                         mc.NoLogo = false;
455                         mc.ARFC (c1);
456                         mc.ACLC (c2);
457                         
458                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
459                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
460                 }
461
462                 [Test]
463                 public void TestOptimize1 ()
464                 {
465                         MCExtended mc = new MCExtended ();
466                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
467                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
468
469                         mc.Optimize = true;
470                         mc.ARFC (c1);
471                         mc.ACLC (c2);
472                         
473                         Assert.AreEqual ("/optimize+", c1.ToString (), "A1");
474                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
475                 }
476
477                 [Test]
478                 public void TestOptimize2 ()
479                 {
480                         MCExtended mc = new MCExtended ();
481                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
482                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
483
484                         mc.Optimize = false;
485                         mc.ARFC (c1);
486                         mc.ACLC (c2);
487                         
488                         Assert.AreEqual ("/optimize-", c1.ToString (), "A1");
489                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
490                 }
491
492                 [Test]
493                 public void TestOutputAssembly ()
494                 {
495                         MCExtended mc = new MCExtended ();
496                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
497                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
498
499                         mc.OutputAssembly = new TaskItem ("A");
500                         mc.ARFC (c1);
501                         mc.ACLC (c2);
502                         
503                         Assert.AreEqual ("/out:A", c1.ToString (), "A1");
504                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
505                 }
506
507                 [Test]
508                 public void TestReferences ()
509                 {
510                         MCExtended mc = new MCExtended ();
511                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
512                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
513
514                         mc.References = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
515                         mc.ARFC (c1);
516                         mc.ACLC (c2);
517                         
518                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
519                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
520                 }
521
522                 [Test]
523                 public void TestResources ()
524                 {
525                         MCExtended mc = new MCExtended ();
526                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
527                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
528
529                         mc.Resources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
530                         mc.ARFC (c1);
531                         mc.ACLC (c2);
532                         
533                         Assert.AreEqual ("/resource:A /resource:B", c1.ToString (), "A1");
534                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
535                 }
536
537                 [Test]
538                 public void TestResponseFiles ()
539                 {
540                         MCExtended mc = new MCExtended ();
541                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
542                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
543
544                         mc.ResponseFiles = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
545                         mc.ARFC (c1);
546                         mc.ACLC (c2);
547                         
548                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
549                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
550                 }
551
552                 [Test]
553                 public void TestSources ()
554                 {
555                         MCExtended mc = new MCExtended ();
556                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
557                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
558
559                         mc.Sources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
560                         mc.ARFC (c1);
561                         mc.ACLC (c2);
562                         
563                         Assert.AreEqual ("/out:A.exe A B", c1.ToString (), "A1");
564                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
565                 }
566
567                 [Test]
568                 public void TestTargetType ()
569                 {
570                         MCExtended mc = new MCExtended ();
571                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
572                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
573
574                         mc.TargetType = "A";
575                         mc.ARFC (c1);
576                         mc.ACLC (c2);
577                         
578                         Assert.AreEqual ("/target:a", c1.ToString (), "A1");
579                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
580                 }
581                 
582                 [Test]
583                 public void TestTreatWarningsAsErrors1 ()
584                 {
585                         MCExtended mc = new MCExtended ();
586                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
587                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
588
589                         mc.TreatWarningsAsErrors = true;
590                         mc.ARFC (c1);
591                         mc.ACLC (c2);
592                         
593                         Assert.AreEqual ("/warnaserror+", c1.ToString (), "A1");
594                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
595                 }
596
597                 [Test]
598                 public void TestTreatWarningsAsErrors2 ()
599                 {
600                         MCExtended mc = new MCExtended ();
601                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
602                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
603
604                         mc.TreatWarningsAsErrors = false;
605                         mc.ARFC (c1);
606                         mc.ACLC (c2);
607                         
608                         Assert.AreEqual ("/warnaserror-", c1.ToString (), "A1");
609                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
610                 }
611                 
612                 [Test]
613                 [Category ("NotWorking")]
614                 public void TestUtf8Output1 ()
615                 {
616                         MCExtended mc = new MCExtended ();
617                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
618                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
619
620                         mc.Utf8Output = true;
621                         mc.ARFC (c1);
622                         mc.ACLC (c2);
623                         
624                         Assert.AreEqual ("/utf8output", c1.ToString (), "A1");
625                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
626                 }
627
628                 [Test]
629                 public void TestUtf8Output2 ()
630                 {
631                         MCExtended mc = new MCExtended ();
632                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
633                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
634
635                         mc.Utf8Output = false;
636                         mc.ARFC (c1);
637                         mc.ACLC (c2);
638                         
639                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
640                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
641                 }
642
643                 [Test]
644                 public void TestWin32Icon ()
645                 {
646                         MCExtended mc = new MCExtended ();
647                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
648                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
649
650                         mc.Win32Icon = "A";
651                         mc.ARFC (c1);
652                         mc.ACLC (c2);
653                         
654                         Assert.AreEqual ("/win32icon:A", c1.ToString (), "A1");
655                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
656                 }
657
658                 [Test]
659                 public void TestWin32Resource ()
660                 {
661                         MCExtended mc = new MCExtended ();
662                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
663                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
664
665                         mc.Win32Resource = "A;B";
666                         mc.ARFC (c1);
667                         mc.ACLC (c2);
668                         
669                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
670                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
671                 }
672
673                 [Test]
674                 public void TestCheckAllReferencesExistOnDisk1 ()
675                 {
676                         MCExtended mc = new MCExtended ();
677                         mc.BuildEngine = new TestEngine ();
678                         
679                         mc.References = new ITaskItem [0];
680                         Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (), "A1");
681
682                         mc.References = null;
683                         Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (), "A2");
684
685                         mc.References = new ITaskItem [1] { new TaskItem (@"Test\resources\test.cs") };
686                         Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (), "A3");
687
688                         mc.References = new ITaskItem [2] { new TaskItem (@"Test\resources\test.cs"), new TaskItem ("X") };
689                         Assert.IsFalse (mc.CheckAllReferencesExistOnDisk (), "A4");
690                 }
691         }
692 }
693