Assert.AreEqual (false, item.IsImported, "A5");
Assert.AreEqual (itemName, item.Name, "A6");
}
-
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestCtor3 ()
+ {
+ new BuildItem (null, (string) null);
+ }
+
+ [Test]
+ [Ignore ("NullRefException on MS .NET 2.0")]
+ public void TestCtor4 ()
+ {
+ new BuildItem (null, (ITaskItem) null);
+ }
+
+ [Test]
+ public void TestCtor5 ()
+ {
+ new BuildItem (null, "something");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException),
+ "Parameter \"itemInclude\" cannot have zero length.")]
+ public void TestCtor6 ()
+ {
+ new BuildItem (null, String.Empty);
+ }
+
+ [Test]
+ [Ignore ("IndexOutOfRange on MS .NET 2.0")]
+ public void TestCtor7 ()
+ {
+ new BuildItem (String.Empty, "something");
+ }
+
[Test]
public void TestCopyCustomMetadataTo1 ()
{
}
[Test]
- public void TestRemoveMetadata ()
+ public void TestRemoveMetadata1 ()
{
string itemName = "a";
string itemInclude = "a";
Assert.AreEqual (false, item.HasMetadata (metadataName), "A2");
}
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestRemoveMetadata2 ()
+ {
+ item = new BuildItem ("name", "value");
+ item.RemoveMetadata (null);
+ }
+
+ [Test]
+ public void TestRemoveMetadata3 ()
+ {
+ item = new BuildItem ("name", "value");
+ item.RemoveMetadata ("undefined_metadata");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestSetMetadata1 ()
+ {
+ item = new BuildItem ("name", "include");
+ item.SetMetadata (null, null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestSetMetadata2 ()
+ {
+ item = new BuildItem ("name", "include");
+ item.SetMetadata ("name", null);
+ }
+
+ [Test]
+ public void TestSetMetadata3 ()
+ {
+ item = new BuildItem ("name", "include");
+ item.SetMetadata ("a", "$(A)");
+ item.SetMetadata ("b", "$(A)", true);
+ item.SetMetadata ("c", "$(A)", false);
+
+ Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("a"), "A1");
+ Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("b"), "A2");
+ Assert.AreEqual ("$(A)", item.GetEvaluatedMetadata ("c"), "A3");
+ Assert.AreEqual ("$(A)", item.GetMetadata ("a"), "A4");
+ Assert.AreEqual (Utilities.Escape ("$(A)"), item.GetMetadata ("b"), "A5");
+ Assert.AreEqual ("$(A)", item.GetMetadata ("c"), "A6");
+ }
}
}
Assert.AreEqual (0, bpg.Count);
Assert.AreEqual (false, bpg.IsImported);
}
-
+
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException),
+ "This method is only valid for persisted <System.Object[]> elements.")]
+ public void TestAddNewProperty1 ()
+ {
+ string name = "name";
+ string value = "value";
+
+ bpg = new BuildPropertyGroup ();
+
+ bpg.AddNewProperty (name, value);
+ }
+
[Test]
[ExpectedException (typeof (InvalidOperationException),
"Properties in persisted property groups cannot be accessed by name.")]
Assert.AreEqual ("Value", bpg ["Name"].Value, "A3");
}
- [Test]
- [ExpectedException (typeof (InvalidOperationException),
- "This method is only valid for persisted <System.Object[]> elements.")]
- public void TestAddNewProperty1 ()
- {
- string name = "name";
- string value = "value";
-
- bpg = new BuildPropertyGroup ();
-
- bpg.AddNewProperty (name, value);
- }
-
[Test]
public void TestClear ()
{
Assert.AreEqual (String.Empty, bpg.Condition, "A1");
}
+
+ [Test]
+ public void TestGetEnumerator ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.SetProperty ("a", "c");
+ bpg.SetProperty ("b", "d");
+
+ IEnumerator e = bpg.GetEnumerator ();
+ e.MoveNext ();
+ Assert.AreEqual ("a", ((BuildProperty) e.Current).Name, "A1");
+ Assert.AreEqual ("c", ((BuildProperty) e.Current).Value, "A2");
+ Assert.AreEqual ("c", ((BuildProperty) e.Current).FinalValue, "A3");
+ e.MoveNext ();
+ Assert.AreEqual ("b", ((BuildProperty) e.Current).Name, "A4");
+ Assert.AreEqual ("d", ((BuildProperty) e.Current).Value, "A5");
+ Assert.AreEqual ("d", ((BuildProperty) e.Current).FinalValue, "A6");
+
+ Assert.IsFalse (e.MoveNext ());
+ }
+
+ [Test]
+ [Ignore ("NullRefException on MS .NET 2.0")]
+ public void TestRemoveProperty1 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.RemoveProperty ((BuildProperty) null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestRemoveProperty2 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.SetProperty ("a", "b");
+ bpg.SetProperty ("c", "d");
+
+ bpg.RemoveProperty ((string) null);
+ }
+
+ [Test]
+ public void TestRemoveProperty3 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.SetProperty ("a", "b");
+ bpg.SetProperty ("c", "d");
+
+ bpg.RemoveProperty ("value_not_in_group");
+ }
+
+ [Test]
+ public void TestRemoveProperty4 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.SetProperty ("a", "b");
+ bpg.SetProperty ("c", "d");
+
+ bpg.RemoveProperty (new BuildProperty ("name", "value"));
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestSetProperty1 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.SetProperty (null, null);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestSetProperty2 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+ bpg.SetProperty ("name", null);
+ }
+
+ [Test]
+ public void TestSetProperty3 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+
+ bpg.SetProperty ("name", "$(A)");
+
+ BuildProperty bp = bpg ["name"];
+
+ Assert.AreEqual ("name", bp.Name, "A1");
+ Assert.AreEqual ("$(A)", bp.Value, "A2");
+ Assert.AreEqual ("$(A)", bp.FinalValue, "A3");
+ }
+
+ [Test]
+ [Category ("NotWorking")]
+ public void TestSetProperty4 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+
+ bpg.SetProperty ("P1", "$(A)", true);
+ bpg.SetProperty ("P2", "$(A)", false);
+
+ BuildProperty b1 = bpg ["P1"];
+ BuildProperty b2 = bpg ["P2"];
+
+ Assert.AreEqual ("P1", b1.Name, "A1");
+ Assert.AreEqual (Utilities.Escape ("$(A)"), b1.Value, "A2");
+ Assert.AreEqual ("$(A)", b1.FinalValue, "A3");
+ Assert.AreEqual ("P2", b2.Name, "A4");
+ Assert.AreEqual ("$(A)", b2.Value, "A5");
+ Assert.AreEqual ("$(A)", b2.FinalValue, "A6");
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException),
+ "The name \"1\" contains an invalid character \"1\".")]
+ [Category ("NotWorking")]
+ public void TestSetProperty5 ()
+ {
+ BuildPropertyGroup bpg = new BuildPropertyGroup ();
+
+ bpg.SetProperty ("1", "$(A)");
+ }
}
}
}
[Test]
- [ExpectedException (typeof (ArgumentNullException),
- "Parameter \"propertyName\" cannot be null.")]
+ [ExpectedException (typeof (ArgumentNullException))]
public void TestCtor2 ()
{
bp = new BuildProperty (null, "value");
}
[Test]
- [ExpectedException (typeof (ArgumentNullException),
- "Parameter \"propertyValue\" cannot be null.")]
+ [ExpectedException (typeof (ArgumentNullException))]
public void TestCtor3 ()
{
bp = new BuildProperty ("name", null);
bt [0].ContinueOnError = false;
Assert.IsFalse (bt [0].ContinueOnError, "A4");
}
+
+ [Test]
+ public void TestAddOutputItem1 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+ <Target Name='T'>
+ <Message />
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ Target [] t = new Target [1];
+ BuildTask [] bt;
+ project.Targets.CopyTo (t, 0);
+ bt = GetTasks (t [0]);
+
+ bt [0].AddOutputItem (null, null);
+ }
+
+ [Test]
+ public void TestAddOutputItem2 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+ <UsingTask
+ AssemblyFile='Test\resources\TestTasks.dll'
+ TaskName='OutputTestTask'
+ />
+ <Target Name='T'>
+ <OutputTestTask />
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ Target [] t = new Target [1];
+ BuildTask [] bt;
+ project.Targets.CopyTo (t, 0);
+ bt = GetTasks (t [0]);
+
+ bt [0].AddOutputItem ("Property", "ItemName");
+ project.Build ("T");
+
+ Assert.AreEqual ("ItemName", project.EvaluatedItems [0].Name, "A1");
+ Assert.AreEqual ("some_text", project.EvaluatedItems [0].FinalItemSpec, "A2");
+ }
+
+ [Test]
+ public void TestAddOutputProperty1 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+ <Target Name='T'>
+ <Message />
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ Target [] t = new Target [1];
+ BuildTask [] bt;
+ project.Targets.CopyTo (t, 0);
+ bt = GetTasks (t [0]);
+
+ bt [0].AddOutputProperty (null, null);
+ }
+
+ [Test]
+ public void TestAddOutputProperty2 ()
+ {
+ Engine engine;
+ Project project;
+
+ string documentString = @"
+ <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
+ <UsingTask
+ AssemblyFile='Test\resources\TestTasks.dll'
+ TaskName='OutputTestTask'
+ />
+ <Target Name='T'>
+ <OutputTestTask />
+ </Target>
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ Target [] t = new Target [1];
+ BuildTask [] bt;
+ project.Targets.CopyTo (t, 0);
+ bt = GetTasks (t [0]);
+
+ bt [0].AddOutputProperty ("Property", "PropertyName");
+ project.Build ("T");
+
+ Assert.AreEqual ("some_text", project.EvaluatedProperties ["PropertyName"].Value, "A1");
+ Assert.AreEqual ("some_text", project.EvaluatedProperties ["PropertyName"].FinalValue, "A1");
+ }
}
}
+2006-12-07 Marek Sieradzki <marek.sieradzki@gmail.com>
+
+ * BuildItemTest.cs, BuildPropertyGroupTest.cs, BuildTaskTest.cs,
+ UsingTaskCollectionTest.cs, ProjectTest.cs: More tests.
+
2006-12-05 Marek Sieradzki <marek.sieradzki@gmail.com>
* BuildItemTest.cs: Reformatted.
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 {
string documentString =
"<Project></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 (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]
+ [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 ();
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");
+ }
+
+ [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");
}
[Test]
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, "A1");
+ }
+
+ [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, "A1");
+ }
+
+ [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, "A1");
+ }
+
+ [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]
+ 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 ()
{
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 ()
IEnumerator en = project.UsingTasks.GetEnumerator ();
en.MoveNext ();
}
+ [Test]
+ [ExpectedException (typeof (ArgumentNullException))]
+ public void TestCopyTo1 ()
+ {
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <UsingTask
+ AssemblyFile='Test/resources/TestTasks.dll'
+ TaskName='SimpleTask'
+ />
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ project.UsingTasks.CopyTo (null, 0);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
+ public void TestCopyTo2 ()
+ {
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <UsingTask
+ AssemblyFile='Test/resources/TestTasks.dll'
+ TaskName='SimpleTask'
+ />
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ project.UsingTasks.CopyTo (new UsingTask [1], -1);
+ }
+
+ [Test]
+ [Ignore ("Throws InvalidCastException on MS NET 2.0")]
+ public void TestCopyTo3 ()
+ {
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <UsingTask
+ AssemblyFile='Test/resources/TestTasks.dll'
+ TaskName='SimpleTask'
+ />
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ project.UsingTasks.CopyTo (new UsingTask [][] { new UsingTask [] {
+ null}}, 0);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void TestCopyTo4 ()
+ {
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <UsingTask
+ AssemblyFile='Test/resources/TestTasks.dll'
+ TaskName='SimpleTask'
+ />
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ project.UsingTasks.CopyTo (new UsingTask [1], 2);
+ }
+
+ [Test]
+ [ExpectedException (typeof (ArgumentException))]
+ public void TestCopyTo5 ()
+ {
+ string documentString = @"
+ <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <UsingTask
+ AssemblyFile='Test/resources/TestTasks.dll'
+ TaskName='SimpleTask'
+ />
+ </Project>
+ ";
+
+ engine = new Engine (Consts.BinPath);
+
+ project = engine.CreateNewProject ();
+ project.LoadXml (documentString);
+
+ project.UsingTasks.CopyTo (new UsingTask [1], 1);
+ }
}
}