2 // BuildPropertyGroupCollectionTest.cs
5 // Marek Sieradzki (marek.sieradzki@gmail.com)
7 // (C) 2006 Marek Sieradzki
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections;
30 using Microsoft.Build.BuildEngine;
31 using Microsoft.Build.Framework;
32 using Microsoft.Build.Utilities;
33 using NUnit.Framework;
35 namespace MonoTests.Microsoft.Build.BuildEngine {
37 public class BuildPropertyGroupCollectionTest {
46 binPath = "../../tools/xbuild/xbuild";
51 // NOTE: It's throwing nullrefexception on NET 2.0
52 [ExpectedException (typeof (ArgumentNullException))]
53 public void TestCopyTo1 ()
55 string documentString = @"
56 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
63 engine = new Engine (binPath);
65 project = engine.CreateNewProject ();
66 project.LoadXml (documentString);
68 project.PropertyGroups.CopyTo (null, 0);
73 [ExpectedException (typeof (IndexOutOfRangeException),
74 "Index was outside the bounds of the array.")]
75 public void TestCopyTo2 ()
77 string documentString = @"
78 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
85 engine = new Engine (binPath);
87 project = engine.CreateNewProject ();
88 project.LoadXml (documentString);
90 project.PropertyGroups.CopyTo (new BuildPropertyGroup [1], -1);
95 // NOTE: that's msbuild's internal error
96 [ExpectedException (typeof (InvalidCastException))]
97 public void TestCopyTo3 ()
99 string documentString = @"
100 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
107 engine = new Engine (binPath);
109 project = engine.CreateNewProject ();
110 project.LoadXml (documentString);
112 project.PropertyGroups.CopyTo (new BuildPropertyGroup [][] { new BuildPropertyGroup [] {
113 new BuildPropertyGroup ()}}, 0);
118 [ExpectedException (typeof (IndexOutOfRangeException),
119 "Index was outside the bounds of the array.")]
120 public void TestCopyTo4 ()
122 string documentString = @"
123 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
130 engine = new Engine (binPath);
132 project = engine.CreateNewProject ();
133 project.LoadXml (documentString);
135 project.PropertyGroups.CopyTo (new BuildPropertyGroup [1], 2);
139 [ExpectedException (typeof (IndexOutOfRangeException),
140 "Index was outside the bounds of the array.")]
141 public void TestCopyTo5 ()
143 string documentString = @"
144 <Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
151 engine = new Engine (binPath);
153 project = engine.CreateNewProject ();
154 project.LoadXml (documentString);
156 project.PropertyGroups.CopyTo (new BuildPropertyGroup [1], 1);