2006-12-07 Marek Sieradzki <marek.sieradzki@gmail.com>
authorMarek Sieradzki <msierad@mono-cvs.ximian.com>
Thu, 7 Dec 2006 10:06:31 +0000 (10:06 -0000)
committerMarek Sieradzki <msierad@mono-cvs.ximian.com>
Thu, 7 Dec 2006 10:06:31 +0000 (10:06 -0000)
        * BuildItemTest.cs, BuildPropertyGroupTest.cs, BuildTaskTest.cs,
        UsingTaskCollectionTest.cs, ProjectTest.cs: More tests.

svn path=/trunk/mcs/; revision=69164

mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildItemTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildTaskTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/UsingTaskCollectionTest.cs

index fd14c406f56ddd792038a81fe5fc274cddb9a310..ea63afb88460f62cb183a969c1999445798424f9 100644 (file)
@@ -71,7 +71,42 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        Assert.AreEqual (false, item.IsImported, "A5");
                        Assert.AreEqual (itemName, item.Name, "A6");
                }
-       
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestCtor3 ()
+               {
+                       new BuildItem (null, (string) null);
+               }
+
+               [Test]
+               [Ignore ("NullRefException on MS .NET 2.0")]
+               public void TestCtor4 ()
+               {
+                       new BuildItem (null, (ITaskItem) null);
+               }
+
+               [Test]
+               public void TestCtor5 ()
+               {
+                       new BuildItem (null, "something");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException),
+                       "Parameter \"itemInclude\" cannot have zero length.")]
+               public void TestCtor6 ()
+               {
+                       new BuildItem (null, String.Empty);
+               }
+
+               [Test]
+               [Ignore ("IndexOutOfRange on MS .NET 2.0")]
+               public void TestCtor7 ()
+               {
+                       new BuildItem (String.Empty, "something");
+               }
+
                [Test]
                public void TestCopyCustomMetadataTo1 ()
                {
@@ -155,7 +190,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                }
 
                [Test]
-               public void TestRemoveMetadata ()
+               public void TestRemoveMetadata1 ()
                {
                        string itemName = "a";
                        string itemInclude = "a";
@@ -172,5 +207,52 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
 
                        Assert.AreEqual (false, item.HasMetadata (metadataName), "A2");
                }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestRemoveMetadata2 ()
+               {
+                       item = new BuildItem ("name", "value");
+                       item.RemoveMetadata (null);
+               }
+
+               [Test]
+               public void TestRemoveMetadata3 ()
+               {
+                       item = new BuildItem ("name", "value");
+                       item.RemoveMetadata ("undefined_metadata");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestSetMetadata1 ()
+               {
+                       item = new BuildItem ("name", "include");
+                       item.SetMetadata (null, null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestSetMetadata2 ()
+               {
+                       item = new BuildItem ("name", "include");
+                       item.SetMetadata ("name", null);
+               }
+
+               [Test]
+               public void TestSetMetadata3 ()
+               {
+                       item = new BuildItem ("name", "include");
+                       item.SetMetadata ("a", "$(A)");
+                       item.SetMetadata ("b", "$(A)", true);
+                       item.SetMetadata ("c", "$(A)", false);
+
+                       Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("a"), "A1");
+                       Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("b"), "A2");
+                       Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("c"), "A3");
+                       Assert.AreEqual ("$(A)", item.GetMetadata ("a"), "A4");
+                       Assert.AreEqual (Utilities.Escape ("$(A)"), item.GetMetadata ("b"), "A5");
+                       Assert.AreEqual ("$(A)", item.GetMetadata ("c"), "A6");
+               }
        }
 }
index d9cccf301738d669448080ccd1500ca531749168..ad6de8562ce957674b7527812da0e8ee833fb072 100644 (file)
@@ -48,7 +48,20 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        Assert.AreEqual (0, bpg.Count);
                        Assert.AreEqual (false, bpg.IsImported);
                }
-               
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException),
+                       "This method is only valid for persisted <System.Object[]> elements.")]
+               public void TestAddNewProperty1 ()
+               {
+                       string name = "name";
+                       string value = "value";
+
+                       bpg = new BuildPropertyGroup ();
+
+                       bpg.AddNewProperty (name, value);
+               }
+
                [Test]
                [ExpectedException (typeof (InvalidOperationException),
                        "Properties in persisted property groups cannot be accessed by name.")]
