From 69b9c56f55117e2df82e74369b017cc17dc82b90 Mon Sep 17 00:00:00 2001 From: Iain McCoy Date: Sat, 30 Jul 2005 02:02:58 +0000 Subject: 2005-07-24 Iain McCoy * Test/AttachedProperties.cs: made LocalValueEnumerator test not depend on unstable implementation details svn path=/trunk/mcs/; revision=47851 --- mcs/class/WindowsBase/ChangeLog | 5 +++++ mcs/class/WindowsBase/Test/AttachedProperties.cs | 24 ++++++++++++++---------- 2 files changed, 19 insertions(+), 10 deletions(-) (limited to 'mcs/class/WindowsBase') diff --git a/mcs/class/WindowsBase/ChangeLog b/mcs/class/WindowsBase/ChangeLog index e4967da5941..43fa5851942 100644 --- a/mcs/class/WindowsBase/ChangeLog +++ b/mcs/class/WindowsBase/ChangeLog @@ -1,3 +1,8 @@ +2005-07-24 Iain McCoy + + * Test/AttachedProperties.cs: made LocalValueEnumerator test not + depend on unstable implementation details + 2005-07-19 Iain McCoy * System.Windows/DependencyObject.cs, diff --git a/mcs/class/WindowsBase/Test/AttachedProperties.cs b/mcs/class/WindowsBase/Test/AttachedProperties.cs index 6f6119b1a67..e7b15e2b113 100644 --- a/mcs/class/WindowsBase/Test/AttachedProperties.cs +++ b/mcs/class/WindowsBase/Test/AttachedProperties.cs @@ -75,20 +75,24 @@ public class DependencyObjectTest { [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 -- cgit v1.2.3