Merge pull request #1066 from esdrubal/bug19313
[mono.git] / mcs / class / Microsoft.Build.Engine / Test / various / EvaluationOrder.cs
index b046432d18639a9e9cc5a699d3da680c6a7e0db2..77b45eb5bc059022f7cb782e886c1b5d34b0de7a 100644 (file)
@@ -33,7 +33,7 @@ using NUnit.Framework;
 namespace MonoTests.Microsoft.Build.BuildEngine.Various {
        [TestFixture]
        public class EvaluationOrder {
-               private string GetItems (Project proj, string name)
+               string GetItems (Project proj, string name)
                {
                        BuildItemGroup big = proj.GetEvaluatedItemsByName (name);
                        string str = String.Empty;
@@ -51,7 +51,32 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
+               public void TestOrder0 ()
+               {
+                       Engine engine = new Engine (Consts.BinPath);
+                       Project proj = engine.CreateNewProject ();
+
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <ItemGroup>
+                                               <Item Include='A' />
+                                       </ItemGroup>
+
+                                       <PropertyGroup>
+                                               <A>A</A>
+                                               <Property>@(Item)$(A)$(B)</Property>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       proj.LoadXml (documentString);
+
+                       Assert.AreEqual ("@(Item)A", proj.EvaluatedProperties ["Property"].FinalValue, "A1");
+                       Assert.AreEqual ("@(Item)$(A)$(B)", proj.EvaluatedProperties ["Property"].Value, "A2");
+                       Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+               }
+
+               [Test]
                public void TestOrder1 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -77,7 +102,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void TestOrder2 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -153,7 +177,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void TestOrder5 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -210,7 +233,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Category ("NotDotNet")]
                public void TestImportOrder1 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -233,9 +256,8 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [ExpectedException (typeof (InvalidProjectFileException),
-                       "The required attribute \"Project\" is missing from element <Import>.  ")]
-               [Category ("NotWorking")]
+               [Category ("NotDotNet")]
+               [ExpectedException (typeof (InvalidProjectFileException))]
                public void TestImportOrder2 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -260,7 +282,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                [Test]
                // NOTE: It will try to import "@(Item)" instead of Test/...
                [ExpectedException (typeof (InvalidProjectFileException))]
-               [Category ("NotWorking")]
                public void TestImportOrder3 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -285,7 +306,6 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                [Test]
                // NOTE: It will try to import "@(Item)" instead of Test/...
                [ExpectedException (typeof (InvalidProjectFileException))]
-               [Category ("NotWorking")]
                public void TestImportOrder4 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -308,7 +328,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Category ("NotDotNet")]
                public void TestImportOrder5 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -331,7 +351,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Category ("NotDotNet")]
                public void TestImportOrder6 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -354,7 +374,7 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                }
 
                [Test]
-               [Category ("NotWorking")]
+               [Category ("NotDotNet")]
                public void TestImportOrder7 ()
                {
                        Engine engine = new Engine (Consts.BinPath);
@@ -375,5 +395,29 @@ namespace MonoTests.Microsoft.Build.BuildEngine.Various {
                        Assert.AreEqual ("AnotherValue", proj.EvaluatedProperties ["ImportedProperty"].FinalValue, "A1");
                        Assert.AreEqual ("Another$(ImportedProperty)", proj.EvaluatedProperties ["ImportedProperty"].Value, "A2");
                }
+
+               [Test]
+               public void TestUsingTaskOrder1 ()
+               {
+                       Engine engine = new Engine (Consts.BinPath);
+                       Project proj = engine.CreateNewProject ();
+
+                       string documentString = @"
+                               <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+                                       <PropertyGroup>
+                                               <Property>Test\resources\TestTasks.dll</Property>
+                                       </PropertyGroup>
+
+                                       <UsingTask AssemblyFile='$(Property)' TaskName='TrueTestTask' />
+                               </Project>
+                       ";
+
+                       proj.LoadXml (documentString);
+
+                       UsingTask [] ut = new UsingTask [1];
+                       proj.UsingTasks.CopyTo (ut, 0);
+
+                       Assert.AreEqual ("$(Property)", ut [0].AssemblyFile, "A1");
+               }
        }
 }