context: //
  // OracleParameterCollectionTest.cs -
  //      NUnit Test Cases for OracleParameterCollection
  //
  // Author:
  //      Amit Biswas  <amit@amitbiswas.com>
  //
  // Copyright (C) 2007 Novell (http://www.novell.com)
  //
  // 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.Data;
  using System.Data.OracleClient;
  using System.Globalization;
  using System.Threading;
  
  using NUnit.Framework;
  
  namespace MonoTests.System.Data.OracleClient
  {
  	[TestFixture]
  	public class OracleParameterCollectionTest
  	{
  		OracleParameterCollection o;
  		CultureInfo oldCulture;
  
  		[SetUp]
  		public void SetUp ()
  		{
  			oldCulture = CultureInfo.CurrentCulture;
  			Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR");
  			o = new OracleParameterCollection ();
  		}
  
  		[TearDown]
  		public void TearDown ()
  		{
  			Thread.CurrentThread.CurrentCulture = oldCulture;
  		}
  
  		[Test]
  		public void Clear ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  
  			o.Clear ();
  			o.Add (paramA);
  			o.Add (paramB);
  			o.Clear ();
  
  			Assert.AreEqual (0, o.Count, "#1");
  			Assert.AreEqual (-1, o.IndexOf (paramA), "#2");
  			Assert.AreEqual (-1, o.IndexOf (paramB), "#3");
  
  			o.Add (paramA);
  		}
  
  		[Test]
  		public void Count ()
  		{
  			Assert.AreEqual (0, o.Count, "#1");
  			o.Add (new OracleParameter ());
  			Assert.AreEqual (1, o.Count, "#2");
  			o.Add (new OracleParameter ());
  			Assert.AreEqual (2, o.Count, "#3");
  			o.RemoveAt (0);
  			Assert.AreEqual (1, o.Count, "#4");
  			o.RemoveAt (0);
  			Assert.AreEqual (0, o.Count, "#6");
  		}
  
  		[Test]
  		public void IsFixedSize ()
  		{
  			Assert.IsFalse (o.IsFixedSize);
  		}
  
  		[Test]
  		public void IsReadOnly ()
  		{
  			Assert.IsFalse (o.IsReadOnly);
  		}
  
  		[Test]
  		public void IsSynchronized ()
  		{
  			Assert.IsFalse (o.IsSynchronized);
  		}
  
  		[Test] // Add (Object)
  		public void Add1_Value_InvalidType ()
  		{
  			try {
  				o.Add ((object) "ParamI");
  				Assert.Fail ("#A1");
  			} catch (InvalidCastException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects, not
  				// String objects
  				Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  #if NET_2_0
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (string).Name) != -1, "#A6");
  #endif
  				Assert.IsFalse (ex.Message.IndexOf (typeof (int).Name) != -1, "#A7");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A8");
  			}
  
  			try {
  				o.Add ((object) 5);
  				Assert.Fail ("#B1");
  			} catch (InvalidCastException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects, not
  				// String objects
  				Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  #if NET_2_0
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
  				Assert.IsFalse (ex.Message.IndexOf (typeof (string).Name) != -1, "#B6");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (int).Name) != -1, "#B7");
  #endif
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
  			}
  		}
  
  		[Test] // Add (Object)
  		public void Add1_Value_Null ()
  		{
  			try {
  				o.Add ((object) null);
  				Assert.Fail ("#1");
  			} catch (ArgumentNullException ex) {
  #if NET_2_0
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#6");
  				Assert.AreEqual ("value", ex.ParamName, "#7");
  #else
  				// Value cannot be null
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#5");
  				Assert.IsFalse (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#6");
  				Assert.AreEqual ("value", ex.ParamName, "#7");
  #endif
  			}
  		}
  
  		[Test] // Add (Object)
  		public void Add1_Value_Owned ()
  		{
  			OracleParameter param = new OracleParameter ("ParamI", 1);
  
  			o.Add ((object) param);
  
  			// attempt to add same OracleParameter to collection twice
  			try {
  				o.Add ((object) param);
  				Assert.Fail ("#A1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.IsNull (ex.ParamName, "#A7");
  			}
  
  			OracleParameterCollection o2 = new OracleParameterCollection ();
  
  			// attempt to add OracleParameter to another collection
  			try {
  				o2.Add ((object) param);
  				Assert.Fail ("#B1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B6");
  				Assert.IsNull (ex.ParamName, "#B7");
  			}
  
  			o.Remove ((object) param);
  			o.Add ((object) param);
  			o.Remove ((object) param);
  			o2.Add ((object) param);
  		}
  
  		[Test] // Add (OracleParameter)
  		public void Add2_Value_Null ()
  		{
  			try {
  				o.Add ((OracleParameter) null);
  				Assert.Fail ("#1");
  #if NET_2_0
  			} catch (ArgumentNullException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#6");
  				Assert.AreEqual ("value", ex.ParamName, "#7");
  			}
  #else
  			} catch (NullReferenceException ex) {
  				Assert.AreEqual (typeof (NullReferenceException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  			}
  #endif
  		}
  
  		[Test] // Add (OracleParameter)
  		public void Add2_Value_Owned ()
  		{
  			OracleParameter param = new OracleParameter ("ParamI", 1);
  
  			o.Add (param);
  
  			// attempt to add same OracleParameter to collection twice
  			try {
  				o.Add (param);
  				Assert.Fail ("#A1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.IsNull (ex.ParamName, "#A7");
  			}
  
  			OracleParameterCollection o2 = new OracleParameterCollection ();
  
  			// attempt to add OracleParameter to another collection
  			try {
  				o2.Add (param);
  				Assert.Fail ("#B1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B6");
  				Assert.IsNull (ex.ParamName, "#B7");
  			}
  
  			o.Remove (param);
  			o.Add (param);
  			o.Remove (param);
  			o2.Add (param);
  		}
  
  #if NET_2_0
  		[Test] // AddRange (Array)
  		public void AddRange1 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  			OracleParameter paramD = new OracleParameter ("parami", 4);
  
  			o.Add (paramA);
  			o.AddRange (new object [] { paramB, paramC, paramD });
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#1");
  			Assert.AreEqual (1, o.IndexOf (paramB), "#2");
  			Assert.AreEqual (2, o.IndexOf (paramC), "#3");
  			Assert.AreEqual (3, o.IndexOf (paramD), "#4");
  		}
  
  		[Test] // AddRange (Array)
  		public void AddRange1_Item_InvalidType ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  
  			o.Add (paramA);
  
  			object [] values = new object [] { paramB, "ParamX", paramC };
  			try {
  				o.AddRange (values);
  				Assert.Fail ("#A1");
  			} catch (InvalidCastException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects, not
  				// String objects
  				Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (string).Name) != -1, "#A6");
  				Assert.IsFalse (ex.Message.IndexOf (typeof (int).Name) != -1, "#A7");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A8");
  			}
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#B1");
  			Assert.AreEqual (-1, o.IndexOf (paramB), "#B2");
  			Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
  		}
  
  		[Test] // AddRange (Array)
  		public void AddRange1_Item_Null ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  
  			o.Add (paramA);
  
  			object [] values = new object [] { paramB, null, paramC };
  			try {
  				o.AddRange (values);
  				Assert.Fail ("#A1");
  			} catch (ArgumentNullException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.AreEqual ("value", ex.ParamName, "#A7");
  			}
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#B1");
  			Assert.AreEqual (-1, o.IndexOf (paramB), "#B2");
  			Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
  		}
  
  		[Test] // AddRange (Array)
  		public void AddRange1_Item_Owned ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  
  			o.Add (paramA);
  
  			object [] values = new object [] { paramB, paramA, paramC };
  			try {
  				o.AddRange (values);
  				Assert.Fail ("#A1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.IsNull (ex.ParamName, "#A7");
  			}
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#B1");
  			Assert.AreEqual (1, o.IndexOf (paramB), "#B2");
  			Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
  		}
  
  		[Test] // AddRange (Array)
  		public void AddRange1_Values_Null ()
  		{
  			try {
  				o.AddRange ((Array) null);
  				Assert.Fail ("#1");
  			} catch (ArgumentNullException ex) {
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.AreEqual ("values", ex.ParamName, "#5");
  			}
  		}
  
  		[Test] // AddRange (OracleParameter [])
  		public void AddRange2 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  			OracleParameter paramD = new OracleParameter ("parami", 4);
  
  			o.Add (paramA);
  
  			OracleParameter [] values = new OracleParameter [] {
  				paramB, paramC, paramD };
  			o.AddRange (values);
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#1");
  			Assert.AreEqual (1, o.IndexOf (paramB), "#2");
  			Assert.AreEqual (2, o.IndexOf (paramC), "#3");
  			Assert.AreEqual (3, o.IndexOf (paramD), "#4");
  		}
  
  		[Test] // AddRange (OracleParameter [])
  		public void AddRange2_Item_Null ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  
  			o.Add (paramA);
  
  			OracleParameter [] values = new OracleParameter [] {
  				paramB, null, paramC };
  			try {
  				o.AddRange (values);
  				Assert.Fail ("#A1");
  			} catch (ArgumentNullException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.AreEqual ("value", ex.ParamName, "#A7");
  			}
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#B1");
  			Assert.AreEqual (-1, o.IndexOf (paramB), "#B2");
  			Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
  		}
  
  		[Test] // AddRange (OracleParameter [])
  		public void AddRange2_Item_Owned ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  
  			o.Add (paramA);
  
  			OracleParameter [] values = new OracleParameter [] {
  				paramB, paramA, paramC };
  			try {
  				o.AddRange (values);
  				Assert.Fail ("#A1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.IsNull (ex.ParamName, "#A7");
  			}
  
  			Assert.AreEqual (0, o.IndexOf (paramA), "#B1");
  			Assert.AreEqual (1, o.IndexOf (paramB), "#B2");
  			Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
  		}
  
  		[Test] // AddRange (OracleParameter [])
  		public void AddRange2_Values_Null ()
  		{
  			try {
  				o.AddRange ((OracleParameter []) null);
  				Assert.Fail ("#1");
  			} catch (ArgumentNullException ex) {
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.AreEqual ("values", ex.ParamName, "#5");
  			}
  		}
  #endif
  
  		[Test] // Contains (Object)
  		public void Contains1 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  			OracleParameter paramD = new OracleParameter ("parami", 4);
  
  			o.Add (paramA);
  			o.Add (paramB);
  
  			Assert.IsTrue (o.Contains ((object) paramA), "#A1");
  			Assert.IsTrue (o.Contains ((object) paramB), "#A2");
  			Assert.IsFalse (o.Contains ((object) paramC), "#A3");
  			Assert.IsFalse (o.Contains ((object) paramD), "#A4");
  			Assert.IsFalse (o.Contains ((object) null), "#A5");
  
  			o.Add (paramC);
  
  			Assert.IsTrue (o.Contains ((object) paramA), "#B1");
  			Assert.IsTrue (o.Contains ((object) paramB), "#B2");
  			Assert.IsTrue (o.Contains ((object) paramC), "#B3");
  			Assert.IsFalse (o.Contains ((object) paramD), "#B4");
  			Assert.IsFalse (o.Contains ((object) null), "#B5");
  
  			o.Remove (paramA);
  
  			Assert.IsFalse (o.Contains ((object) paramA), "#C1");
  			Assert.IsTrue (o.Contains ((object) paramB), "#C2");
  			Assert.IsTrue (o.Contains ((object) paramC), "#C3");
  			Assert.IsFalse (o.Contains ((object) paramD), "#C4");
  			Assert.IsFalse (o.Contains ((object) null), "#C5");
  		}
  
  		[Test] // Contains (Object)
  		public void Contains1_Value_InvalidType ()
  		{
  			try {
  				o.Contains ((object) "ParamI");
  				Assert.Fail ("#A1");
  			} catch (InvalidCastException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects, not
  				// String objects
  				Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  #if NET_2_0
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (string).Name) != -1, "#A6");
  				Assert.IsFalse (ex.Message.IndexOf (typeof (int).Name) != -1, "#A7");
  #endif
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A8");
  			}
  
  			try {
  				o.Contains ((object) 5);
  				Assert.Fail ("#B1");
  			} catch (InvalidCastException ex) {
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects, not
  				// Int32 objects
  				Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  #if NET_2_0
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
  				Assert.IsFalse (ex.Message.IndexOf (typeof (string).Name) != -1, "#B6");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (int).Name) != -1, "#B7");
  #endif
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
  			}
  		}
  
  		[Test] // Contains (OracleParameter)
  		public void Contains2 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  			OracleParameter paramD = new OracleParameter ("parami", 4);
  
  			o.Add (paramA);
  			o.Add (paramB);
  
  			Assert.IsTrue (o.Contains (paramA), "#A1");
  			Assert.IsTrue (o.Contains (paramB), "#A2");
  			Assert.IsFalse (o.Contains (paramC), "#A3");
  			Assert.IsFalse (o.Contains (paramD), "#A4");
  			Assert.IsFalse (o.Contains ((OracleParameter) null), "#A5");
  
  			o.Add (paramC);
  
  			Assert.IsTrue (o.Contains (paramA), "#B1");
  			Assert.IsTrue (o.Contains (paramB), "#B2");
  			Assert.IsTrue (o.Contains (paramC), "#B3");
  			Assert.IsFalse (o.Contains (paramD), "#B4");
  			Assert.IsFalse (o.Contains ((OracleParameter) null), "#B5");
  
  			o.Remove (paramA);
  
  			Assert.IsFalse (o.Contains (paramA), "#C1");
  			Assert.IsTrue (o.Contains (paramB), "#C2");
  			Assert.IsTrue (o.Contains (paramC), "#C3");
  			Assert.IsFalse (o.Contains (paramD), "#C4");
  			Assert.IsFalse (o.Contains ((OracleParameter) null), "#C5");
  		}
  
  		[Test] // Contains (String)
  		public void Contains3 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  			OracleParameter paramD = new OracleParameter ("parami", 4);
  
  			o.Add (paramA);
  			o.Add (paramB);
  
  			Assert.IsTrue (o.Contains ("ParamI"), "#A1");
  			Assert.IsTrue (o.Contains ("Parami"), "#A2");
  			Assert.IsTrue (o.Contains ("paramI"), "#A3");
  			Assert.IsTrue (o.Contains ("parami"), "#A4");
  			Assert.IsFalse (o.Contains ("NotFound"), "#A5");
  			Assert.IsFalse (o.Contains ((OracleParameter) null), "#A6");
  
  			o.Remove (paramA);
  
  			Assert.IsFalse (o.Contains ("ParamI"), "#B1");
  			Assert.IsTrue (o.Contains ("Parami"), "#B2");
  			Assert.IsFalse (o.Contains ("paramI"), "#B3");
  			Assert.IsTrue (o.Contains ("parami"), "#B4");
  			Assert.IsFalse (o.Contains ("NotFound"), "#B5");
  			Assert.IsFalse (o.Contains ((OracleParameter) null), "#B6");
  		}
  
  		[Test] // OracleParameter this [Int32]
  		public void Indexer1 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("paramI", 2);
  			OracleParameter paramC = new OracleParameter ("Parami", 3);
  
  			o.Add (paramA);
  			o.Add (paramB);
  
  			Assert.AreSame (paramA, o [0], "#A1");
  			Assert.AreSame (paramB, o [1], "#A2");
  			o [0] = paramA;
  			Assert.AreSame (paramA, o [0], "#B1");
  			Assert.AreSame (paramB, o [1], "#B2");
  			o [0] = paramC;
  			Assert.AreSame (paramC, o [0], "#C1");
  			Assert.AreSame (paramB, o [1], "#C2");
  			o [1] = paramA;
  			Assert.AreSame (paramC, o [0], "#D1");
  			Assert.AreSame (paramA, o [1], "#D2");
  
  			OracleParameterCollection o2 = new OracleParameterCollection ();
  			o2.Add (paramB);
  		}
  
  		[Test] // OracleParameter this [Int32]
  		public void Indexer1_Index_Invalid ()
  		{
  			o.Add (new OracleParameter ());
  
  			try {
  				o [1] = new OracleParameter ();
  				Assert.Fail ("#A1");
  			} catch (IndexOutOfRangeException ex) {
  #if NET_2_0
  				// Invalid index 1 for this OracleParameterCollection
  				// with Count=1
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  #else
  				// Index 1 outside the scope of the parameter array
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  #endif
  			}
  
  			try {
  				o [-1] = new OracleParameter ();
  				Assert.Fail ("#B1");
  			} catch (IndexOutOfRangeException ex) {
  #if NET_2_0
  				// Invalid index -1 for this OracleParameterCollection
  				// with Count=1
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
  #else
  				// Index -1 outside the scope of the parameter array
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  #endif
  			}
  
  			try {
  				object value = o [1];
  				Assert.Fail ("#C1:" + value);
  			} catch (IndexOutOfRangeException ex) {
  #if NET_2_0
  				// Invalid index 1 for this OracleParameterCollection
  				// with Count=1
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#C2");
  				Assert.IsNull (ex.InnerException, "#C3");
  				Assert.IsNotNull (ex.Message, "#C4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#C5");
  #else
  				// Index 1 outside the scope of the parameter array
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#C2");
  				Assert.IsNull (ex.InnerException, "#C3");
  				Assert.IsNotNull (ex.Message, "#C4");
  #endif
  			}
  
  			try {
  				object value = o [-1];
  				Assert.Fail ("#D1");
  			} catch (IndexOutOfRangeException ex) {
  #if NET_2_0
  				// Invalid index -1 for this OracleParameterCollection
  				// with Count=1
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#D2");
  				Assert.IsNull (ex.InnerException, "#D3");
  				Assert.IsNotNull (ex.Message, "#D4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#D5");
  #else
  				// Index -1 outside the scope of the parameter array
  				Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#D2");
  				Assert.IsNull (ex.InnerException, "#D3");
  				Assert.IsNotNull (ex.Message, "#D4");
  #endif
  			}
  		}
  
  		[Test] // OracleParameter this [Int32]
  		public void Indexer1_Value_Null ()
  		{
  			OracleParameter param = new OracleParameter ("ParamI", 1);
  			o.Add (param);
  
  			try {
  				o [0] = null;
  				Assert.Fail ("#1");
  			} catch (ArgumentNullException ex) {
  #if NET_2_0
  				// The OracleParameterCollection only accepts
  				// non-null OracleParameter type objects
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#6");
  				Assert.AreEqual ("value", ex.ParamName, "#7");
  #else
  				// Value cannot be null
  				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
  				Assert.IsNull (ex.InnerException, "#3");
  				Assert.IsNotNull (ex.Message, "#4");
  				Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#5");
  				Assert.IsFalse (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#6");
  				Assert.AreEqual ("value", ex.ParamName, "#7");
  #endif
  			}
  		}
  
  		[Test] // OracleParameter this [Int32]
  		public void Indexer1_Value_Owned ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("paramI", 2);
  			OracleParameter paramC = new OracleParameter ("Parami", 3);
  
  			o.Add (paramA);
  			o.Add (paramB);
  
  			// attempt to add same OracleParameter to collection twice
  			try {
  				o [1] = paramA;
  				Assert.Fail ("#A1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");
  				Assert.IsNull (ex.InnerException, "#A3");
  				Assert.IsNotNull (ex.Message, "#A4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A6");
  				Assert.IsNull (ex.ParamName, "#A7");
  			}
  
  			OracleParameterCollection o2 = new OracleParameterCollection ();
  			o2.Add (paramC);
  
  			// attempt to add OracleParameter to another collection
  			try {
  				o2 [0] = paramA;
  				Assert.Fail ("#B1");
  			} catch (ArgumentException ex) {
  				// The OracleParameter is already contained by
  				// another OracleParameterCollection
  				Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
  				Assert.IsNull (ex.InnerException, "#B3");
  				Assert.IsNotNull (ex.Message, "#B4");
  				Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
  				Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B6");
  				Assert.IsNull (ex.ParamName, "#B7");
  			}
  
  			o.Remove (paramA);
  			o [0] = paramA;
  			o.Remove (paramA);
  			o2 [0] = paramA;
  		}
  
  		[Test] // OracleParameter this [String]
  		public void Indexer2 ()
  		{
  			OracleParameter paramA = new OracleParameter ("ParamI", 1);
  			OracleParameter paramB = new OracleParameter ("Parami", 2);
  			OracleParameter paramC = new OracleParameter ("paramI", 3);
  			OracleParameter paramD = new OracleParameter ("parami", 4);
  			OracleParameter paramE = new OracleParameter ("ParamI", 5);
  			OracleParameter paramF = new OracleParameter ("Parami", 6);
  			OracleParameter paramG = new OracleParameter ("ParamG", 7);
  			OracleParameter paramH = new OracleParameter ("ParamH", 8);
  
  			o.Add (paramA);
  			o.Add (paramB);
  			o.Add (paramC);
  			o.Add (paramD);
  			o.Add (paramE);
  			o.Add (paramF);
  
  			Assert.AreSame (paramA, o ["ParamI"], "#A1");
  			Assert.AreSame (paramB, o ["Parami"], "#A2");
  #if NET_2_0
  			Assert.AreSame (paramC, o ["paramI"], "#A3");
  			Assert.AreSame (paramD, o ["parami"], "#A4");
  #else
  			Assert.AreSame (paramA, o ["paramI"], "#A3");
  			Assert.AreSame (paramB, o ["parami"], "#A4");
  #endif
  			Assert.AreEqual (0, o.IndexOf (paramA), "#A5");
  			Assert.AreEqual (1, o.IndexOf (paramB), "#A6");
  			Assert.AreEqual (2, o.IndexOf (paramC), "#A7");
  			Assert.AreEqual (3, o.IndexOf (paramD), "#A8");
  			Assert.AreEqual (4, o.IndexOf (paramE), "#A9");
  			Assert.AreEqual (5, o.IndexOf (paramF), "#A10");
  			Assert.AreEqual (-1, o.IndexOf (paramG), "#A11");
  			Assert.AreEqual (-1, o.IndexOf (paramH), "#A12");
  
  
gt: 			o ["ParamI"] = paramG;