Author: msierad
Date: 2007-03-06 14:37:28 -0500 (Tue, 06 Mar 2007)
New Revision: 73836
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
Log:
2007-03-06 Marek Sieradzki <[EMAIL PROTECTED]>
* BuildPropertyTest.cs, ProjectTest.cs: More tests.
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
2007-03-06 19:27:47 UTC (rev 73835)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
2007-03-06 19:37:28 UTC (rev 73836)
@@ -27,6 +27,7 @@
using System;
using System.Collections;
+using System.Xml;
using Microsoft.Build.BuildEngine;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
@@ -39,7 +40,16 @@
BuildProperty bp;
Engine engine;
Project project;
-
+
+ BuildProperty [] GetProperties (BuildPropertyGroup bpg)
+ {
+ BuildProperty [] arr = new BuildProperty [bpg.Count];
+ int i = 0;
+ foreach (BuildProperty bp in bpg)
+ arr [i++] = bp;
+ return arr;
+ }
+
[Test]
public void TestCtor1 ()
{
@@ -278,9 +288,12 @@
Assert.AreEqual ("a;b", bp.ToString ());
}
- public void TestValue ()
+ [Test]
+ public void TestValue1 ()
{
BuildProperty a;
+ BuildPropertyGroup [] bpgs = new BuildPropertyGroup [1];
+ BuildProperty [] props;
string documentString = @"
<Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
@@ -298,6 +311,41 @@
a = project.EvaluatedProperties ["Name"];
a.Value = "$(something)";
Assert.AreEqual ("$(something)", a.Value, "A1");
+
+ project.PropertyGroups.CopyTo (bpgs, 0);
+ props = GetProperties (bpgs [0]);
+ Assert.AreEqual ("Value", props [0].Value, "A2");
}
+
+ [Test]
+ public void TestValue2 ()
+ {
+ BuildPropertyGroup [] bpgs = new BuildPropertyGroup [1];
+ BuildProperty [] props;
+ XmlDocument xd;
+ XmlNode node;
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <Name>Value</Name>
+ </PropertyGroup>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ project.PropertyGroups.CopyTo (bpgs, 0);
+ props = GetProperties (bpgs [0]);
+ props [0].Value = "AnotherValue";
+
+ xd = new XmlDocument ();
+ xd.LoadXml (project.Xml);
+ node = xd.SelectSingleNode
("tns:Project/tns:PropertyGroup/tns:Name",
TestNamespaceManager.NamespaceManager);
+ Assert.AreEqual ("AnotherValue", node.InnerText, "A1");
+ }
}
}
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
2007-03-06 19:27:47 UTC (rev 73835)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
2007-03-06 19:37:28 UTC (rev 73836)
@@ -1,3 +1,7 @@
+2007-03-06 Marek Sieradzki <[EMAIL PROTECTED]>
+
+ * BuildPropertyTest.cs, ProjectTest.cs: More tests.
+
2007-02-03 Marek Sieradzki <[EMAIL PROTECTED]>
* BuildPropertyGroupTest.cs: More tests.
Modified:
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
2007-03-06 19:27:47 UTC (rev 73835)
+++
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
2007-03-06 19:37:28 UTC (rev 73836)
@@ -294,7 +294,44 @@
}
[Test]
- [Category ("NotWorking")]
+ public void TestBuild0 ()
+ {
+ Engine engine;
+ Project project;
+ IDictionary hashtable = new Hashtable ();
+
+ string documentString = @"
+ <Project
xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+ <Target
+ Name='Main'
+ Inputs='a;b;c'
+ Outputs='d;e;f'
+ >
+ </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");
+
+ IDictionaryEnumerator e = hashtable.GetEnumerator ();
+ e.MoveNext ();
+
+ string name = (string) e.Key;
+ Assert.AreEqual ("Main", name, "A3");
+ ITaskItem [] arr = (ITaskItem []) e.Value;
+
+ Assert.AreEqual (3, arr.Length, "A4");
+ Assert.AreEqual ("d", arr [0].ItemSpec, "A5");
+ Assert.AreEqual ("e", arr [1].ItemSpec, "A6");
+ Assert.AreEqual ("f", arr [2].ItemSpec, "A7");
+ }
+
+ [Test]
public void TestBuild1 ()
{
Engine engine;
@@ -315,6 +352,13 @@
Assert.AreEqual (true, project.Build (new string[] {
"Main" }, hashtable), "A1");
Assert.AreEqual (1, hashtable.Count, "A2");
+
+ IDictionaryEnumerator e = hashtable.GetEnumerator ();
+ e.MoveNext ();
+
+ string name = (string) e.Key;
+ Assert.AreEqual ("Main", name, "A3");
+ Assert.IsNotNull ((ITaskItem []) e.Value, "A4");
}
[Test]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches