Author: msierad
Date: 2006-12-04 11:21:59 -0500 (Mon, 04 Dec 2006)
New Revision: 68962
Added:
trunk/mcs/class/Microsoft.Build.Engine/Test/resources/Import.csproj
trunk/mcs/class/Microsoft.Build.Engine/Test/resources/SelfImport.csproj
trunk/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
trunk/mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
trunk/mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs
trunk/mcs/class/Microsoft.Build.Engine/Test/various/ChangeLog
Log:
2006-12-04 Marek Sieradzki <[EMAIL PROTECTED]>
* EvaluationOrder.cs, Condition.cs: Added.
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
2006-12-04 16:19:17 UTC (rev 68961)
+++
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
2006-12-04 16:21:59 UTC (rev 68962)
@@ -17,7 +17,9 @@
Microsoft.Build.BuildEngine/UsingTaskTest.cs
Microsoft.Build.BuildEngine/UsingTaskCollectionTest.cs
Microsoft.Build.BuildEngine/UtilitiesTest.cs
+various/Conditions.cs
various/DefaultTasks.cs
+various/EvaluationOrder.cs
various/Items.cs
various/ProjectElement.cs
various/Properties.cs
Added: trunk/mcs/class/Microsoft.Build.Engine/Test/resources/Import.csproj
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/resources/Import.csproj
2006-12-04 16:19:17 UTC (rev 68961)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/resources/Import.csproj
2006-12-04 16:21:59 UTC (rev 68962)
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ImportedProperty>Value</ImportedProperty>
+ </PropertyGroup>
+</Project>
Property changes on:
trunk/mcs/class/Microsoft.Build.Engine/Test/resources/Import.csproj
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/mcs/class/Microsoft.Build.Engine/Test/resources/SelfImport.csproj
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/resources/SelfImport.csproj
2006-12-04 16:19:17 UTC (rev 68961)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/resources/SelfImport.csproj
2006-12-04 16:21:59 UTC (rev 68962)
@@ -0,0 +1,3 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="SelfImport.csproj"/>
+</Project>
Property changes on:
trunk/mcs/class/Microsoft.Build.Engine/Test/resources/SelfImport.csproj
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs
2006-12-04 16:19:17 UTC (rev 68961)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/resources/TestTasks.cs
2006-12-04 16:21:59 UTC (rev 68962)
@@ -28,21 +28,43 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
-public class SimpleTask : Task {
+public class OutputTestTask : Task {
public override bool Execute ()
{
return true;
}
+
+ [Output]
+ public string Property {
+ get { return "some_text"; }
+ }
}
-public class OutputTestTast : Task {
+public class RequiredTestTask : Task {
public override bool Execute ()
{
return true;
}
- [Output]
+ string property;
+
+ [Required]
public string Property {
- get { return "some_text"; }
+ set { property = value; }
}
}
+
+
+public class TrueTestTask : Task {
+ public override bool Execute ()
+ {
+ return true;
+ }
+}
+
+public class FalseTestTask : Task {
+ public override bool Execute ()
+ {
+ return false;
+ }
+}
Modified: trunk/mcs/class/Microsoft.Build.Engine/Test/various/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/various/ChangeLog
2006-12-04 16:19:17 UTC (rev 68961)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/various/ChangeLog
2006-12-04 16:21:59 UTC (rev 68962)
@@ -1,5 +1,9 @@
2006-12-04 Marek Sieradzki <[EMAIL PROTECTED]>
+ * EvaluationOrder.cs, Condition.cs: Added.
+
+2006-12-04 Marek Sieradzki <[EMAIL PROTECTED]>
+
* Items.cs: Split big test into 4.
2006-10-06 Marek Sieradzki <[EMAIL PROTECTED]>
Added: trunk/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
2006-12-04 16:19:17 UTC (rev 68961)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
2006-12-04 16:21:59 UTC (rev 68962)
@@ -0,0 +1,198 @@
+//
+// Conditions.cs: Tests various conditions by checking if a property
+// is added to EvaluatedProperties.
+//
+// Author:
+// Marek Sieradzki ([EMAIL PROTECTED])
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine.Various {
+ [TestFixture]
+ public class Conditions {
+
+ [Test]
+ public void TestCondition1 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A Condition='true'></A>
+ <B Condition='false'></B>
+ <C Condition='TRUE'></C>
+ <D Condition='FALSE'></D>
+ <E Condition=''>A</E>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNotNull (proj.EvaluatedProperties ["A"], "A1");
+ Assert.IsNull (proj.EvaluatedProperties ["B"], "A2");
+ Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A3");
+ Assert.IsNull (proj.EvaluatedProperties ["D"], "A4");
+ Assert.IsNotNull (proj.EvaluatedProperties ["E"], "A5");
+ }
+
+ [Test]
+ public void TestCondition2 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A Condition='true or true'></A>
+ <B Condition='false or
false'></B>
+ <C Condition='true or
false'></C>
+ <D Condition='false or
true'></D>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNotNull (proj.EvaluatedProperties ["A"], "A1");
+ Assert.IsNull (proj.EvaluatedProperties ["B"], "A2");
+ Assert.IsNotNull (proj.EvaluatedProperties ["C"], "A3");
+ Assert.IsNotNull (proj.EvaluatedProperties ["D"], "A4");
+ }
+
+ [Test]
+ public void TestCondition3 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A Condition='true and
true'></A>
+ <B Condition='false and
false'></B>
+ <C Condition='true and
false'></C>
+ <D Condition='false and
true'></D>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNotNull (proj.EvaluatedProperties ["A"], "A1");
+ Assert.IsNull (proj.EvaluatedProperties ["B"], "A2");
+ Assert.IsNull (proj.EvaluatedProperties ["C"], "A3");
+ Assert.IsNull (proj.EvaluatedProperties ["D"], "A4");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestCondition4 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A Condition='!true'></A>
+ <B Condition='!false'></B>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNull (proj.EvaluatedProperties ["A"], "A1");
+ Assert.IsNotNull (proj.EvaluatedProperties ["B"], "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestCondition5 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <a Condition='-1 < 0'></a>
+ <b Condition='-1 <= 0'></b>
+ <c Condition='-1.0 <
0.0'></c>
+ <d Condition='-1.0 <=
0.0'></d>
+ <e Condition='-1.0 == 0.0'></e>
+ <f Condition='0.0 == 0.0'></f>
+ <g Condition='-1.0 != 0.0'></g>
+ <h Condition='0.0 != 0.0'></h>
+ <i Condition='1 > 0'></i>
+ <j Condition='1 >= 0'></j>
+ <k Condition='-1 > 0'></k>
+ <l Condition='-1 >= 0'></l>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.IsNotNull (proj.EvaluatedProperties ["a"], "A1");
+ Assert.IsNotNull (proj.EvaluatedProperties ["b"], "A2");
+ Assert.IsNotNull (proj.EvaluatedProperties ["c"], "A3");
+ Assert.IsNotNull (proj.EvaluatedProperties ["d"], "A4");
+ Assert.IsNull (proj.EvaluatedProperties ["e"], "A5");
+ Assert.IsNotNull (proj.EvaluatedProperties ["f"], "A6");
+ Assert.IsNotNull (proj.EvaluatedProperties ["g"], "A7");
+ Assert.IsNull (proj.EvaluatedProperties ["h"], "A8");
+ Assert.IsNotNull (proj.EvaluatedProperties ["i"], "A1");
+ Assert.IsNotNull (proj.EvaluatedProperties ["j"], "A2");
+ Assert.IsNull (proj.EvaluatedProperties ["k"], "A3");
+ Assert.IsNull (proj.EvaluatedProperties ["l"], "A4");
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidProjectFileException))]
+ [Category ("NotWorking")]
+ public void TestIncorrectCondition1 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A Condition='x'>A</A>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Engine/Test/various/Conditions.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
2006-12-04 16:19:17 UTC (rev 68961)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
2006-12-04 16:21:59 UTC (rev 68962)
@@ -0,0 +1,379 @@
+//
+// EvaluationOrder.cs
+//
+// Author:
+// Marek Sieradzki ([EMAIL PROTECTED])
+//
+// (C) 2006 Marek Sieradzki
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Xml;
+using Microsoft.Build.BuildEngine;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine.Various {
+ [TestFixture]
+ public class EvaluationOrder {
+ private string GetItems (Project proj, string name)
+ {
+ BuildItemGroup big = proj.GetEvaluatedItemsByName
(name);
+ string str = String.Empty;
+ if (big == null)
+ return str;
+
+ foreach (BuildItem bi in big) {
+ if (str == String.Empty)
+ str = bi.FinalItemSpec;
+ else
+ str += ";" + bi.FinalItemSpec;
+ }
+
+ return str;
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestOrder1 ()
+ {
+ 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>
+ <Property>@(Item)</Property>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property"].FinalValue, "A1");
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property"].Value, "A2");
+ Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestOrder2 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <Property>@(Item)</Property>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Item Include='A' />
+ </ItemGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property"].FinalValue, "A1");
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property"].Value, "A2");
+ Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+ }
+
+ [Test]
+ public void TestOrder3 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <Property>A</Property>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Item Include='$(Property)' />
+ </ItemGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("A", proj.EvaluatedProperties
["Property"].FinalValue, "A1");
+ Assert.AreEqual ("A", proj.EvaluatedProperties
["Property"].Value, "A2");
+ Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+ }
+
+ [Test]
+ public void TestOrder4 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Item Include='$(Property)' />
+ </ItemGroup>
+
+ <PropertyGroup>
+ <Property>A</Property>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("A", proj.EvaluatedProperties
["Property"].FinalValue, "A1");
+ Assert.AreEqual ("A", proj.EvaluatedProperties
["Property"].Value, "A2");
+ Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestOrder5 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Item Include='$(Property)' />
+ </ItemGroup>
+
+ <PropertyGroup>
+ <Property>A</Property>
+ <Property2>@(Item)</Property2>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("A", proj.EvaluatedProperties
["Property"].FinalValue, "A1");
+ Assert.AreEqual ("A", proj.EvaluatedProperties
["Property"].Value, "A2");
+ Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property2"].FinalValue, "A4");
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property2"].Value, "A5");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestOrder6 ()
+ {
+ 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' />
+ <Item2 Include='$(Property)' />
+ </ItemGroup>
+
+ <PropertyGroup>
+ <Property>@(Item)</Property>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property"].FinalValue, "A1");
+ Assert.AreEqual ("@(Item)", proj.EvaluatedProperties
["Property"].Value, "A2");
+ Assert.AreEqual ("A", GetItems (proj, "Item"), "A3");
+ Assert.AreEqual ("A", GetItems (proj, "Item2"), "A4");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestImportOrder1 ()
+ {
+ 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/Import.csproj</Property>
+ </PropertyGroup>
+
+ <Import Project='$(Property)'/>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].Value, "A2");
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidProjectFileException),
+ "The required attribute \"Project\" is missing from
element <Import>. ")]
+ [Category ("NotWorking")]
+ public void TestImportOrder2 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Import Project='$(Property)'/>
+
+ <PropertyGroup>
+
<Property>Test/resources/Import.csproj</Property>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].Value, "A2");
+ }
+
+ [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);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Item
Include='Test/resources/Import.csproj' />
+ </ItemGroup>
+
+ <Import Project='@(Item)'/>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].Value, "A2");
+ }
+
+ [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);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Import Project='@(Item)'/>
+
+ <ItemGroup>
+ <Item
Include='Test/resources/Import.csproj' />
+ </ItemGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].Value, "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestImportOrder5 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+
<ImportedProperty>AnotherValue</ImportedProperty>
+ </PropertyGroup>
+
+ <Import
Project='Test/resources/Import.csproj'/>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("Value", proj.EvaluatedProperties
["ImportedProperty"].Value, "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestImportOrder6 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Import
Project='Test/resources/Import.csproj'/>
+
+ <PropertyGroup>
+
<ImportedProperty>AnotherValue</ImportedProperty>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("AnotherValue",
proj.EvaluatedProperties ["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("AnotherValue",
proj.EvaluatedProperties ["ImportedProperty"].Value, "A2");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestImportOrder7 ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project proj = engine.CreateNewProject ();
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Import
Project='Test/resources/Import.csproj'/>
+
+ <PropertyGroup>
+
<ImportedProperty>Another$(ImportedProperty)</ImportedProperty>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ proj.LoadXml (documentString);
+
+ Assert.AreEqual ("AnotherValue",
proj.EvaluatedProperties ["ImportedProperty"].FinalValue, "A1");
+ Assert.AreEqual ("Another$(ImportedProperty)",
proj.EvaluatedProperties ["ImportedProperty"].Value, "A2");
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Engine/Test/various/EvaluationOrder.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches