Author: gert
Date: 2007-08-31 10:15:07 -0400 (Fri, 31 Aug 2007)
New Revision: 85126
Added:
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ChangeLog
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ProviderBaseTest.cs
Modified:
trunk/mcs/class/System.Configuration/ChangeLog
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ChangeLog
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ProviderBase.cs
trunk/mcs/class/System.Configuration/System.Configuration_test.dll.sources
trunk/mcs/class/System.Configuration/Test/System.Configuration/CallbackValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
trunk/mcs/class/System.Configuration/Test/System.Configuration/CommaDelimitedStringCollectionConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/CommaDelimitedStringCollectionTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationElementCollectionTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationElementTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationLockCollectionTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationPermissionTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationPropertyTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationSectionGroupTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConnectionStringSettingsTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/DefaultValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/ExeConfigurationFileMapTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/GenericEnumConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/InfiniteIntConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/InfiniteTimeSpanConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/IntegerValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationCollectionTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationElementTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/LongValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/PositiveTimeSpanValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/RegexStringValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/StringValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/SubclassTypeValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanMinutesConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanMinutesOrInfiniteConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanSecondsConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanSecondsOrInfiniteConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanValidatorTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/TypeNameConverterTest.cs
trunk/mcs/class/System.Configuration/Test/System.Configuration/WhiteSpaceTrimStringConverterTest.cs
Log:
* System.Configuration_test.dll.sources: added ProviderBaseTest.cs.
* ProviderBaseTest.cs: Added tests for Initialize.
* ProviderBase.cs: Remove "description" key from NameValueCollection.
Use provider name as description if description is null or a zero
length string. Modifies exception messages to match MS.
* GenericEnumConverterTest.cs: Remove unused variable.
* ConfigurationManagerTest.cs: Fixed line endings.
* ConnectionStringSettingsTest.cs: Fixed line endings and avoid
ToString override warning.
* KeyValueConfigurationElementTest.cs: Fixed line endings.
* KeyValueConfigurationCollectionTest.cs: Fixed line endings.
Modified: trunk/mcs/class/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System.Configuration/ChangeLog 2007-08-31 14:12:15 UTC
(rev 85125)
+++ trunk/mcs/class/System.Configuration/ChangeLog 2007-08-31 14:15:07 UTC
(rev 85126)
@@ -1,3 +1,7 @@
+2007-08-31 Gert Driesen <[EMAIL PROTECTED]>
+
+ * System.Configuration_test.dll.sources: added ProviderBaseTest.cs.
+
2007-06-13 Atsushi Enomoto <[EMAIL PROTECTED]>
* System.Configuration_test.dll.sources :
Modified:
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ChangeLog
===================================================================
---
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ChangeLog
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ChangeLog
2007-08-31 14:15:07 UTC (rev 85126)
@@ -1,3 +1,9 @@
+2007-08-31 Gert Driesen <[EMAIL PROTECTED]>
+
+ * ProviderBase.cs: Remove "description" key from NameValueCollection.
+ Use provider name as description if description is null or a zero
+ length string. Modifies exception messages to match MS.
+
2006-12-02 Marek Habersack <[EMAIL PROTECTED]>
* ProviderBase.cs: Throw exceptions as per documentation.
Modified:
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ProviderBase.cs
===================================================================
---
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ProviderBase.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/System.Configuration.Provider/ProviderBase.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -47,16 +47,18 @@
if (name == null)
throw new ArgumentNullException ("name");
if (name.Length == 0)
- throw new ArgumentException ("name must not be
empty");
+ throw new ArgumentException ("Provider name
cannot be null or empty.", "name");
if (alreadyInitialized)
- throw new InvalidOperationException ("Provider
has already been initialized");
+ throw new InvalidOperationException ("This
provider instance has already been initialized.");
alreadyInitialized = true;
_name = name;
- if (config != null)
- _description = config["description"];
- if (_description == null)
+ if (config != null) {
+ _description = config ["description"];
+ config.Remove ("description");
+ }
+ if (_description == null || _description.Length == 0)
_description = _name;
}
Modified:
trunk/mcs/class/System.Configuration/System.Configuration_test.dll.sources
===================================================================
--- trunk/mcs/class/System.Configuration/System.Configuration_test.dll.sources
2007-08-31 14:12:15 UTC (rev 85125)
+++ trunk/mcs/class/System.Configuration/System.Configuration_test.dll.sources
2007-08-31 14:15:07 UTC (rev 85126)
@@ -28,3 +28,4 @@
System.Configuration/TimeSpanValidatorTest.cs
System.Configuration/TypeNameConverterTest.cs
System.Configuration/WhiteSpaceTrimStringConverterTest.cs
+System.Configuration.Provider/ProviderBaseTest.cs
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/CallbackValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
===================================================================
--- trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
2007-08-31 14:12:15 UTC (rev 85125)
+++ trunk/mcs/class/System.Configuration/Test/System.Configuration/ChangeLog
2007-08-31 14:15:07 UTC (rev 85126)
@@ -1,3 +1,12 @@
+2007-08-31 Gert Driesen <[EMAIL PROTECTED]>
+
+ * GenericEnumConverterTest.cs: Remove unused variable.
+ * ConfigurationManagerTest.cs: Fixed line endings.
+ * ConnectionStringSettingsTest.cs: Fixed line endings and avoid
+ ToString override warning.
+ * KeyValueConfigurationElementTest.cs: Fixed line endings.
+ * KeyValueConfigurationCollectionTest.cs: Fixed line endings.
+
2007-06-20 Atsushi Enomoto <[EMAIL PROTECTED]>
* ConfigurationManagerTest.cs : Enabled some tests with related to
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/CommaDelimitedStringCollectionConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/CommaDelimitedStringCollectionTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationElementCollectionTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationElementTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationLockCollectionTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -69,7 +69,7 @@
Assert.AreEqual ("user.config", fi.Name);
}
- [Test]
+ [Test]
[Category ("NotWorking")]
public void UserLevelPerRoamingAndLocal ()
{
@@ -131,7 +131,7 @@
}
- [Test]
+ [Test]
public void mapped_UserLevelPerRoaming ()
{
ExeConfigurationFileMap map = new
ExeConfigurationFileMap ();
@@ -156,7 +156,7 @@
ConfigurationManager.OpenMappedExeConfiguration (map,
ConfigurationUserLevel.PerUserRoaming);
}
- [Test]
+ [Test]
public void mapped_UserLevelPerRoamingAndLocal ()
{
ExeConfigurationFileMap map = new
ExeConfigurationFileMap ();
@@ -184,7 +184,7 @@
}
[Test]
- [ExpectedException (typeof (ArgumentException))]
+ [ExpectedException (typeof (ArgumentException))]
[Category ("NotWorking")]
public void mapped_UserLevelPerRoamingAndLocal_no_roaminguser ()
{
@@ -230,7 +230,7 @@
#endif
}
- [Test]
+ [Test]
[Category ("NotWorking")]
public void mapped_ExeConfiguration_null ()
{
@@ -245,7 +245,7 @@
#endif
}
- [Test]
+ [Test]
[Category ("NotWorking")]
public void mapped_MachineConfig_null ()
{
@@ -262,7 +262,7 @@
Assert.IsTrue (ConfigurationManager.GetSection
("appSettings") is NameValueCollection);
}
- [Test] // test for bug #78372.
+ [Test] // test for bug #78372.
public void OpenMachineConfiguration ()
{
SysConfig cfg =
ConfigurationManager.OpenMachineConfiguration ();
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationManagerTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationPermissionTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationPropertyTest.cs
___________________________________________________________________
Name: svn:eol-style
+ CRLF
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConfigurationSectionGroupTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConnectionStringSettingsTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConnectionStringSettingsTest.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConnectionStringSettingsTest.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -33,7 +33,8 @@
using System.Configuration;
using NUnit.Framework;
-namespace MonoTests.System.Configuration {
+namespace MonoTests.System.Configuration
+{
[TestFixture]
public class ConnectionStringSettingsTest
{
@@ -71,7 +72,7 @@
}
[Test]
- [ExpectedException (typeof(ConfigurationErrorsException))]
+ [ExpectedException (typeof(ConfigurationErrorsException))]
[Category ("NotWorking")]
public void Validators_Name1 ()
{
@@ -115,12 +116,10 @@
}
[Test]
- public void ToString ()
+ public void ToStringTest ()
{
- ConnectionStringSettings s;
-
- s = new ConnectionStringSettings ("name",
"connectionString", "provider");
-
+ ConnectionStringSettings s = new
ConnectionStringSettings (
+ "name", "connectionString", "provider");
Assert.AreEqual ("connectionString", s.ToString(),
"A1");
}
}
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ConnectionStringSettingsTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/DefaultValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/ExeConfigurationFileMapTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/GenericEnumConverterTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration/GenericEnumConverterTest.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration/GenericEnumConverterTest.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -119,7 +119,6 @@
public void ConvertTo ()
{
GenericEnumConverter cv = new GenericEnumConverter
(typeof (FooEnum));
- TimeSpan ts;
Assert.AreEqual ("Foo", cv.ConvertTo (null, null,
FooEnum.Foo, typeof (string)), "A1");
Assert.AreEqual ("Bar", cv.ConvertTo (null, null,
FooEnum.Bar, typeof (string)), "A2");
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/GenericEnumConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/InfiniteIntConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/InfiniteTimeSpanConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/IntegerValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationCollectionTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationCollectionTest.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationCollectionTest.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -166,7 +166,7 @@
Assert.AreEqual ("foo", p.DoGetElementKey (ep), "A1");
}
- [Test]
+ [Test]
[Category ("NotWorking")]
public void GetElementKey_withoutAdd()
{
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationCollectionTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Modified:
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationElementTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationElementTest.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationElementTest.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -57,7 +57,7 @@
}
- [Test]
+ [Test]
[NUnit.Framework.Category ("NotWorking")]
public void Properties ()
{
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/KeyValueConfigurationElementTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/LongValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/PositiveTimeSpanValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/RegexStringValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/StringValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/SubclassTypeValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanMinutesConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanMinutesOrInfiniteConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanSecondsConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanSecondsOrInfiniteConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/TimeSpanValidatorTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/TypeNameConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration/WhiteSpaceTrimStringConverterTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ChangeLog
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ChangeLog
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ChangeLog
2007-08-31 14:15:07 UTC (rev 85126)
@@ -0,0 +1,3 @@
+2007-08-31 Gert Driesen <[EMAIL PROTECTED]>
+
+ * ProviderBaseTest.cs: Added tests for Initialize.
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ChangeLog
___________________________________________________________________
Name: svn:eol-style
+ native
Added:
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ProviderBaseTest.cs
===================================================================
---
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ProviderBaseTest.cs
2007-08-31 14:12:15 UTC (rev 85125)
+++
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ProviderBaseTest.cs
2007-08-31 14:15:07 UTC (rev 85126)
@@ -0,0 +1,171 @@
+//
+// System.Configuration.Provider.ProviderBaseTest.cs - Unit tests
+// for System.Configuration.Provider.ProviderBase.
+//
+// Author:
+// Gert Driesen <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2007 Gert Driesen
+//
+// 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.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Configuration.Provider;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Configuration.Provider
+{
+ [TestFixture]
+ public class ProviderBaseTest
+ {
+ [Test]
+ public void Initialize ()
+ {
+ MockProvider provider = new MockProvider ();
+ provider.Initialize ("Mono", (NameValueCollection)
null);
+ Assert.IsNotNull (provider.Description, "#A1");
+ Assert.AreEqual ("Mono", provider.Description, "#A2");
+ Assert.IsNotNull (provider.Name, "#A3");
+ Assert.AreEqual ("Mono", provider.Name, "#A4");
+
+ provider = new MockProvider ();
+ provider.Initialize (" ", (NameValueCollection) null);
+ Assert.IsNotNull (provider.Description, "#B1");
+ Assert.AreEqual (" ", provider.Description, "#B2");
+ Assert.IsNotNull (provider.Name, "#B3");
+ Assert.AreEqual (" ", provider.Name, "#B4");
+
+ NameValueCollection config = new NameValueCollection ();
+ config ["name"] = "Novell";
+ config ["description"] = "DESC";
+ config ["foo"] = "FOO";
+
+ provider = new MockProvider ();
+ provider.Initialize ("Mono", config);
+ Assert.IsNotNull (provider.Description, "#C1");
+ Assert.AreEqual ("DESC", provider.Description, "#C2");
+ Assert.IsNotNull (provider.Name, "#C3");
+ Assert.AreEqual ("Mono", provider.Name, "#C4");
+ Assert.IsTrue (ContainsKey (config, "name"), "#C5");
+ Assert.IsFalse (ContainsKey (config, "description"),
"#C6");
+ Assert.IsTrue (ContainsKey (config, "foo"), "#C7");
+
+ config = new NameValueCollection ();
+ config ["description"] = null;
+
+ provider = new MockProvider ();
+ provider.Initialize ("Mono", config);
+ Assert.IsNotNull (provider.Description, "#D1");
+ Assert.AreEqual ("Mono", provider.Description, "#D2");
+ Assert.IsNotNull (provider.Name, "#D3");
+ Assert.AreEqual ("Mono", provider.Name, "#D4");
+ Assert.IsFalse (ContainsKey (config, "description"),
"#D5");
+
+ config = new NameValueCollection ();
+ config ["description"] = string.Empty;
+
+ provider = new MockProvider ();
+ provider.Initialize ("Mono", config);
+ Assert.IsNotNull (provider.Description, "#E1");
+ Assert.AreEqual ("Mono", provider.Description, "#E2");
+ Assert.IsNotNull (provider.Name, "#E3");
+ Assert.AreEqual ("Mono", provider.Name, "#E4");
+ Assert.IsFalse (ContainsKey (config, "description"),
"#E5");
+
+ config = new NameValueCollection ();
+ config ["description"] = " ";
+
+ provider = new MockProvider ();
+ provider.Initialize ("Mono", config);
+ Assert.IsNotNull (provider.Description, "#F1");
+ Assert.AreEqual (" ", provider.Description, "#F2");
+ Assert.IsNotNull (provider.Name, "#F3");
+ Assert.AreEqual ("Mono", provider.Name, "#F4");
+ Assert.IsFalse (ContainsKey (config, "description"),
"#F5");
+ }
+
+ [Test]
+ public void Initialize_AlreadyInitialized ()
+ {
+ MockProvider provider = new MockProvider ();
+ provider.Initialize ("Mono", (NameValueCollection)
null);
+ try {
+ provider.Initialize ("Mono",
(NameValueCollection) null);
+ Assert.Fail ("#1");
+ } catch (InvalidOperationException ex) {
+ Assert.AreEqual (typeof
(InvalidOperationException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ }
+ }
+
+ [Test]
+ public void Initialize_Name_Null ()
+ {
+ MockProvider provider = new MockProvider ();
+ try {
+ provider.Initialize ((string) null, new
NameValueCollection ());
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException ex) {
+ Assert.AreEqual (typeof
(ArgumentNullException), ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("name", ex.ParamName, "#6");
+ }
+ }
+
+ [Test]
+ public void Initialize_Name_Empty ()
+ {
+ MockProvider provider = new MockProvider ();
+ try {
+ provider.Initialize (string.Empty, new
NameValueCollection ());
+ Assert.Fail ("#1");
+ } catch (ArgumentException ex) {
+ Assert.AreEqual (typeof (ArgumentException),
ex.GetType (), "#2");
+ Assert.IsNull (ex.InnerException, "#3");
+ Assert.IsNotNull (ex.Message, "#4");
+ Assert.IsNotNull (ex.ParamName, "#5");
+ Assert.AreEqual ("name", ex.ParamName, "#6");
+ }
+ }
+
+ static bool ContainsKey (NameValueCollection collection, string
searchKey)
+ {
+ foreach (string key in collection)
+ if (key == searchKey)
+ return true;
+ return false;
+ }
+
+ class MockProvider : ProviderBase
+ {
+ }
+ }
+}
+
+#endif
Property changes on:
trunk/mcs/class/System.Configuration/Test/System.Configuration.Provider/ProviderBaseTest.cs
___________________________________________________________________
Name: svn:eol-style
+ native
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches