2005-10-12 Chris Toshok <toshok@ximian.com>
authorChris Toshok <toshok@novell.com>
Wed, 12 Oct 2005 20:34:59 +0000 (20:34 -0000)
committerChris Toshok <toshok@novell.com>
Wed, 12 Oct 2005 20:34:59 +0000 (20:34 -0000)
* System.Configuration/KeyValueConfigurationCollectionTest.cs: add
some duplicate add tests.

* System.Configuration/CommaDelimitedStringCollectionTest.cs:
correct for 2.0 RC.

* System.Configuration/KeyValueConfigurationElementTest.cs:
correct for 2.0 RC.

svn path=/trunk/mcs/; revision=51662

mcs/class/System.Configuration/Test/ChangeLog
mcs/class/System.Configuration/Test/System.Configuration/CommaDelimitedStringCollectionTest.cs
mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationCollectionTest.cs
mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationElementTest.cs

index c576f7f8a41a3334a099ba6e8f8ff27920903383..3c8bc92c66d8d80f22f263776e8bd2a89e681f47 100644 (file)
@@ -1,3 +1,14 @@
+2005-10-12  Chris Toshok  <toshok@ximian.com>
+
+       * System.Configuration/KeyValueConfigurationCollectionTest.cs: add
+       some duplicate add tests.
+
+       * System.Configuration/CommaDelimitedStringCollectionTest.cs:
+       correct for 2.0 RC.
+
+       * System.Configuration/KeyValueConfigurationElementTest.cs:
+       correct for 2.0 RC.
+
 2005-10-06  Chris Toshok  <toshok@ximian.com>
 
        * System.Configuration/KeyValueConfigurationCollectionTest.cs: new
index 16e7ef925dc31a1d4e69b2c45dbf7add9336975f..22e95341a0659b16e975089dd0269ef2c77cc0ae 100644 (file)
@@ -64,9 +64,9 @@ namespace MonoTests.System.Configuration {
                        Assert.AreEqual ("1,2,3", c.ToString(), "A4");
 
                        c.Clear ();
-                       Assert.AreEqual ("", c.ToString(), "A5");
+                       Assert.AreEqual (null, c.ToString(), "A5");
 
-                       string[] foo = new string[2];
+                       string[] foo = new string[3];
                        foo[0] = "1";
                        foo[1] = "2";
                        foo[2] = "3";
@@ -75,6 +75,7 @@ namespace MonoTests.System.Configuration {
                }
 
                [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
                public void RO_Add ()
                {
                        CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();
@@ -84,6 +85,7 @@ namespace MonoTests.System.Configuration {
                }
 
                [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
                public void RO_AddRange ()
                {
                        CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();
@@ -97,6 +99,7 @@ namespace MonoTests.System.Configuration {
                }
 
                [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
                public void RO_Clear ()
                {
                        CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();
@@ -106,6 +109,7 @@ namespace MonoTests.System.Configuration {
                }
 
                [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
                public void RO_Remove ()
                {
                        CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();
@@ -115,6 +119,7 @@ namespace MonoTests.System.Configuration {
                }
 
                [Test]
+               [ExpectedException (typeof (ConfigurationErrorsException))]
                public void RO_Insert ()
                {
                        CommaDelimitedStringCollection c = new CommaDelimitedStringCollection ();
index 69b575edd993fe00c4a2115c16aebfb004b8f207..cb595106270214ee1a26d2f37a338b9b534fa0cd 100644 (file)
@@ -64,6 +64,11 @@ namespace MonoTests.System.Configuration {
                        {
                                return base.GetElementKey (element);
                        }
+
+                       public object[] GetAllKeys ()
+                       {
+                               return base.BaseGetAllKeys();
+                       }
                }
 
                class ElementPoker : KeyValueConfigurationElement
@@ -123,6 +128,23 @@ namespace MonoTests.System.Configuration {
                        p.Add (ep);
                }
 
+
+               [Test]
+               public void AddDuplicate ()
+               {
+                       Poker p = new Poker (true);
+                       ElementPoker ep;
+
+                       ep = new ElementPoker ("hi", "bye");
+                       p.Add (ep);
+
+                       ep = new ElementPoker ("hi", "bye2");
+                       p.Add (ep);
+
+                       Assert.AreEqual (1, p.AllKeys.Length, "A1");
+                       Assert.AreEqual (1, p.GetAllKeys().Length, "A2");
+               }
+
                [Test]
                public void GetElementKey()
                {
index a32c51199a6d6fc48c2c66155cc4406137973918..9739f1c61272c85a8197c533022fe44bc1b94c2a 100644 (file)
@@ -77,28 +77,21 @@ namespace MonoTests.System.Configuration {
                        Assert.AreEqual (typeof (DefaultValidator), prop.Validator.GetType(), "A7");
                        Assert.AreEqual ("", prop.DefaultValue, "A8");
                        Assert.IsTrue   (prop.IsKey, "A9");
-                       Assert.IsFalse  (prop.IsRequired, "A9");
+                       Assert.IsTrue   (prop.IsRequired, "A10");
 
-#if notyet
-                       // 2.0 RC property
-                       Assert.IsFalse  (prop.IsDefaultCollection, "A10");
-#endif
+                       Assert.IsFalse  (prop.IsDefaultCollection, "A11");
 
                        prop = props["value"];
-                       Assert.AreEqual ("value", prop.Name, "A11");
-                       Assert.IsNull   (prop.Description, "A12");
-                       Assert.AreEqual (typeof (string), prop.Type, "A13");
-                       Assert.AreEqual (typeof (StringConverter), prop.Converter.GetType(), "A14");
-                       Assert.AreEqual (typeof (DefaultValidator), prop.Validator.GetType(), "A15");
-                       Assert.AreEqual ("", prop.DefaultValue, "A16");
-                       Assert.IsFalse  (prop.IsKey, "A17");
-                       Assert.IsFalse  (prop.IsRequired, "A18");
-
-#if notyet
-                       // 2.0 RC property
-                       Assert.IsFalse  (prop.IsDefaultCollection, "A19");
-#endif
-
+                       Assert.AreEqual ("value", prop.Name, "A12");
+                       Assert.IsNull   (prop.Description, "A13");
+                       Assert.AreEqual (typeof (string), prop.Type, "A14");
+                       Assert.AreEqual (typeof (StringConverter), prop.Converter.GetType(), "A15");
+                       Assert.AreEqual (typeof (DefaultValidator), prop.Validator.GetType(), "A16");
+                       Assert.AreEqual ("", prop.DefaultValue, "A17");
+                       Assert.IsFalse  (prop.IsKey, "A18");
+                       Assert.IsFalse  (prop.IsRequired, "A19");
+
+                       Assert.IsFalse  (prop.IsDefaultCollection, "A20");
                }
        }