Author: msierad
Date: 2006-06-02 17:41:12 -0400 (Fri, 02 Jun 2006)
New Revision: 61424

Added:
   
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
   
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
   
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
Modified:
   
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources
   
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
   trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp
Log:
2006-06-02  Marek Sieradzki  <[EMAIL PROTECTED]>

        * BuildPropertyTest.cs: Added.
        * BuildPropertyGroupTest.cs: Added.
        * BuildPropertyGroupCollectionTest.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-06-02 20:26:49 UTC (rev 61423)
+++ 
trunk/mcs/class/Microsoft.Build.Engine/Microsoft.Build.Engine_test.dll.sources  
    2006-06-02 21:41:12 UTC (rev 61424)
@@ -1,4 +1,7 @@
 Microsoft.Build.BuildEngine/BuildItemTest.cs
+Microsoft.Build.BuildEngine/BuildPropertyTest.cs
+Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
+Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
 Microsoft.Build.BuildEngine/EngineTest.cs
 Microsoft.Build.BuildEngine/InternalLoggerExceptionTest.cs
 Microsoft.Build.BuildEngine/InvalidProjectFileExceptionTest.cs

Added: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
 2006-06-02 20:26:49 UTC (rev 61423)
+++ 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
 2006-06-02 21:41:12 UTC (rev 61424)
@@ -0,0 +1,160 @@
+//
+// BuildPropertyGroupCollectionTest.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 Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class BuildPropertyGroupCollectionTest {
+               
+               string                  binPath;
+               Engine                  engine;
+               Project                 project;
+               
+               [SetUp]
+               public void SetUp ()
+               {
+                       binPath = "../../tools/xbuild/xbuild";
+               }
+
+               /*
+               [Test]
+               // NOTE: It's throwing nullrefexception on NET 2.0
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void TestCopyTo1 ()
+               {
+                       string documentString = @"
+                               <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (binPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+                       
+                       project.PropertyGroups.CopyTo (null, 0);
+               }
+               */
+
+               [Test]
+               [ExpectedException (typeof (IndexOutOfRangeException),
+                       "Index was outside the bounds of the array.")]
+               public void TestCopyTo2 ()
+               {
+                       string documentString = @"
+                               <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (binPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+                       
+                       project.PropertyGroups.CopyTo (new BuildPropertyGroup 
[1], -1);
+               }
+
+               /*
+               [Test]
+               // NOTE: that's msbuild's internal error
+               [ExpectedException (typeof (InvalidCastException))]
+               public void TestCopyTo3 ()
+               {
+                       string documentString = @"
+                               <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (binPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+                       
+                       project.PropertyGroups.CopyTo (new BuildPropertyGroup 
[][] { new BuildPropertyGroup [] {
+                               new BuildPropertyGroup ()}}, 0);
+               }
+               */
+
+               [Test]
+               [ExpectedException (typeof (IndexOutOfRangeException),
+                       "Index was outside the bounds of the array.")]
+               public void TestCopyTo4 ()
+               {
+                       string documentString = @"
+                               <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (binPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+                       
+                       project.PropertyGroups.CopyTo (new BuildPropertyGroup 
[1], 2);
+               }
+
+               [Test]
+               [ExpectedException (typeof (IndexOutOfRangeException),
+                       "Index was outside the bounds of the array.")]
+               public void TestCopyTo5 ()
+               {
+                       string documentString = @"
+                               <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                               </Project>
+                       ";
+
+                       engine = new Engine (binPath);
+
+                       project = engine.CreateNewProject ();
+                       project.LoadXml (documentString);
+                       
+                       project.PropertyGroups.CopyTo (new BuildPropertyGroup 
[1], 1);
+               }
+
+       }
+}


Property changes on: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
   2006-06-02 20:26:49 UTC (rev 61423)
+++ 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
   2006-06-02 21:41:12 UTC (rev 61424)
@@ -0,0 +1,75 @@
+//
+// BuildPropertyGroupTest.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 Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class BuildPropertyGroupTest {
+               
+               string                  binPath;
+               Engine                  engine;
+               Project                 project;
+               
+               [SetUp]
+               public void SetUp ()
+               {
+                       binPath = "../../tools/xbuild/xbuild";
+               }
+               
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException),
+                       "Properties in persisted property groups cannot be 
accessed by name.")]
+               public void TestClone1 ()
+               {
+                       BuildPropertyGroup bpg;
+                       
+                        string documentString = @"
+                                <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                                </Project>
+                        ";
+
+                        engine = new Engine (binPath);
+
+                        project = engine.CreateNewProject ();
+                        project.LoadXml (documentString);
+
+                       IEnumerator en = project.PropertyGroups.GetEnumerator 
();
+                       en.MoveNext ();
+                       bpg = (BuildPropertyGroup) en.Current;
+                       Assert.AreEqual ("Value", bpg ["Name"].Value, "A3");
+               }
+       }
+}


Property changes on: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
===================================================================
--- 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
        2006-06-02 20:26:49 UTC (rev 61423)
+++ 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
        2006-06-02 21:41:12 UTC (rev 61424)
@@ -0,0 +1,247 @@
+//
+// BuildPropertyTest.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 Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+
+namespace MonoTests.Microsoft.Build.BuildEngine {
+       [TestFixture]
+       public class BuildPropertyTest {
+               
+               BuildProperty   bp;
+               string          binPath;
+               Engine          engine;
+               Project         project;
+               
+               [SetUp]
+               public void SetUp ()
+               {
+                       binPath = "../../tools/xbuild/xbuild";
+               }
+               
+               [Test]
+               public void TestCtor1 ()
+               {
+                       string name = "name";
+                       string value = "value";
+               
+                       bp = new BuildProperty (name, value);
+                       
+                       Assert.AreEqual (name, bp.Name, "A1");
+                       Assert.AreEqual (value, bp.Value, "A2");
+                       Assert.AreEqual (String.Empty, bp.Condition, "A3");
+                       Assert.AreEqual (value, bp.FinalValue, "A4");
+                       Assert.AreEqual (false, bp.IsImported, "A5");
+                       Assert.AreEqual (value, bp.ToString (), "A6");
+               
+                       name = "name";
+                       value = "$(AnotherProperty)";
+               
+                       bp = new BuildProperty (name, value);
+                       
+                       Assert.AreEqual (name, bp.Name, "A7");
+                       Assert.AreEqual (value, bp.Value, "A8");
+                       Assert.AreEqual (String.Empty, bp.Condition, "A9");
+                       Assert.AreEqual (value, bp.FinalValue, "A10");
+                       Assert.AreEqual (false, bp.IsImported, "A11");
+                       Assert.AreEqual (value, bp.ToString (), "A12");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException),
+                       "Parameter \"propertyName\" cannot be null.")]
+               public void TestCtor2 ()
+               {
+                       bp = new BuildProperty (null, "value");
+                       
+               }
+               
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException),
+                       "Parameter \"propertyValue\" cannot be null.")]
+               public void TestCtor3 ()
+               {
+                       bp = new BuildProperty ("name", null);
+                       
+               }
+
+               [Test]
+               [ExpectedException (typeof (InvalidOperationException),
+                       "A shallow clone of this object cannot be created.")]
+               public void TestClone1 ()
+               {
+                       bp = new BuildProperty ("name", "value");
+                       
+                       bp.Clone (false);
+               }
+
+               [Test]
+               public void TestClone2 ()
+               {
+                       bp = new BuildProperty ("name", "value");
+                       
+                       bp.Clone (true);
+               }
+               
+               [Test]
+               public void TestClone3 ()
+               {
+                       BuildProperty a,b;
+                       
+                        string documentString = @"
+                                <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                                </Project>
+                        ";
+
+                        engine = new Engine (binPath);
+
+                        project = engine.CreateNewProject ();
+                        project.LoadXml (documentString);
+
+                       a = project.EvaluatedProperties ["Name"];
+                       Assert.AreEqual ("Value", a.Value, "A1");
+                       
+                       b = a.Clone (false);
+                       
+                       b.Value = "AnotherValue";
+                       Assert.AreEqual ("Value", a.Value, "A2");
+               }
+
+               [Test]
+               public void TestClone4 ()
+               {
+                       BuildProperty a,b;
+                       
+                        string documentString = @"
+                                <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                                </Project>
+                        ";
+
+                        engine = new Engine (binPath);
+
+                        project = engine.CreateNewProject ();
+                        project.LoadXml (documentString);
+
+                       a = project.EvaluatedProperties ["Name"];
+                       Assert.AreEqual ("Value", a.Value, "A1");
+                       
+                       b = a.Clone (true);
+                       
+                       b.Value = "AnotherValue";
+                       Assert.AreEqual ("Value", a.Value, "A2");
+               }
+
+               [Test]
+               public void TestClone5 ()
+               {
+                       BuildProperty a,b;
+                       IList properties = new ArrayList ();
+                       
+                        string documentString = @"
+                                <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                                </Project>
+                        ";
+
+                        engine = new Engine (binPath);
+
+                        project = engine.CreateNewProject ();
+                        project.LoadXml (documentString);
+
+                       foreach (BuildPropertyGroup bpg in 
project.PropertyGroups)
+                               foreach (BuildProperty bpr in bpg)
+                                       properties.Add (bpr);
+                       
+                       a = (BuildProperty) properties [0];
+                       Assert.AreEqual ("Value", a.Value, "A1");
+                       
+                       b = a.Clone (false);
+                       
+                       b.Value = "AnotherValue";
+                       Assert.AreEqual ("Value", a.Value, "A2");
+               }
+
+               [Test]
+               public void TestClone6 ()
+               {
+                       BuildProperty a,b;
+                       IList properties = new ArrayList ();
+                       
+                        string documentString = @"
+                                <Project 
xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"";>
+                                       <PropertyGroup>
+                                               <Name>Value</Name>
+                                       </PropertyGroup>
+                                </Project>
+                        ";
+
+                        engine = new Engine (binPath);
+
+                        project = engine.CreateNewProject ();
+                        project.LoadXml (documentString);
+
+                       foreach (BuildPropertyGroup bpg in 
project.PropertyGroups)
+                               foreach (BuildProperty bpr in bpg)
+                                       properties.Add (bpr);
+                       
+                       a = (BuildProperty) properties [0];
+                       Assert.AreEqual ("Value", a.Value, "A1");
+                       
+                       b = a.Clone (true);
+                       
+                       b.Value = "AnotherValue";
+                       Assert.AreEqual ("Value", a.Value, "A2");
+               }
+               
+               [Test]
+               public void TestOpExplicit ()
+               {
+                       bp = new BuildProperty ("name", "value");
+                       
+                       Assert.AreEqual ("value", (string) bp, "A1");
+               }
+               
+               [Test]
+               public void TestToString ()
+               {
+                       bp = new BuildProperty ("name", "a;b");
+                       Assert.AreEqual ("a;b", bp.ToString ());
+               }
+       }
+}


Property changes on: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/BuildPropertyTest.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
===================================================================
--- 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
   2006-06-02 20:26:49 UTC (rev 61423)
+++ 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
   2006-06-02 21:41:12 UTC (rev 61424)
@@ -1,3 +1,9 @@
+2006-06-02  Marek Sieradzki  <[EMAIL PROTECTED]>
+
+       * BuildPropertyTest.cs: Added.
+       * BuildPropertyGroupTest.cs: Added.
+       * BuildPropertyGroupCollectionTest.cs: Added.
+
 2006-05-27  Marek Sieradzki  <[EMAIL PROTECTED]>
 
        * BuildItemTest.cs: Swapped expected with actual results.

Modified: 
trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp
===================================================================
--- trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp 
2006-06-02 20:26:49 UTC (rev 61423)
+++ trunk/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.Engine.Test.mdp 
2006-06-02 21:41:12 UTC (rev 61424)
@@ -23,6 +23,9 @@
     <File name="./Microsoft.Build.BuildEngine/ProjectTest.cs" subtype="Code" 
buildaction="Compile" />
     <File name="./Microsoft.Build.BuildEngine/BuildItemTest.cs" subtype="Code" 
buildaction="Compile" />
     <File name="./Microsoft.Build.BuildEngine/UtilitiesTest.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildPropertyTest.cs" 
subtype="Code" buildaction="Compile" />
+    <File name="./Microsoft.Build.BuildEngine/BuildPropertyGroupTest.cs" 
subtype="Code" buildaction="Compile" />
+    <File 
name="./Microsoft.Build.BuildEngine/BuildPropertyGroupCollectionTest.cs" 
subtype="Code" buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, 
Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to