Author: msierad
Date: 2006-12-11 08:48:39 -0500 (Mon, 11 Dec 2006)
New Revision: 69322
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreatePropertyTest.cs
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkPathTest.cs
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkSdkPathTest.cs
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDirTest.cs
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/MakeDirTest.cs
Log:
2006-12-11 Marek Sieradzki <[EMAIL PROTECTED]>
* GetFrameworkSdkPath.cs, GetFrameworkPath.cs, CreateItemTest.cs,
CreatePropertyTest.cs, RemoveDirTest.cs: Added.
* MakeDirTest.cs: Added check for task's output.
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
2006-12-11 13:48:39 UTC (rev 69322)
@@ -1,9 +1,14 @@
Microsoft.Build.Tasks/ALTest.cs
Microsoft.Build.Tasks/Consts.cs
+Microsoft.Build.Tasks/CreateItemTest.cs
+Microsoft.Build.Tasks/CreatePropertyTest.cs
Microsoft.Build.Tasks/CscTest.cs
Microsoft.Build.Tasks/ErrorTest.cs
+Microsoft.Build.Tasks/GetFrameworkPathTest.cs
+Microsoft.Build.Tasks/GetFrameworkSdkPathTest.cs
Microsoft.Build.Tasks/MakeDirTest.cs
Microsoft.Build.Tasks/ManagedCompilerTest.cs
Microsoft.Build.Tasks/MessageTest.cs
+Microsoft.Build.Tasks/RemoveDirTest.cs
Microsoft.Build.Tasks/TestEngine.cs
Microsoft.Build.Tasks/WarningTest.cs
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
===================================================================
--- trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
2006-12-11 13:46:22 UTC (rev 69321)
+++ trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
2006-12-11 13:48:39 UTC (rev 69322)
@@ -1,3 +1,9 @@
+2006-12-11 Marek Sieradzki <[EMAIL PROTECTED]>
+
+ * GetFrameworkSdkPath.cs, GetFrameworkPath.cs, CreateItemTest.cs,
+ CreatePropertyTest.cs, RemoveDirTest.cs: Added.
+ * MakeDirTest.cs: Added check for task's output.
+
2006-12-08 Marek Sieradzki <[EMAIL PROTECTED]>
* MakeDirTest.cs, CscTest.cs: Added.
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
2006-12-11 13:48:39 UTC (rev 69322)
@@ -0,0 +1,106 @@
+//
+// CreateItemTest.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.Collections;
+using System.IO;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ [TestFixture]
+ public class CreateItemTest {
+ [Test]
+ public void TestAssignment ()
+ {
+ CreateItem ci = new CreateItem ();
+
+ ci.AdditionalMetadata = new string [1] { "a=1" };
+ ci.Include = new ITaskItem [1] { new TaskItem ("1") };
+ ci.Exclude = new ITaskItem [1] { new TaskItem ("2") };
+
+ Assert.AreEqual ("a=1", ci.AdditionalMetadata [0],
"A1");
+ Assert.AreEqual ("1", ci.Include [0].ItemSpec, "A2");
+ Assert.AreEqual ("2", ci.Exclude [0].ItemSpec, "A3");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestExecution1 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <A Include='1;2;3;4'/>
+ <B Include='1;3' />
+ </ItemGroup>
+ <Target Name='1'>
+ <CreateItem
+
AdditionalMetadata='a=1;b=2'
+ Include='@(A)'
+ Exclude='@(B)'
+ >
+ <Output
+
TaskParameter='Include'
+
ItemName='Include'
+ />
+ </CreateItem>
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+ Assert.IsTrue (project.Build ("1"), "A1");
+
+ BuildItemGroup include =
project.GetEvaluatedItemsByName ("Include");
+ Assert.AreEqual (2, include.Count, "A2");
+
+ Assert.AreEqual ("Include", include [0].Name, "A3");
+ Assert.AreEqual ("1", include [0].GetMetadata ("a"),
"A4");
+ Assert.AreEqual ("2", include [0].GetMetadata ("b"),
"A5");
+ Assert.AreEqual ("1", include [0].GetEvaluatedMetadata
("a"), "A6");
+ Assert.AreEqual ("2", include [0].GetEvaluatedMetadata
("b"), "A7");
+ Assert.AreEqual ("2", include [0].FinalItemSpec, "A8");
+
+ Assert.AreEqual ("Include", include [0].Name, "A9");
+ Assert.AreEqual ("1", include [1].GetMetadata ("a"),
"A10");
+ Assert.AreEqual ("2", include [1].GetMetadata ("b"),
"A11");
+ Assert.AreEqual ("1", include [1].GetEvaluatedMetadata
("a"), "A12");
+ Assert.AreEqual ("2", include [1].GetEvaluatedMetadata
("b"), "A13");
+ Assert.AreEqual ("4", include [1].FinalItemSpec, "A14");
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreateItemTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreatePropertyTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreatePropertyTest.cs
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreatePropertyTest.cs
2006-12-11 13:48:39 UTC (rev 69322)
@@ -0,0 +1,90 @@
+//
+// CreatePropertyTest.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.Collections;
+using System.IO;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ [TestFixture]
+ public class CreatePropertyTest {
+ [Test]
+ public void TestAssignment ()
+ {
+ CreateProperty cp = new CreateProperty ();
+
+ cp.Value = new string [1] { "1" };
+
+ Assert.AreEqual ("1", cp.Value [0], "A1");
+ Assert.AreEqual ("1", cp.ValueSetByTask [0], "A2");
+ }
+
+ [Test]
+ public void TestExecution1 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <PropertyGroup>
+ <A>1</A>
+ <B>2</B>
+ </PropertyGroup>
+ <Target Name='1'>
+ <CreateProperty
Value='$(A)$(B)' >
+ <Output
+
TaskParameter='Value'
+
PropertyName='Value'
+ />
+ <Output
+
TaskParameter='ValueSetByTask'
+
PropertyName='ValueSetByTask'
+ />
+ </CreateProperty>
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+ Assert.IsTrue (project.Build ("1"), "A1");
+
+ Assert.AreEqual ("12", project.EvaluatedProperties
["Value"].Value, "A2");
+ Assert.AreEqual ("12", project.EvaluatedProperties
["Value"].FinalValue, "A3");
+ Assert.AreEqual ("12", project.EvaluatedProperties
["ValueSetByTask"].Value, "A4");
+ Assert.AreEqual ("12", project.EvaluatedProperties
["ValueSetByTask"].FinalValue, "A5");
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/CreatePropertyTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkPathTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkPathTest.cs
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkPathTest.cs
2006-12-11 13:48:39 UTC (rev 69322)
@@ -0,0 +1,69 @@
+//
+// GetFrameworkPathTest.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.Collections;
+using System.IO;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ [TestFixture]
+ public class GetFrameworkPathTest {
+ [Test]
+ public void TestExecution1 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Target Name='1'>
+ <GetFrameworkPath>
+ <Output
+
TaskParameter='Path'
+
PropertyName='Path'
+ />
+ </GetFrameworkPath>
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+ Assert.IsTrue (project.Build ("1"), "A1");
+
+ Assert.IsNotNull (project.EvaluatedProperties ["Path"],
"A2");
+ Assert.IsTrue (String.Empty !=
project.EvaluatedProperties ["Path"].FinalValue, "A3");
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkPathTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkSdkPathTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkSdkPathTest.cs
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkSdkPathTest.cs
2006-12-11 13:48:39 UTC (rev 69322)
@@ -0,0 +1,69 @@
+//
+// GetFrameworkSdkPathTest.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.Collections;
+using System.IO;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ [TestFixture]
+ public class GetFrameworkSdkPathTest {
+ [Test]
+ public void TestExecution1 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Target Name='1'>
+ <GetFrameworkSdkPath>
+ <Output
+
TaskParameter='Path'
+
PropertyName='Path'
+ />
+ </GetFrameworkSdkPath>
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+ Assert.IsTrue (project.Build ("1"), "A1");
+
+ Assert.IsNotNull (project.EvaluatedProperties ["Path"],
"A2");
+ Assert.IsTrue (String.Empty !=
project.EvaluatedProperties ["Path"].FinalValue, "A3");
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/GetFrameworkSdkPathTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/MakeDirTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/MakeDirTest.cs
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/MakeDirTest.cs
2006-12-11 13:48:39 UTC (rev 69322)
@@ -78,7 +78,12 @@
<Dir
Include='Test\resources\MakeDir\C' />
</ItemGroup>
<Target Name='1'>
- <MakeDir Directories='@(Dir)' />
+ <MakeDir Directories='@(Dir)'>
+ <Output
+
TaskParameter='DirectoriesCreated'
+ ItemName='Out'
+ />
+ </MakeDir>
</Target>
</Project>
";
@@ -92,7 +97,11 @@
Assert.AreEqual (Path.Combine (path, "A"),
Directory.GetDirectories (path) [0], "A2");
Assert.AreEqual (Path.Combine (path, "B"),
Directory.GetDirectories (path) [1], "A3");
Assert.AreEqual (Path.Combine (path, "C"),
Directory.GetDirectories (path) [2], "A4");
+
+ BuildItemGroup output = project.GetEvaluatedItemsByName
("Out");
+ Assert.AreEqual (Path.Combine (path, "A"), output
[0].FinalItemSpec, "A5");
+ Assert.AreEqual (Path.Combine (path, "B"), output
[1].FinalItemSpec, "A6");
+ Assert.AreEqual (Path.Combine (path, "C"), output
[2].FinalItemSpec, "A7");
}
}
}
-
Added:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDirTest.cs
===================================================================
---
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDirTest.cs
2006-12-11 13:46:22 UTC (rev 69321)
+++
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDirTest.cs
2006-12-11 13:48:39 UTC (rev 69322)
@@ -0,0 +1,109 @@
+//
+// RemoveDirTest.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.Collections;
+using System.IO;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.Tasks {
+
+ [TestFixture]
+ public class RemoveDirTest {
+
+ [SetUp]
+ public void CreateDir ()
+ {
+ string path = Path.Combine (Path.Combine ("Test",
"resources"), "RemoveDir");
+ Directory.CreateDirectory (path);
+ }
+
+ [TearDown]
+ public void RemoveDirectories ()
+ {
+ string path = Path.Combine (Path.Combine ("Test",
"resources"), "RemoveDir");
+ Directory.Delete (path, true);
+ }
+
+ [Test]
+ public void TestAssignment ()
+ {
+ RemoveDir rd = new RemoveDir ();
+
+ rd.Directories = new ITaskItem [] { new TaskItem ("A")};
+
+ Assert.AreEqual ("A", rd.Directories [0].ItemSpec,
"A1");
+ }
+
+ [Test]
+ public void TestExecution1 ()
+ {
+ Engine engine;
+ Project project;
+ string path = Path.Combine (Path.Combine ("Test",
"resources"), "RemoveDir");
+
+ string documentString = @"
+ <Project
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <Dir
Include='Test\resources\RemoveDir\A\B' />
+ <Dir
Include='Test\resources\RemoveDir\A' />
+ <Dir
Include='Test\resources\RemoveDir\C' />
+ </ItemGroup>
+ <Target Name='1'>
+ <RemoveDir Directories='@(Dir)'>
+ <Output
+
TaskParameter='RemovedDirectories'
+ ItemName='Out'
+ />
+ </RemoveDir>
+ </Target>
+ </Project>
+ ";
+
+ Directory.CreateDirectory (Path.Combine (path, "A"));
+ Directory.CreateDirectory (Path.Combine (Path.Combine
(path, "A"), "B"));
+ Directory.CreateDirectory (Path.Combine (path, "C"));
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+ Assert.IsTrue (project.Build ("1"), "A1");
+
+ Assert.AreEqual (0, Directory.GetDirectories
(path).Length, "A2");
+
+ BuildItemGroup output = project.GetEvaluatedItemsByName
("Out");
+ Assert.AreEqual (Path.Combine (Path.Combine (path,
"A"), "B"), output [0].FinalItemSpec, "A3");
+ Assert.AreEqual (Path.Combine (path, "A"), output
[1].FinalItemSpec, "A4");
+ Assert.AreEqual (Path.Combine (path, "C"), output
[2].FinalItemSpec, "A5");
+
+ }
+ }
+}
Property changes on:
trunk/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/RemoveDirTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches