2007-01-12 Marek Sieradzki <marek.sieradzki@gmail.com>
[mono.git] / mcs / class / Microsoft.Build.Engine / Test / Microsoft.Build.BuildEngine / ProjectTest.cs
index c9c867603daad16a34cb451c9104aba40d9aa07b..b66e9b7f379cd044331acbe9d205df9809b4da1d 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 using System;
+using System.Collections;
+using System.Collections.Generic;
 using System.Xml;
 using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+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 {
+
+               /*
+               Import [] GetImports (ImportCollection ic)
+               {
+                       List<Import> list = new List<Import> ();
+                       foreach (Import i in ic)
+                               list.Add (i);
+                       return list.ToArray ();
+               }
+               */
+
                [Test]
-               public void AssignmentTest ()
+               [ExpectedException (typeof (InvalidProjectFileException),
+               @"The default XML namespace of the project must be the MSBuild XML namespace." + 
+               " If the project is authored in the MSBuild 2003 format, please add " +
+               "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" to the <Project> element. " +
+               "If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.  ")]
+               public void TestAssignment1 ()
                {
-                       IEngine engine;
-                       IProject project;
-                       string binPath = "binPath";
-                       XmlDocument xd;
+                       Engine engine;
+                       Project project;
                        string documentString =
-                       "<Project></Project>";
+                               "<Project></Project>";
                        
-                       engine = new Engine (binPath);
+                       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]
+               public void TestAssignment2 ()
+               {
+                       Engine engine;
+                       Project project;
+                       string documentString =
+                               "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"></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 (true, 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 TestAddNewImport1 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <PropertyGroup />
+                                       <ItemGroup />
+                                       <Target Name='a' />
+                                       <Import Project='Test/resources/Import.csproj' />
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.AddNewImport ("a", "true");
+                       // reevaluation wasn't caused by anything so it has only old import
+                       Assert.AreEqual (1, project.Imports.Count, "A1");
+               }
+
+               [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 ();
-                       xd = new XmlDocument ();
-                       xd.LoadXml (documentString);
-                       project.LoadFromXml (xd);
+                       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");
+                       Assert.IsTrue (project.IsDirty, "A5");
+               }
+
+               [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");
+                       Assert.IsTrue (project.IsDirty, "A5");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestBuild1 ()
+               {
+                       Engine engine;
+                       Project project;
+                       IDictionary hashtable = new Hashtable ();
                        
-                       Assert.AreEqual (String.Empty, project.FullFileName, "FullFileName");
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <Target Name='Main'>
+                                               <Microsoft.Build.Tasks.Message Text='Text' />
+                                       </Target>
+                               </Project>
+                       ";
+                       
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual (true, project.Build (new string[] { "Main" }, hashtable), "A1");
+                       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, "A2");
+               }
+
+               [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, "A2");
+               }
+
+               [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, "A2");
+               }
+
+               [Test]
+               public void TestBuild5 ()
+               {
+                       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);
+
+                       Assert.IsFalse (project.Build ("target_that_doesnt_exist"));
+               }
+
+               [Test]
+               public void TestEvaluatedItems1 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <ItemGroup>
+                                               <A Include='a' />
+                                               <B Include='b' Condition='false' />
+                                       </ItemGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual (1, project.EvaluatedItems.Count, "A1");
+
+                       BuildItem bi = project.EvaluatedItems [0];
+
+                       bi.Name = "C";
+                       bi.Include = "c";
+
+                       BuildItemGroup [] big = new BuildItemGroup [1];
+                       project.ItemGroups.CopyTo (big, 0);
+                       Assert.AreEqual ("C", big [0] [0].Name, "A2");
+                       Assert.AreEqual ("c", big [0] [0].Include, "A3");
+               }
+
+               [Test]
+               public void TestEvaluatedItems2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <ItemGroup>
+                                               <A Include='a;b;c' />
+                                       </ItemGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       BuildItemGroup [] big = new BuildItemGroup [1];
+                       project.ItemGroups.CopyTo (big, 0);
+
+                       Assert.AreEqual (3, project.EvaluatedItems.Count, "A1");
+                       Assert.AreEqual ("a;b;c", big [0] [0].Include, "A2");
+                       Assert.AreEqual (1, big [0].Count, "A3");
+
+                       BuildItem bi = project.EvaluatedItems [0];
+
+                       bi.Include = "d";
+
+                       Assert.AreEqual (3, big [0].Count, "A4");
+                       Assert.AreEqual ("d", big [0] [0].Include, "A5");
+                       Assert.AreEqual ("b", big [0] [1].Include, "A6");
+                       Assert.AreEqual ("c", big [0] [2].Include, "A7");
+               }
+
+               [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]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestGetEvaluatedItemsByName1 ()
+               {
+                       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);
+
+                       project.GetEvaluatedItemsByName (null);
+               }
+
+               [Test]
+               public void TestGetEvaluatedItemsByName2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <ItemGroup>
+                                               <A Include='1' />
+                                               <B Include='2' Condition='true' />
+                                               <C Include='3' Condition='false' />
+                                       </ItemGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       BuildItemGroup big;
+
+                       big = project.GetEvaluatedItemsByName (String.Empty);
+
+                       Assert.AreEqual (0, big.Count, "A1");
+
+                       big = project.GetEvaluatedItemsByName ("A");
+
+                       Assert.AreEqual (1, big.Count, "A2");
+                       Assert.AreEqual ("1", big [0].FinalItemSpec, "A3");
+
+                       big = project.GetEvaluatedItemsByName ("B");
+
+                       Assert.AreEqual (1, big.Count, "A4");
+                       Assert.AreEqual ("2", big [0].FinalItemSpec, "A5");
+
+                       big = project.GetEvaluatedItemsByName ("C");
+
+                       Assert.AreEqual (0, big.Count, "A6");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestGetEvaluatedItemsByNameIgnoringCondition1 ()
+               {
+                       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);
+
+                       project.GetEvaluatedItemsByNameIgnoringCondition (null);
+               }
+
+               [Test]
+               public void TestGetEvaluatedItemsByNameIgnoringCondition2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <ItemGroup>
+                                               <A Include='1' />
+                                               <B Include='2' Condition='true' />
+                                               <C Include='3' Condition='false' />
+                                       </ItemGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       BuildItemGroup big;
+
+                       big = project.GetEvaluatedItemsByNameIgnoringCondition (String.Empty);
+
+                       Assert.AreEqual (0, big.Count, "A1");
+
+                       big = project.GetEvaluatedItemsByNameIgnoringCondition ("A");
+
+                       Assert.AreEqual (1, big.Count, "A2");
+                       Assert.AreEqual ("1", big [0].FinalItemSpec, "A3");
+
+                       big = project.GetEvaluatedItemsByNameIgnoringCondition ("B");
+
+                       Assert.AreEqual (1, big.Count, "A4");
+                       Assert.AreEqual ("2", big [0].FinalItemSpec, "A5");
+
+                       big = project.GetEvaluatedItemsByNameIgnoringCondition ("C");
+
+                       Assert.AreEqual (1, big.Count, "A6");
+                       Assert.AreEqual ("3", big [0].FinalItemSpec, "A7");
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestGetEvaluatedProperty1 ()
+               {
+                       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);
+
+                       project.GetEvaluatedProperty (null);
+               }
+               [Test]
+               public void TestGetEvaluatedProperty2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <PropertyGroup>
+                                               <A>1</A>
+                                               <B Condition='true'>2</B>
+                                               <C Condition='false'>3</C>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual ("1", project.GetEvaluatedProperty ("A"), "A1");
+                       Assert.AreEqual ("2", project.GetEvaluatedProperty ("B"), "A2");
+                       Assert.IsNull (project.GetEvaluatedProperty ("C"), "A3");
+               }
+
+               [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 ()
+               {
+                       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);
+
+                       Assert.AreEqual (0, project.GlobalProperties.Count, "A1");
+               }
+
+               [Test]
+               public void TestGlobalProperties2 ()
+               {
+                       Engine engine;
+                       Project project;
+                       
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                               </Project>
+                       ";
+                       
+                       engine = new Engine (Consts.BinPath);
+                       engine.GlobalProperties.SetProperty ("Property", "Value");
+                       
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       Assert.AreEqual (1, project.GlobalProperties.Count, "A1");
+                       Assert.AreEqual ("Property", project.GlobalProperties ["Property"].Name, "A2");
+                       Assert.AreEqual ("Value", project.GlobalProperties ["Property"].Value, "A3");
+                       Assert.AreEqual ("Value", project.GlobalProperties ["Property"].FinalValue, "A4");
+                       Assert.AreEqual ("Property", project.EvaluatedProperties ["Property"].Name, "A2");
+                       Assert.AreEqual ("Value", project.EvaluatedProperties ["Property"].Value, "A3");
+                       Assert.AreEqual ("Value", project.EvaluatedProperties ["Property"].FinalValue, "A4");
+               }
+
+               [Test]
+               [Ignore ("NullRefException under MS .NET 2.0")]
+               public void TestGlobalProperties3 ()
+               {
+                       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);
+
+                       project.GlobalProperties = null;
+               }
+
+               [Test]
+               [Ignore ("NullRefException under MS .NET 2.0")]
+               public void TestGlobalProperties4 ()
+               {
+                       Engine engine;
+                       Project project;
+                       
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <PropertyGroup>
+                                               <Property>a</Property>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+                       
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       BuildPropertyGroup[] groups = new BuildPropertyGroup [1];
+                       project.PropertyGroups.CopyTo (groups, 0);
+
+                       project.GlobalProperties = groups [0];
+                       project.GlobalProperties = project.EvaluatedProperties;
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void TestGlobalProperties5 ()
+               {
+                       Engine engine;
+                       Project project;
+                       
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <PropertyGroup>
+                                               <Property>a</Property>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+                       
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       BuildPropertyGroup[] groups = new BuildPropertyGroup [1];
+                       project.PropertyGroups.CopyTo (groups, 0);
+                       project.GlobalProperties = groups [0];
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidProjectFileException))]
+               public void TestLoad1 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidProjectFileException))]
+               public void TestLoad2 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml ("project_file_that_doesnt_exist");
+               }
+
+               [Test]
+               public void TestParentEngine ()
+               {
+                       Engine engine;
+                       Project project;
+                       
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+
+                       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 ()
+               {
+                       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);
+
+                       Assert.IsNull (project.SchemaFile, "A1");
+               }
+               [Test]
+               [Ignore ("NRE on .NET 2.0")]
+               public void TestSetProjectExtensions1 ()
+               {
+                       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);
+
+                       project.SetProjectExtensions (null, null);
+               }
+
+               [Test]
+               public void TestSetProjectExtensions2 ()
+               {
+                       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);
+
+                       project.SetProjectExtensions ("name", "1");
+                       Assert.AreEqual ("1", project.GetProjectExtensions ("name"), "A1");
+                       project.SetProjectExtensions ("name", "2");
+                       Assert.AreEqual ("2", project.GetProjectExtensions ("name"), "A2");
+                       Assert.IsTrue (project.IsDirty, "A3");
+               }
+
+               [Test]
+               public void TestSetProjectExtensions3 ()
+               {
+                       Engine engine;
+                       Project project;
+
+                       string documentString = @"
+                               <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+                                       <ProjectExtensions>
+                                       </ProjectExtensions>
+                               </Project>
+                       ";
+
+                       engine = new Engine (Consts.BinPath);
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+
+                       project.SetProjectExtensions ("name", "1");
+                       Assert.AreEqual ("1", project.GetProjectExtensions ("name"), "A1");
+                       Assert.IsTrue (project.IsDirty, "A2");
                }
        }
-}
\ No newline at end of file
+}