@@ -73,19 +86,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        Assert.AreEqual ("Value", bpg ["Name"].Value, "A3");
                }
 
-               [Test]
-               [ExpectedException (typeof (InvalidOperationException),
-                       "This method is only valid for persisted <System.Object[]> elements.")]
-               public void TestAddNewProperty1 ()
-               {
-                       string name = "name";
-                       string value = "value";
-               
-                       bpg = new BuildPropertyGroup ();
-                       
-                       bpg.AddNewProperty (name, value);
-               }
-               
                [Test]
                public void TestClear ()
                {
@@ -116,5 +116,125 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                
                        Assert.AreEqual (String.Empty, bpg.Condition, "A1");
                }
+
+               [Test]
+               public void TestGetEnumerator ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.SetProperty ("a", "c");
+                       bpg.SetProperty ("b", "d");
+
+                       IEnumerator e = bpg.GetEnumerator ();
+                       e.MoveNext ();
+                       Assert.AreEqual ("a", ((BuildProperty) e.Current).Name, "A1");
+                       Assert.AreEqual ("c", ((BuildProperty) e.Current).Value, "A2");
+                       Assert.AreEqual ("c", ((BuildProperty) e.Current).FinalValue, "A3");
+                       e.MoveNext ();
+                       Assert.AreEqual ("b", ((BuildProperty) e.Current).Name, "A4");
+                       Assert.AreEqual ("d", ((BuildProperty) e.Current).Value, "A5");
+                       Assert.AreEqual ("d", ((BuildProperty) e.Current).FinalValue, "A6");
+
+                       Assert.IsFalse (e.MoveNext ());
+               }
+
+               [Test]
+               [Ignore ("NullRefException on MS .NET 2.0")]
+               public void TestRemoveProperty1 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.RemoveProperty ((BuildProperty) null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestRemoveProperty2 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.SetProperty ("a", "b");
+                       bpg.SetProperty ("c", "d");
+
+                       bpg.RemoveProperty ((string) null);
+               }
+
+               [Test]
+               public void TestRemoveProperty3 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.SetProperty ("a", "b");
+                       bpg.SetProperty ("c", "d");
+
+                       bpg.RemoveProperty ("value_not_in_group");
+               }
+
+               [Test]
+               public void TestRemoveProperty4 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.SetProperty ("a", "b");
+                       bpg.SetProperty ("c", "d");
+
+                       bpg.RemoveProperty (new BuildProperty ("name", "value"));
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestSetProperty1 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.SetProperty (null, null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestSetProperty2 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       bpg.SetProperty ("name", null);
+               }
+
+               [Test]
+               public void TestSetProperty3 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+                       
+                       bpg.SetProperty ("name", "$(A)");
+
+                       BuildProperty bp = bpg ["name"];
+
+                       Assert.AreEqual ("name", bp.Name, "A1");
+                       Assert.AreEqual ("$(A)", bp.Value, "A2");
+                       Assert.AreEqual ("$(A)", bp.FinalValue, "A3");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestSetProperty4 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+
+                       bpg.SetProperty ("P1", "$(A)", true);
+                       bpg.SetProperty ("P2", "$(A)", false);
+
+                       BuildProperty b1 = bpg ["P1"];
+                       BuildProperty b2 = bpg ["P2"];
+
+                       Assert.AreEqual ("P1", b1.Name, "A1");
+                       Assert.AreEqual (Utilities.Escape ("$(A)"), b1.Value, "A2");
+                       Assert.AreEqual ("$(A)", b1.FinalValue, "A3");
+                       Assert.AreEqual ("P2", b2.Name, "A4");
+                       Assert.AreEqual ("$(A)", b2.Value, "A5");
+                       Assert.AreEqual ("$(A)", b2.FinalValue, "A6");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException),
+                       "The name \"1\" contains an invalid character \"1\".")]
+               [Category ("NotWorking")]
+               public void TestSetProperty5 ()
+               {
+                       BuildPropertyGroup bpg = new BuildPropertyGroup ();
+
+                       bpg.SetProperty ("1", "$(A)");
+               }
        }
 }
index be026edda9923280fc2070644b54fc6a3ab6d5d6..c4eded1d9ce0201d52bdef8782cb5306c67d8c9b 100644 (file)
@@ -69,8 +69,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                }
                
                [Test]
-               [ExpectedException (typeof (ArgumentNullException),
-                       "Parameter \"propertyName\" cannot be null.")]
+               [ExpectedException (typeof (ArgumentNullException))]
                public void TestCtor2 ()
                {
                        bp = new BuildProperty (null, "value");
@@ -78,8 +77,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                }
                
                [Test]
-               [ExpectedException (typeof (ArgumentNullException),
-                       "Parameter \"propertyValue\" cannot be null.")]
+               [ExpectedException (typeof (ArgumentNullException))]
                public void TestCtor3 ()
                {
                        bp = new BuildProperty ("name", null);
index addcb482fd069d65ae2a3c52c1f1f4822a50e174..37044d95ee25c4f8b43e4296ebe06f5a051b4b1c 100644 (file)
@@ -285,5 +285,125 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        bt [0].ContinueOnError = false;
                        Assert.IsFalse (bt [0].ContinueOnError, "A4");
                }
+
+               [Test]
+               public void TestAddOutputItem1 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='T'>
+                                               <Message />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Target [] t = new Target [1];
+                       BuildTask [] bt;
+                       project.Targets.CopyTo (t, 0);
+                       bt = GetTasks (t [0]);
+
+                       bt [0].AddOutputItem (null, null);
+               }
+
+               [Test]
+               public void TestAddOutputItem2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <UsingTask
+                                               AssemblyFile='Test\resources\TestTasks.dll'
+                                               TaskName='OutputTestTask'
+                                       />
+                                       <Target Name='T'>
+                                               <OutputTestTask />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Target [] t = new Target [1];
+                       BuildTask [] bt;
+                       project.Targets.CopyTo (t, 0);
+                       bt = GetTasks (t [0]);
+
+                       bt [0].AddOutputItem ("Property", "ItemName");
+                       project.Build ("T");
+
+                       Assert.AreEqual ("ItemName", project.EvaluatedItems [0].Name, "A1");
+                       Assert.AreEqual ("some_text", project.EvaluatedItems [0].FinalItemSpec, "A2");
+               }
+
+               [Test]
+               public void TestAddOutputProperty1 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='T'>
+                                               <Message />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Target [] t = new Target [1];
+                       BuildTask [] bt;
+                       project.Targets.CopyTo (t, 0);
+                       bt = GetTasks (t [0]);
+
+                       bt [0].AddOutputProperty (null, null);
+               }
+
+               [Test]
+               public void TestAddOutputProperty2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <UsingTask
+                                               AssemblyFile='Test\resources\TestTasks.dll'
+                                               TaskName='OutputTestTask'
+                                       />
+                                       <Target Name='T'>
+                                               <OutputTestTask />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Target [] t = new Target [1];
+                       BuildTask [] bt;
+                       project.Targets.CopyTo (t, 0);
+                       bt = GetTasks (t [0]);
+
+                       bt [0].AddOutputProperty ("Property", "PropertyName");
+                       project.Build ("T");
+
+                       Assert.AreEqual ("some_text", project.EvaluatedProperties ["PropertyName"].Value, "A1");
+                       Assert.AreEqual ("some_text", project.EvaluatedProperties ["PropertyName"].FinalValue, "A1");
+               }
        }
 }
index 5256a551e4bab63748bd800fde75bcb57ac84c8c..507f3f7449a14c6b7967eb7347036eaec44259d9 100644 (file)
@@ -1,3 +1,8 @@
+2006-12-07  Marek Sieradzki  <marek.sieradzki@gmail.com>
+
+       * BuildItemTest.cs, BuildPropertyGroupTest.cs, BuildTaskTest.cs,
+       UsingTaskCollectionTest.cs, ProjectTest.cs: More tests.
+
 2006-12-05  Marek Sieradzki  <marek.sieradzki@gmail.com>
 
        * BuildItemTest.cs: Reformatted.
index c5c3c15c0bbecdcfc9b7f76e69b3b95acf8220c8..0552d3d920bea09ea40b47927fb74bfc45e80a2f 100644 (file)
@@ -34,6 +34,42 @@ using Microsoft.Build.Utilities;
 using NUnit.Framework;
 
 namespace MonoTests.Microsoft.Build.BuildEngine {
+
+       class TestLogger : Logger {
+               int target_started_events = 0;
+               int target_finished_events = 0;
+
+               public override void Initialize (IEventSource eventSource)
+               {
+                       eventSource.TargetStarted += new TargetStartedEventHandler(TargetStarted);
+                       eventSource.TargetFinished += new TargetFinishedEventHandler(TargetFinished);
+                       eventSource.MessageRaised += new BuildMessageEventHandler(Message);
+                       eventSource.WarningRaised += new BuildWarningEventHandler(Warning);
+               }
+
+               void TargetStarted (object sender, TargetStartedEventArgs args)
+               {
+                       target_started_events++;
+               }
+
+               void TargetFinished (object sender, TargetFinishedEventArgs args)
+               {
+                       target_finished_events++;
+               }
+
+               void Message (object sender, BuildMessageEventArgs args)
+               {
+               }
+               
+               void Warning (object sender, BuildWarningEventArgs args)
+               {
+               }
+
+               public int TargetStartedEvents { get { return target_started_events; } }
+
+               public int TargetFinishedEvents { get { return target_finished_events; } }
+       }
+
        [TestFixture]
        public class ProjectTest {
 
@@ -50,9 +86,65 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        string documentString =
                                "<Project></Project>";
                        
+                       engine = new Engine (Consts.BinPath);
+                       DateTime time = DateTime.Now;
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual (true, project.BuildEnabled, "A1");
+                       Assert.AreEqual (String.Empty, project.DefaultTargets, "A2");
+                       Assert.AreEqual (String.Empty, project.FullFileName, "A3");
+                       Assert.AreEqual (false, project.IsDirty, "A4");
+                       Assert.AreEqual (false, project.IsValidated, "A5");
+                       Assert.AreEqual (engine, project.ParentEngine, "A6");
+                       Assert.IsTrue (time <= project.TimeOfLastDirty, "A7");
+                       Assert.IsTrue (String.Empty != project.Xml, "A8");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestAddNewItemGroup ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                               </Project>
+                       ";
+
                        engine = new Engine (Consts.BinPath);
                        project = engine.CreateNewProject ();
                        project.LoadXml (documentString);
+
+                       BuildItemGroup big = project.AddNewItemGroup ();
+                       Assert.IsNotNull (big, "A1");
+                       Assert.AreEqual (String.Empty, big.Condition, "A2");
+                       Assert.AreEqual (0, big.Count, "A3");
+                       Assert.AreEqual (false, big.IsImported, "A4");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestAddNewPropertyGroup ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       BuildPropertyGroup bpg = project.AddNewPropertyGroup (false);
+                       Assert.IsNotNull (bpg, "A1");
+                       Assert.AreEqual (String.Empty, bpg.Condition, "A2");
+                       Assert.AreEqual (0, bpg.Count, "A3");
+                       Assert.AreEqual (false, bpg.IsImported, "A4");
                }
 
                [Test]
@@ -79,6 +171,147 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        Assert.AreEqual (1, hashtable.Count, "A2");
                }
 
