[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-patches
Subject:    [Mono-patches] r47851 - in trunk/mcs/class/WindowsBase: . Test
From:       "Iain McCoy <iain () mccoy ! id ! au>" <iainmc () mono-cvs ! ximian ! com>
Date:       2005-07-30 2:02:59
Message-ID: 20050730020259.197A19472C () mono-cvs ! ximian ! com
[Download RAW message or body]

Author: iainmc
Date: 2005-07-29 22:02:58 -0400 (Fri, 29 Jul 2005)
New Revision: 47851

Modified:
   trunk/mcs/class/WindowsBase/ChangeLog
   trunk/mcs/class/WindowsBase/Test/AttachedProperties.cs
Log:
2005-07-24  Iain McCoy  <iain@mccoy.id.au>

	* Test/AttachedProperties.cs: made LocalValueEnumerator test not
	depend on unstable implementation details



Modified: trunk/mcs/class/WindowsBase/ChangeLog
===================================================================
--- trunk/mcs/class/WindowsBase/ChangeLog	2005-07-30 01:24:55 UTC (rev 47850)
+++ trunk/mcs/class/WindowsBase/ChangeLog	2005-07-30 02:02:58 UTC (rev 47851)
@@ -1,3 +1,8 @@
+2005-07-24  Iain McCoy  <iain@mccoy.id.au>
+
+	* Test/AttachedProperties.cs: made LocalValueEnumerator test not
+	depend on unstable implementation details
+
 2005-07-19  Iain McCoy  <iain@mccoy.id.au>
 
 	* System.Windows/DependencyObject.cs,

Modified: trunk/mcs/class/WindowsBase/Test/AttachedProperties.cs
===================================================================
--- trunk/mcs/class/WindowsBase/Test/AttachedProperties.cs	2005-07-30 01:24:55 UTC (rev 47850)
+++ trunk/mcs/class/WindowsBase/Test/AttachedProperties.cs	2005-07-30 02:02:58 UTC (rev 47851)
@@ -75,20 +75,24 @@
 	[Test]
 	public void TestEnumerationOfAttachedProperties()
 	{
+		int count = 0;
 		Y y = new Y();
 		X.SetA(y, 2);
 		X.SetB(y, "Hi");
-		// This test is a bit dodgy, because no guarantees are 
-		// made about the order in which properties and their
-		// values will be returned
+
 		LocalValueEnumerator e = y.GetLocalValueEnumerator();
-		Assert.IsTrue(e.MoveNext());
-		Assert.AreEqual(e.Current.Property, X.AProperty);
-		Assert.AreEqual(e.Current.Value, 2);
-		Assert.IsTrue(e.MoveNext());
-		Assert.AreEqual(e.Current.Property, X.BProperty);
-		Assert.AreEqual(e.Current.Value, "Hi");
-		Assert.IsFalse(e.MoveNext());
+		while (e.MoveNext()) {
+			count++;
+			if (e.Current.Property == X.AProperty)
+				Assert.AreEqual(e.Current.Value, 2);
+			else if (e.Current.Property == X.BProperty)
+				Assert.AreEqual(e.Current.Value, "Hi");
+			else
+				Assert.Fail("Wrong sort of property" + e.Current.Property);
+		}
+
+		
+		Assert.AreEqual(2, count);
 	}
 
 	// An nice way to test for exceptions the class under test should 

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic