2006-12-04 Marek Sieradzki <marek.sieradzki@gmail.com>
[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                 [Category ("NotWorking")]
165                 public void TestAdditionalLibPaths ()
166                 {
167                         MCExtended mc = new MCExtended ();
168                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
169                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
170
171                         mc.AdditionalLibPaths = new string [2] { "A", "B" };
172                         mc.ARFC (c1);
173                         mc.ACLC (c2);
174                         
175                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
176                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
177                 }
178
179                 [Test]
180                 public void TestAddModules ()
181                 {
182                         MCExtended mc = new MCExtended ();
183                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
184                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
185
186                         mc.AddModules = new string [2] { "A", "B" };
187                         mc.ARFC (c1);
188                         mc.ACLC (c2);
189                         
190                         Assert.AreEqual ("/addmodule:A,B", c1.ToString (), "A1");
191                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
192                 }
193
194                 [Test]
195                 public void TestCodePage1 ()
196                 {
197                         MCExtended mc = new MCExtended ();
198                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
199                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
200
201                         mc.CodePage = 1111;
202                         mc.ARFC (c1);
203                         mc.ACLC (c2);
204                         
205                         Assert.AreEqual ("/codepage:1111", c1.ToString (), "A1");
206                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
207                 }
208
209                 [Test]
210                 public void TestCodePage2 ()
211                 {
212                         MCExtended mc = new MCExtended ();
213                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
214                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
215
216                         mc.ARFC (c1);
217                         mc.ACLC (c2);
218                         
219                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
220                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
221                 }
222                 
223                 [Test]
224                 public void TestDebugType ()
225                 {
226                         MCExtended mc = new MCExtended ();
227                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
228                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
229
230                         mc.DebugType = "A";
231                         mc.ARFC (c1);
232                         mc.ACLC (c2);
233                         
234                         Assert.AreEqual ("/debug:A", c1.ToString (), "A1");
235                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
236                 }
237
238                 [Test]
239                 [Category ("NotWorking")]
240                 public void TestDefineConstants ()
241                 {
242                         MCExtended mc = new MCExtended ();
243                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
244                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
245
246                         mc.DefineConstants = "A;B";
247                         mc.ARFC (c1);
248                         mc.ACLC (c2);
249                         
250                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
251                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
252                 }
253
254                 [Test]
255                 public void TestDelaySign1 ()
256                 {
257                         MCExtended mc = new MCExtended ();
258                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
259                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
260
261                         mc.DelaySign = true;
262                         mc.ARFC (c1);
263                         mc.ACLC (c2);
264                         
265                         Assert.AreEqual ("/delaysign+", c1.ToString (), "A1");
266                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
267                 }
268
269                 [Test]
270                 public void TestDelaySign2 ()
271                 {
272                         MCExtended mc = new MCExtended ();
273                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
274                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
275
276                         mc.DelaySign = false;
277                         mc.ARFC (c1);
278                         mc.ACLC (c2);
279                         
280                         Assert.AreEqual ("/delaysign-", c1.ToString (), "A1");
281                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
282                 }
283
284                 [Test]
285                 public void TestEmitDebugInformation1 ()
286                 {
287                         MCExtended mc = new MCExtended ();
288                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
289                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
290
291                         mc.EmitDebugInformation = true;
292                         mc.ARFC (c1);
293                         mc.ACLC (c2);
294                         
295                         Assert.AreEqual ("/debug+", c1.ToString (), "A1");
296                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
297                 }
298
299                 [Test]
300                 public void TestEmitDebugInformation2 ()
301                 {
302                         MCExtended mc = new MCExtended ();
303                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
304                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
305
306                         mc.EmitDebugInformation = false;
307                         mc.ARFC (c1);
308                         mc.ACLC (c2);
309                         
310                         Assert.AreEqual ("/debug-", c1.ToString (), "A1");
311                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
312                 }
313
314                 [Test]
315                 [Category ("NotWorking")]
316                 public void TestFileAlignment1 ()
317                 {
318                         MCExtended mc = new MCExtended ();
319                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
320                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
321
322                         mc.FileAlignment = 100;
323                         mc.ARFC (c1);
324                         mc.ACLC (c2);
325                         
326                         Assert.AreEqual ("/filealign:100", c1.ToString (), "A1");
327                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
328                 }
329
330                 [Test]
331                 public void TestFileAlignment2 ()
332                 {
333                         MCExtended mc = new MCExtended ();
334                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
335                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
336
337                         mc.ARFC (c1);
338                         mc.ACLC (c2);
339                         
340                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
341                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
342                 }
343
344                 [Test]
345                 public void TestKeyContainer ()
346                 {
347                         MCExtended mc = new MCExtended ();
348                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
349                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
350
351                         mc.KeyContainer = "A";
352                         mc.ARFC (c1);
353                         mc.ACLC (c2);
354                         
355                         Assert.AreEqual ("/keycontainer:A", c1.ToString (), "A1");
356                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
357                 }
358
359                 [Test]
360                 public void TestKeyFile ()
361                 {
362                         MCExtended mc = new MCExtended ();
363                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
364                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
365
366                         mc.KeyFile = "A";
367                         mc.ARFC (c1);
368                         mc.ACLC (c2);
369                         
370                         Assert.AreEqual ("/keyfile:A", c1.ToString (), "A1");
371                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
372                 }
373
374                 [Test]
375                 public void TestLinkResources ()
376                 {
377                         MCExtended mc = new MCExtended ();
378                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
379                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
380
381                         mc.LinkResources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
382                         mc.ARFC (c1);
383                         mc.ACLC (c2);
384                         
385                         Assert.AreEqual ("/linkresource:A /linkresource:B", c1.ToString (), "A1");
386                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
387                 }
388
389                 [Test]
390                 [Category ("NotWorking")]
391                 public void TestMainEntryPoint ()
392                 {
393                         MCExtended mc = new MCExtended ();
394                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
395                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
396
397                         mc.MainEntryPoint = "A";
398                         mc.ARFC (c1);
399                         mc.ACLC (c2);
400                         
401                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
402                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
403                 }
404                 
405                 [Test]
406                 public void TestNoConfig1 ()
407                 {
408                         MCExtended mc = new MCExtended ();
409                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
410                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
411
412                         mc.NoConfig = true;
413                         mc.ARFC (c1);
414                         mc.ACLC (c2);
415                         
416                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
417                         Assert.AreEqual ("/noconfig", c2.ToString (), "A2");
418                 }
419
420                 [Test]
421                 public void TestNoConfig2 ()
422                 {
423                         MCExtended mc = new MCExtended ();
424                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
425                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
426
427                         mc.NoConfig = false;
428                         mc.ARFC (c1);
429                         mc.ACLC (c2);
430                         
431                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
432                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
433                 }
434
435                 [Test]
436                 public void TestNoLogo1 ()
437                 {
438                         MCExtended mc = new MCExtended ();
439                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
440                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
441
442                         mc.NoLogo = true;
443                         mc.ARFC (c1);
444                         mc.ACLC (c2);
445                         
446                         Assert.AreEqual ("/nologo", c1.ToString (), "A1");
447                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
448                 }
449
450                 [Test]
451                 public void TestNoLogo2 ()
452                 {
453                         MCExtended mc = new MCExtended ();
454                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
455                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
456
457                         mc.NoLogo = false;
458                         mc.ARFC (c1);
459                         mc.ACLC (c2);
460                         
461                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
462                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
463                 }
464
465                 [Test]
466                 public void TestOptimize1 ()
467                 {
468                         MCExtended mc = new MCExtended ();
469                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
470                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
471
472                         mc.Optimize = true;
473                         mc.ARFC (c1);
474                         mc.ACLC (c2);
475                         
476                         Assert.AreEqual ("/optimize+", c1.ToString (), "A1");
477                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
478                 }
479
480                 [Test]
481                 public void TestOptimize2 ()
482                 {
483                         MCExtended mc = new MCExtended ();
484                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
485                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
486
487                         mc.Optimize = false;
488                         mc.ARFC (c1);
489                         mc.ACLC (c2);
490                         
491                         Assert.AreEqual ("/optimize-", c1.ToString (), "A1");
492                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
493                 }
494
495                 [Test]
496                 public void TestOutputAssembly ()
497                 {
498                         MCExtended mc = new MCExtended ();
499                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
500                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
501
502                         mc.OutputAssembly = new TaskItem ("A");
503                         mc.ARFC (c1);
504                         mc.ACLC (c2);
505                         
506                         Assert.AreEqual ("/out:A", c1.ToString (), "A1");
507                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
508                 }
509
510                 [Test]
511                 [Category ("NotWorking")]
512                 public void TestReferences ()
513                 {
514                         MCExtended mc = new MCExtended ();
515                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
516                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
517
518                         mc.References = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
519                         mc.ARFC (c1);
520                         mc.ACLC (c2);
521                         
522                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
523                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
524                 }
525
526                 [Test]
527                 public void TestResources ()
528                 {
529                         MCExtended mc = new MCExtended ();
530                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
531                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
532
533                         mc.Resources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
534                         mc.ARFC (c1);
535                         mc.ACLC (c2);
536                         
537                         Assert.AreEqual ("/resource:A /resource:B", c1.ToString (), "A1");
538                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
539                 }
540
541                 [Test]
542                 [Category ("NotWorking")]
543                 public void TestResponseFiles ()
544                 {
545                         MCExtended mc = new MCExtended ();
546                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
547                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
548
549                         mc.ResponseFiles = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
550                         mc.ARFC (c1);
551                         mc.ACLC (c2);
552                         
553                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
554                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
555                 }
556
557                 [Test]
558                 [Category ("NotWorking")]
559                 public void TestSources ()
560                 {
561                         MCExtended mc = new MCExtended ();
562                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
563                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
564
565                         mc.Sources = new ITaskItem [2] { new TaskItem ("A"), new TaskItem ("B") };
566                         mc.ARFC (c1);
567                         mc.ACLC (c2);
568                         
569                         Assert.AreEqual ("/out:A.exe A B", c1.ToString (), "A1");
570                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
571                 }
572
573                 [Test]
574                 public void TestTargetType ()
575                 {
576                         MCExtended mc = new MCExtended ();
577                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
578                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
579
580                         mc.TargetType = "A";
581                         mc.ARFC (c1);
582                         mc.ACLC (c2);
583                         
584                         Assert.AreEqual ("/target:a", c1.ToString (), "A1");
585                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
586                 }
587                 
588                 [Test]
589                 public void TestTreatWarningsAsErrors1 ()
590                 {
591                         MCExtended mc = new MCExtended ();
592                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
593                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
594
595                         mc.TreatWarningsAsErrors = true;
596                         mc.ARFC (c1);
597                         mc.ACLC (c2);
598                         
599                         Assert.AreEqual ("/warnaserror+", c1.ToString (), "A1");
600                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
601                 }
602
603                 [Test]
604                 public void TestTreatWarningsAsErrors2 ()
605                 {
606                         MCExtended mc = new MCExtended ();
607                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
608                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
609
610                         mc.TreatWarningsAsErrors = false;
611                         mc.ARFC (c1);
612                         mc.ACLC (c2);
613                         
614                         Assert.AreEqual ("/warnaserror-", c1.ToString (), "A1");
615                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
616                 }
617                 
618                 [Test]
619                 [Category ("NotWorking")]
620                 public void TestUtf8Output1 ()
621                 {
622                         MCExtended mc = new MCExtended ();
623                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
624                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
625
626                         mc.Utf8Output = true;
627                         mc.ARFC (c1);
628                         mc.ACLC (c2);
629                         
630                         Assert.AreEqual ("/utf8output", c1.ToString (), "A1");
631                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
632                 }
633
634                 [Test]
635                 public void TestUtf8Output2 ()
636                 {
637                         MCExtended mc = new MCExtended ();
638                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
639                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
640
641                         mc.Utf8Output = false;
642                         mc.ARFC (c1);
643                         mc.ACLC (c2);
644                         
645                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
646                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
647                 }
648
649                 [Test]
650                 public void TestWin32Icon ()
651                 {
652                         MCExtended mc = new MCExtended ();
653                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
654                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
655
656                         mc.Win32Icon = "A";
657                         mc.ARFC (c1);
658                         mc.ACLC (c2);
659                         
660                         Assert.AreEqual ("/win32icon:A", c1.ToString (), "A1");
661                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
662                 }
663
664                 [Test]
665                 [Category ("NotWorking")]
666                 public void TestWin32Resource ()
667                 {
668                         MCExtended mc = new MCExtended ();
669                         CommandLineBuilderExtension c1 = new CommandLineBuilderExtension ();
670                         CommandLineBuilderExtension c2 = new CommandLineBuilderExtension ();
671
672                         mc.Win32Resource = "A;B";
673                         mc.ARFC (c1);
674                         mc.ACLC (c2);
675                         
676                         Assert.AreEqual (String.Empty, c1.ToString (), "A1");
677                         Assert.AreEqual (String.Empty, c2.ToString (), "A2");
678                 }
679
680                 [Test]
681                 public void TestCheckAllReferencesExistOnDisk1 ()
682                 {
683                         MCExtended mc = new MCExtended ();
684                         mc.BuildEngine = new TestEngine ();
685                         
686                         mc.References = new ITaskItem [0];
687                         Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (), "A1");
688
689                         mc.References = null;
690                         Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (), "A2");
691
692                         mc.References = new ITaskItem [1] { new TaskItem (@"Test\resources\test.cs") };
693                         Assert.IsTrue (mc.CheckAllReferencesExistOnDisk (), "A3");
694
695                         mc.References = new ITaskItem [2] { new TaskItem (@"Test\resources\test.cs"), new TaskItem ("X") };
696                         Assert.IsFalse (mc.CheckAllReferencesExistOnDisk (), "A4");
697                 }
698         }
699 }
700