+               [Test]
+               public void TestBuild2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
+                                               <Message Text='text' />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       TestLogger tl = new TestLogger ();
+                       engine.RegisterLogger (tl);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.Build ("T");
+                       project.Build ("T");
+
+                       Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
+                       Assert.AreEqual (2, tl.TargetFinishedEvents, "A1");
+               }
+
+               [Test]
+               public void TestBuild3 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
+                                               <Message Text='text' />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       TestLogger tl = new TestLogger ();
+                       engine.RegisterLogger (tl);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.Build (new string [1] { "T" }, null, BuildSettings.None);
+                       project.Build (new string [1] { "T" }, null, BuildSettings.None);
+
+                       Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
+                       Assert.AreEqual (2, tl.TargetFinishedEvents, "A1");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestBuild4 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
+                                               <Message Text='text' />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       TestLogger tl = new TestLogger ();
+                       engine.RegisterLogger (tl);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
+                       project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
+
+                       Assert.AreEqual (1, tl.TargetStartedEvents, "A1");
+                       Assert.AreEqual (1, tl.TargetFinishedEvents, "A1");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestGetConditionedPropertyValues ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <PropertyGroup Condition='true'>
+                                               <A>A</A>
+                                               <B Condition='true'>A</B>
+                                       </PropertyGroup>
+                                       <PropertyGroup>
+                                               <C Condition='true'>A</C>
+                                               <C Condition='false'>B</C>
+                                               <C Condition='!false'>C</C>
+                                               <D>A</D>
+                                               <E Condition="" '$(C)' == 'A' "">E</E>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual (0, project.GetConditionedPropertyValues ("A").Length, "A1");
+                       Assert.AreEqual (0, project.GetConditionedPropertyValues ("B").Length, "A2");
+                       Assert.AreEqual (1, project.GetConditionedPropertyValues ("C").Length, "A3");
+                       Assert.AreEqual (0, project.GetConditionedPropertyValues ("D").Length, "A4");
+                       Assert.AreEqual (0, project.GetConditionedPropertyValues ("E").Length, "A5");
+                       Assert.AreEqual ("A", project.GetConditionedPropertyValues ("C") [0], "A6");
+               }
+
+               [Test]
+               public void TestGetProjectExtensions ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <ProjectExtensions>
+                                               <Node>Text</Node>
+                                       </ProjectExtensions>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual (String.Empty, project.GetProjectExtensions (null), "A1");
+                       Assert.AreEqual (String.Empty, project.GetProjectExtensions (String.Empty), "A2");
+                       Assert.AreEqual (String.Empty, project.GetProjectExtensions ("something"), "A3");
+                       Assert.AreEqual ("Text", project.GetProjectExtensions ("Node"), "A4");
+               }
+
                [Test]
                public void TestGlobalProperties1 ()
                {
@@ -203,6 +436,35 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
 
                        Assert.AreEqual (engine, project.ParentEngine, "A1");
                }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestResetBuildStatus ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='T' Inputs='Test\resources\TestTasks.cs' Outputs='Test\resources\TestTasks.dll'>
+                                               <Message Text='text' />
+                                       </Target>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       TestLogger tl = new TestLogger ();
+                       engine.RegisterLogger (tl);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.Build ("T");
+                       project.ResetBuildStatus ();
+                       project.Build (new string [1] { "T" }, null, BuildSettings.DoNotResetPreviouslyBuiltTargets);
+
+                       Assert.AreEqual (2, tl.TargetStartedEvents, "A1");
+                       Assert.AreEqual (2, tl.TargetFinishedEvents, "A1");
+               }
                
                [Test]
                public void TestSchemaFile ()
index 5adbfce293b66358042b2e0ec1063ff1a07aff7f..5a2f5191888e617f14e69b39b2a95bb908e6ad99 100644 (file)
@@ -80,6 +80,110 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
                        IEnumerator en = project.UsingTasks.GetEnumerator ();
                        en.MoveNext ();
                }
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestCopyTo1 ()
+               {
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <UsingTask
+                                               AssemblyFile='Test/resources/TestTasks.dll'
+                                               TaskName='SimpleTask'
+                                       />
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.UsingTasks.CopyTo (null, 0);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentOutOfRangeException))]
+               public void TestCopyTo2 ()
+               {
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <UsingTask
+                                               AssemblyFile='Test/resources/TestTasks.dll'
+                                               TaskName='SimpleTask'
+                                       />
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.UsingTasks.CopyTo (new UsingTask [1], -1);
+               }
+
+               [Test]
+               [Ignore ("Throws InvalidCastException on MS NET 2.0")]
+               public void TestCopyTo3 ()
+               {
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <UsingTask
+                                               AssemblyFile='Test/resources/TestTasks.dll'
+                                               TaskName='SimpleTask'
+                                       />
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.UsingTasks.CopyTo (new UsingTask [][] { new UsingTask [] {
+                               null}}, 0);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void TestCopyTo4 ()
+               {
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <UsingTask
+                                               AssemblyFile='Test/resources/TestTasks.dll'
+                                               TaskName='SimpleTask'
+                                       />
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
 
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.UsingTasks.CopyTo (new UsingTask [1], 2);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void TestCopyTo5 ()
+               {
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <UsingTask
+                                               AssemblyFile='Test/resources/TestTasks.dll'
+                                               TaskName='SimpleTask'
+                                       />
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.UsingTasks.CopyTo (new UsingTask [1], 1);
+               }
        }
 }