* OracleTransaction.cs: Corcompare fixes for 2.0 profile. Implemented
authorGert Driesen <drieseng@users.sourceforge.net>
Wed, 7 May 2008 18:49:22 +0000 (18:49 -0000)
committerGert Driesen <drieseng@users.sourceforge.net>
Wed, 7 May 2008 18:49:22 +0000 (18:49 -0000)
DbConnection and Dispose override. Code formatting.
* OracleLob.cs: Implemented Dispose overloads. Code formatting.
* OracleCommand.cs: Removed extra connection_timeout field. Fixed
DesignTimeVisible. Changed CommandText to return zero-length string
when underlying value is null. Fixed CommandTimeout to always
return 0. Implemented DbConnection, DbParameterCollection and
DbTransaction properties. Corcompare fixes for 2.0 profile.
* OracleTimeSpan.cs: In OracleTimeSpan ctor, throw NRE when from
is Null timespan. Fixed Hours property to actually return hours instead
of days. Modified Value to throw InvalidOperationException when
current instance is Null. Fixed explicit operator argument name.
* OracleRowUpdatingEventArgs.cs: Added missing BaseCommand override.
* OracleParameterCollection.cs: Removed extra internal ctor.
Corcompare fixes for 2.0 profile. On 1.0 profile, perform culture
sensitive and case-insensitive lookup. On 2.0 profile, first perform
case-sensitive lookup and fallback to case-insensitive lookup.
Set and remove Container where necessary, and perform checks for
ownership. Implemented AddRange overloads, and (Get/Set)Parameter.
Added several 2.0 overloads taking OracleParameter. Fixed exceptions
to match MS.
* OracleDataReader.cs: Corcompare fixes for 2.0 profile. Moved
disposing of schematable to Close, and invoke Close from Dispose.
Reduce casts. Stubbed methods introduced in 2.0 profile.
* OracleConnection.cs: Corcompare fixes for 2.0 profile. Changed
ConnectionString to return zero-length string when underlying value is
null. Removed explicit IDisposable implementation. Use string.Empty
instead of "". Code formatting.
* OracleMonthSpan.cs: Code formatting. Changed argument name of
explicit operator to match MS.
* OracleDataAdapter.cs: Code formatting. Fixed default ctor to use
null for SelectCommand. In 2.0 profile, set UpdateBatchSize to 1 and
throw AORE when setting it to negative value. Modified *Command setters
to throw InvalidCastException instead of ArgumentException. Removed
extra TableMappings property.
* OracleParameter.cs: Use zero-length string as default for
SourceColumn. Added missing 2.0 ctor. In ParameterName return zero
length string when name is null. Added SourceColumnNullMapping
property. Corcompare fixes for 2.0 profile. Code formatting.
* OracleBFile.cs: Added Dispose override for 2.0 profile.
* OracleDataAdapterTest.cs: Added ctor and basic property tests.
* OracleParameterCollectionTest.cs: Added tests for Clear,Count,Add,
Add,AddRange,Contains,indexers,IndexOf,Insert,Remove and RemoveAt.
* OracleCommandTest.cs: Added tests for ctors and CommandText,
CommandTimeout, ConnectionTimeout and Connection.
* OracleConnectionTest.cs: Added tests for ConnectionString and
ConnectionTimeout.
* OracleParameterTest.cs: Allow for disconnected tests. Added basic
ctor tests and test for ParameterName.
* OracleTimeSpanTest.cs: Added ctor tests. Added tests for IsNull,
MaxValue, MinValue, Null and ToString.
 * System.Data.OracleClient_test.dll.sources: Added
OracleConnectionTest.cs, OracleDataAdapterTest.cs and
OracleTimeSpanTest.cs.

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

22 files changed:
mcs/class/System.Data.OracleClient/ChangeLog
mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleBFile.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleCommand.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleConnection.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataAdapter.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleDataReader.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleLob.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleMonthSpan.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameterCollection.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleRowUpdatingEventArgs.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTimeSpan.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleTransaction.cs
mcs/class/System.Data.OracleClient/System.Data.OracleClient_test.dll.sources
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/ChangeLog
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleCommandTest.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleConnectionTest.cs [new file with mode: 0644]
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleDataAdapterTest.cs [new file with mode: 0644]
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleParameterCollectionTest.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleParameterTest.cs
mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleTimeSpanTest.cs [new file with mode: 0644]

index 387852234bf6eb70ea60daa5b201bad60cdd7768..59c59d8342b1e7b4e09e2a365cf5a3ee9fbb521a 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-02  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * System.Data.OracleClient_test.dll.sources: Added
+       OracleConnectionTest.cs, OracleDataAdapterTest.cs and
+       OracleTimeSpanTest.cs.
+
 2007-06-06  Nagappan A  <anagappan@novell.com>
 
        * System.Data.OracleClient_test.dll.sources: Added
index 7dfaf533131e8996dc4dfb9ccd5f2632e4dca656..5d47262a7699e3b348594eb45998a7602a805ac9 100644 (file)
@@ -1,6 +1,51 @@
+2008-05-07  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * OracleTransaction.cs: Corcompare fixes for 2.0 profile. Implemented
+       DbConnection and Dispose override. Code formatting.
+       * OracleLob.cs: Implemented Dispose overloads. Code formatting.
+       * OracleCommand.cs: Removed extra connection_timeout field. Fixed
+       DesignTimeVisible. Changed CommandText to return zero-length string
+       when underlying value is null. Fixed CommandTimeout to always
+       return 0. Implemented DbConnection, DbParameterCollection and
+       DbTransaction properties. Corcompare fixes for 2.0 profile.
+       * OracleTimeSpan.cs: In OracleTimeSpan ctor, throw NRE when from
+       is Null timespan. Fixed Hours property to actually return hours instead
+       of days. Modified Value to throw InvalidOperationException when
+       current instance is Null. Fixed explicit operator argument name.
+       * OracleRowUpdatingEventArgs.cs: Added missing BaseCommand override.
+       * OracleParameterCollection.cs: Removed extra internal ctor.
+       Corcompare fixes for 2.0 profile. On 1.0 profile, perform culture
+       sensitive and case-insensitive lookup. On 2.0 profile, first perform
+       case-sensitive lookup and fallback to case-insensitive lookup.
+       Set and remove Container where necessary, and perform checks for
+       ownership. Implemented AddRange overloads, and (Get/Set)Parameter.
+       Added several 2.0 overloads taking OracleParameter. Fixed exceptions
+       to match MS.
+       * OracleDataReader.cs: Corcompare fixes for 2.0 profile. Moved
+       disposing of schematable to Close, and invoke Close from Dispose.
+       Reduce casts. Stubbed methods introduced in 2.0 profile.
+       * OracleConnection.cs: Corcompare fixes for 2.0 profile. Changed
+       ConnectionString to return zero-length string when underlying value is
+       null. Removed explicit IDisposable implementation. Use string.Empty
+       instead of "". Code formatting.
+       * OracleMonthSpan.cs: Code formatting. Changed argument name of
+       explicit operator to match MS.
+       * OracleDataAdapter.cs: Code formatting. Fixed default ctor to use
+       null for SelectCommand. In 2.0 profile, set UpdateBatchSize to 1 and
+       throw AORE when setting it to negative value. Modified *Command setters
+       to throw InvalidCastException instead of ArgumentException. Removed
+       extra TableMappings property.
+       * OracleParameter.cs: Use zero-length string as default for
+       SourceColumn. Added missing 2.0 ctor. In ParameterName return zero
+       length string when name is null. Added SourceColumnNullMapping
+       property. Corcompare fixes for 2.0 profile. Code formatting.
+       * OracleBFile.cs: Added Dispose override for 2.0 profile.
+
 2007-11-11 Leszek Ciesielski <skolima@gmail.com>
+
        * OracleCommands.cs: fix for binging procedure parameters by name
        rather than position (by Gary Thomas)
+
 2007-11-01  Marek Safar  <marek.safar@gmail.com>
 
        * OracleCommand.cs,
index b82f0103c3bc5b150dc38e47dd812eb6c4452973..66e70aea9973518fec8d897e49882e9d29ef2d60 100644 (file)
@@ -18,7 +18,8 @@ using System;
 using System.IO;
 using System.Data.SqlTypes;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        public sealed class OracleBFile : Stream, ICloneable, IDisposable, INullable
        {
                #region Fields
@@ -27,7 +28,7 @@ namespace System.Data.OracleClient {
 
                OracleConnection connection;
                bool isOpen = true;
-               bool notNull = false;
+               bool notNull;
 
                #endregion // Fields
 
@@ -153,11 +154,18 @@ namespace System.Data.OracleClient {
                        throw new NotImplementedException ();
                }
 
+#if NET_2_0
+               protected override void Dispose (bool disposing)
+               {
+                       throw new NotImplementedException ();
+               }
+#else
                [MonoTODO]
                public void Dispose ()
                {
                        throw new NotImplementedException ();
                }
+#endif
 
                [MonoTODO]
                public override void Flush ()
index 9d6e441772e6eb0be7ffa3fb9061734efcf60d2e..9a96bc3e61ac602f831c2b3b884aa756c0640405 100644 (file)
@@ -21,6 +21,9 @@
 using System;
 using System.ComponentModel;
 using System.Data;
+#if NET_2_0
+using System.Data.Common;
+#endif
 using System.Data.OracleClient.Oci;
 using System.Drawing.Design;
 using System.Text;
@@ -32,11 +35,11 @@ namespace System.Data.OracleClient
 #endif
        [Designer ("Microsoft.VSDesigner.Data.VS.OracleCommandDesigner, " + Consts.AssemblyMicrosoft_VSDesigner)]
        [ToolboxItem (true)]
-       public sealed class OracleCommand : 
+       public sealed class OracleCommand :
 #if NET_2_0
-       Common.DbCommand, ICloneable, IDbCommand
+               DbCommand, ICloneable
 #else
-       Component, ICloneable, IDbCommand
+               Component, ICloneable, IDbCommand
 #endif
        {
                #region Fields
@@ -49,12 +52,7 @@ namespace System.Data.OracleClient
                OracleParameterCollection parameters;
                OracleTransaction transaction;
                UpdateRowSource updatedRowSource;
-               
-#if NET_2_0
-               int connection_timeout;
-#endif         
-
-               private OciStatementHandle preparedStatement;
+               OciStatementHandle preparedStatement;
                //OciStatementType statementType;
 
                #endregion // Fields
@@ -84,9 +82,8 @@ namespace System.Data.OracleClient
                        Transaction = tx;
                        CommandType = CommandType.Text;
                        UpdatedRowSource = UpdateRowSource.Both;
-                       DesignTimeVisible = false;
-
-                       parameters = new OracleParameterCollection (this);
+                       DesignTimeVisible = true;
+                       parameters = new OracleParameterCollection ();
                }
 
                #endregion // Constructors
@@ -97,18 +94,23 @@ namespace System.Data.OracleClient
                [RefreshProperties (RefreshProperties.All)]
                [Editor ("Microsoft.VSDesigner.Data.Oracle.Design.OracleCommandTextEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                string CommandText {
-                       get { return commandText; }
+                       get {
+                               if (commandText == null)
+                                       return string.Empty;
+
+                               return commandText;
+                       }
                        set { commandText = value; }
                }
 
                [RefreshProperties (RefreshProperties.All)]
                [DefaultValue (CommandType.Text)]
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                CommandType CommandType {
@@ -122,35 +124,39 @@ namespace System.Data.OracleClient
 
                [DefaultValue (null)]
                [Editor ("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
-               public OracleConnection Connection {
+               public
+#if NET_2_0
+               new
+#endif
+               OracleConnection Connection {
                        get { return connection; }
                        set { connection = value; }
                }
-               
+
 #if NET_2_0
                [Browsable (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public override int CommandTimeout {
-                       get { return connection_timeout; }
-                       set { connection_timeout = value; }
+                       get { return 0; }
+                       set { }
                }
 
                [MonoTODO]
-               protected override Common.DbConnection DbConnection {
-                       get { return null; }
-                       set {}
+               protected override DbConnection DbConnection {
+                       get { return Connection; }
+                       set { Connection = (OracleConnection) value; }
                }
 
                [MonoTODO]
-               protected override Common.DbParameterCollection DbParameterCollection {
-                       get { return null; }
+               protected override DbParameterCollection DbParameterCollection {
+                       get { return Parameters; }
                }
 
                [MonoTODO]
-               protected override Common.DbTransaction DbTransaction {
-                       get { return null; }
-                       set {}                                  
+               protected override DbTransaction DbTransaction {
+                       get { return Transaction; }
+                       set { Transaction = (OracleTransaction) value; }
                }
 #endif
 
@@ -159,9 +165,9 @@ namespace System.Data.OracleClient
                [DesignOnly (true)]
 #if NET_2_0
                [EditorBrowsable (EditorBrowsableState.Never)]
-#endif         
+#endif
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                bool DesignTimeVisible {
@@ -177,6 +183,7 @@ namespace System.Data.OracleClient
                        get { return Connection.ErrorHandle; }
                }
 
+#if !NET_2_0
                int IDbCommand.CommandTimeout {
                        get { return 0; }
                        set { }
@@ -187,7 +194,7 @@ namespace System.Data.OracleClient
                IDbConnection IDbCommand.Connection {
                        get { return Connection; }
                        set {
-                                // InvalidCastException is expected when types do not match
+                               // InvalidCastException is expected when types do not match
                                Connection = (OracleConnection) value;
                        }
                }
@@ -199,26 +206,35 @@ namespace System.Data.OracleClient
                IDbTransaction IDbCommand.Transaction {
                        get { return Transaction; }
                        set {
-                                // InvalidCastException is expected when types do not match
+                               // InvalidCastException is expected when types do not match
                                Transaction = (OracleTransaction) value;
                        }
                }
+#endif
 
                [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
-               public OracleParameterCollection Parameters {
+               public
+#if NET_2_0
+               new
+#endif
+               OracleParameterCollection Parameters {
                        get { return parameters; }
                }
 
                [Browsable (false)]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-               public OracleTransaction Transaction {
+               public
+#if NET_2_0
+               new
+#endif
+               OracleTransaction Transaction {
                        get { return transaction; }
                        set { transaction = value; }
                }
 
                [DefaultValue (UpdateRowSource.Both)]
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                UpdateRowSource UpdatedRowSource {
@@ -232,7 +248,7 @@ namespace System.Data.OracleClient
 
                private void AssertCommandTextIsSet ()
                {
-                       if (CommandText == String.Empty || CommandText == null)
+                       if (CommandText.Length == 0)
                                throw new InvalidOperationException ("The command text for this Command has not been set.");
                }
 
@@ -262,13 +278,13 @@ namespace System.Data.OracleClient
 
                [MonoTODO]
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                void Cancel ()
                {
                        throw new NotImplementedException ();
-               }       
+               }
 
                [MonoTODO]
                public object Clone ()
@@ -312,21 +328,20 @@ namespace System.Data.OracleClient
 
                        return cmd;
                }
-               
-               
+
 #if NET_2_0
                [MonoTODO]
-               protected override Common.DbParameter CreateDbParameter ()
+               protected override DbParameter CreateDbParameter ()
                {
-                       return null;
+                       return CreateParameter ();
                }
 
                [MonoTODO]
-               protected override Common.DbDataReader ExecuteDbDataReader (CommandBehavior behaviour)
+               protected override DbDataReader ExecuteDbDataReader (CommandBehavior behavior)
                {
-                       return null;
+                       return ExecuteReader (behavior);
                }
-#endif                 
+#endif
 
                internal void UpdateParameterValues ()
                {
@@ -345,7 +360,11 @@ namespace System.Data.OracleClient
                                Connection.Close ();
                }
 
-               public OracleParameter CreateParameter ()
+               public
+#if NET_2_0
+               new
+#endif
+               OracleParameter CreateParameter ()
                {
                        return new OracleParameter ();
                }
@@ -381,9 +400,9 @@ namespace System.Data.OracleClient
                }
 
                public
-#if NET_2_0            
+#if NET_2_0
                override
-#endif         
+#endif
                int ExecuteNonQuery ()
                {
                        AssertConnectionIsOpen ();
@@ -399,8 +418,7 @@ namespace System.Data.OracleClient
                        OciStatementHandle statement = GetStatementHandle ();
                        try {
                                return ExecuteNonQueryInternal (statement, useAutoCommit);
-                       }
-                       finally {
+                       } finally {
                                SafeDisposeHandle (statement);
                        }
                }
@@ -428,8 +446,7 @@ namespace System.Data.OracleClient
                                rowid = new OracleString (descriptor.GetRowId (ErrorHandle));
 
                                return retval;
-                       }
-                       finally {
+                       } finally {
                                SafeDisposeHandle (statement);
                        }
                }
@@ -463,7 +480,7 @@ namespace System.Data.OracleClient
                                        if (statement.Fetch ()) {
                                                OciDefineHandle defineHandle = (OciDefineHandle) statement.Values [0];
                                                if (!defineHandle.IsNull)
-                                                        output = defineHandle.GetOracleValue (Connection.SessionFormatProvider);
+                                                       output = defineHandle.GetOracleValue (Connection.SessionFormatProvider);
                                                switch (defineHandle.DataType) {
                                                case OciDataType.Blob:
                                                case OciDataType.Clob:
@@ -475,8 +492,7 @@ namespace System.Data.OracleClient
                                }
 
                                return output;
-                       }
-                       finally {
+                       } finally {
                                SafeDisposeHandle (statement);
                        }
                }
@@ -492,12 +508,20 @@ namespace System.Data.OracleClient
                        return true;
                }
 
-               public OracleDataReader ExecuteReader ()
+               public
+#if NET_2_0
+               new
+#endif
+               OracleDataReader ExecuteReader ()
                {
                        return ExecuteReader (CommandBehavior.Default);
                }
 
-               public OracleDataReader ExecuteReader (CommandBehavior behavior)
+               public
+#if NET_2_0
+               new
+#endif
+               OracleDataReader ExecuteReader (CommandBehavior behavior)
                {
                        AssertConnectionIsOpen ();
                        AssertTransactionMatch ();
@@ -505,7 +529,7 @@ namespace System.Data.OracleClient
                        AssertNoDataReader ();
                        bool hasRows = false;
 
-                        this.behavior = behavior;
+                       this.behavior = behavior;
 
                        if (Transaction != null)
                                Transaction.AttachToServiceContext ();
@@ -513,7 +537,7 @@ namespace System.Data.OracleClient
                        OciStatementHandle statement = GetStatementHandle ();
                        OracleDataReader rd = null;
 
-                       try     {
+                       try {
                                if (preparedStatement == null)
                                        PrepareStatement (statement);
                                else
@@ -533,8 +557,7 @@ namespace System.Data.OracleClient
                                }
 
                                rd = new OracleDataReader (this, statement, hasRows, behavior);
-                       }
-                       finally {
+                       } finally {
                                if (statement != null && rd == null)
                                        statement.Dispose();
                        }
@@ -543,7 +566,7 @@ namespace System.Data.OracleClient
                }
 
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                object ExecuteScalar ()
@@ -578,23 +601,22 @@ namespace System.Data.OracleClient
                                                        switch (defineHandle.DataType) {
                                                        case OciDataType.Blob:
                                                        case OciDataType.Clob:
-                                                                OracleLob lob = (OracleLob) defineHandle.GetValue (
-                                                                        Connection.SessionFormatProvider);
+                                                               OracleLob lob = (OracleLob) defineHandle.GetValue (
+                                                                       Connection.SessionFormatProvider);
                                                                lob.connection = Connection;
                                                                output = lob.Value;
                                                                lob.Close ();
                                                                break;
                                                        default:
                                                                output = defineHandle.GetValue (
-                                                                        Connection.SessionFormatProvider);
+                                                                       Connection.SessionFormatProvider);
                                                                break;
                                                        }
                                                }
                                        }
                                        UpdateParameterValues ();
                                }
-                       }
-                       finally {
+                       } finally {
                                SafeDisposeHandle (statement);
                        }
 
@@ -620,6 +642,7 @@ namespace System.Data.OracleClient
                                h.Dispose();
                }
 
+#if !NET_2_0
                IDbDataParameter IDbCommand.CreateParameter ()
                {
                        return CreateParameter ();
@@ -634,6 +657,7 @@ namespace System.Data.OracleClient
                {
                        return ExecuteReader (behavior);
                }
+#endif
 
                void PrepareStatement (OciStatementHandle statement)
                {
@@ -648,13 +672,12 @@ namespace System.Data.OracleClient
 
                                string sql = "begin " + commandText + "(" + sb.ToString() + "); end;";
                                statement.Prepare (sql);
-                       }
-                       else    // Text
+                       } else  // Text
                                statement.Prepare (commandText);
                }
 
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                void Prepare ()
@@ -665,14 +688,14 @@ namespace System.Data.OracleClient
                        preparedStatement = statement;
                }
 
-                protected override void Dispose (bool disposing)
-                {
-                        if (disposing)
-                                if (Parameters.Count > 0)
-                                        foreach (OracleParameter parm in Parameters)
-                                                parm.FreeHandle ();
-                        base.Dispose (disposing);
-                }
+               protected override void Dispose (bool disposing)
+               {
+                       if (disposing)
+                               if (Parameters.Count > 0)
+                                       foreach (OracleParameter parm in Parameters)
+                                               parm.FreeHandle ();
+                       base.Dispose (disposing);
+               }
 
                #endregion // Methods
        }
index 1b26c829381a6925f89d9546c56f1798ad6eb06c..1bda21201f64f2190c3572b0c32006e5492e8d74 100644 (file)
@@ -36,9 +36,9 @@ using System.EnterpriseServices;
 using System.Globalization;
 using System.Text;
 
-namespace System.Data.OracleClient 
+namespace System.Data.OracleClient
 {
-       internal struct OracleConnectionInfo 
+       internal struct OracleConnectionInfo
        {
                internal string Username;
                internal string Password;
@@ -50,7 +50,7 @@ namespace System.Data.OracleClient
        [DefaultEvent ("InfoMessage")]
        public sealed class OracleConnection :
 #if NET_2_0
-               Common.DbConnection, ICloneable, IDbConnection
+               Common.DbConnection, ICloneable
 #else
                Component, ICloneable, IDbConnection
 #endif
@@ -60,30 +60,30 @@ namespace System.Data.OracleClient
                OciGlue oci;
                ConnectionState state;
                OracleConnectionInfo conInfo;
-               OracleTransaction transaction = null;
+               OracleTransaction transaction;
                string connectionString = String.Empty;
-               string parsedConnectionString = String.Empty;
-               OracleDataReader dataReader = null;
+               string parsedConnectionString;
+               OracleDataReader dataReader;
                bool pooling = true;
                static OracleConnectionPoolManager pools = new OracleConnectionPoolManager ();
                OracleConnectionPool pool;
-               int minPoolSize = 0;
+               int minPoolSize;
                int maxPoolSize = 100;
                byte persistSecurityInfo = 1;
-               bool disposed = false;
-                IFormatProvider format_info;
+               bool disposed;
+               IFormatProvider format_info;
 
                #endregion // Fields
 
                #region Constructors
 
-               public OracleConnection () 
+               public OracleConnection ()
                {
                        state = ConnectionState.Closed;
                }
 
-               public OracleConnection (string connectionString) 
-                       : this() 
+               public OracleConnection (string connectionString)
+                       : this()
                {
                        SetConnectionString (connectionString, false);
                }
@@ -92,10 +92,17 @@ namespace System.Data.OracleClient
 
                #region Properties
 
+#if NET_2_0
+               [MonoTODO ("Currently not respected.")]
+               public override int ConnectionTimeout {
+                       get { return 0; }
+               }
+#else
+               [MonoTODO ("Currently not respected.")]
                int IDbConnection.ConnectionTimeout {
-                       [MonoTODO]
-                       get { return -1; }
+                       get { return 0; }
                }
+#endif
 
 #if NET_2_0
                [Browsable (false)]
@@ -159,15 +166,17 @@ namespace System.Data.OracleClient
                [RefreshProperties (RefreshProperties.All)]
                [Editor ("Microsoft.VSDesigner.Data.Oracle.Design.OracleConnectionStringEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
                public
-#if NET_2_0            
+#if NET_2_0
                override
 #endif
                string ConnectionString {
-                       get { 
+                       get {
+                               if (parsedConnectionString == null)
+                                       return string.Empty;
                                return parsedConnectionString;
                        }
-                       set { 
-                               SetConnectionString (value, false); 
+                       set {
+                               SetConnectionString (value, false);
                        }
                }
 
@@ -186,7 +195,7 @@ namespace System.Data.OracleClient
                        }
                }
 
-               internal string GetOracleVersion () 
+               internal string GetOracleVersion ()
                {
                        byte[] buffer = new Byte[256];
                        uint bufflen = (uint) buffer.Length;
@@ -221,12 +230,20 @@ namespace System.Data.OracleClient
 
                #region Methods
 
-               public OracleTransaction BeginTransaction ()
+               public
+#if NET_2_0
+               new
+#endif
+               OracleTransaction BeginTransaction ()
                {
                        return BeginTransaction (IsolationLevel.ReadCommitted);
                }
 
-               public OracleTransaction BeginTransaction (IsolationLevel il)
+               public
+#if NET_2_0
+               new
+#endif
+               OracleTransaction BeginTransaction (IsolationLevel il)
                {
                        if (state == ConnectionState.Closed)
                                throw new InvalidOperationException ("The connection is not open.");
@@ -246,22 +263,26 @@ namespace System.Data.OracleClient
 
                [MonoTODO]
 #if NET_2_0
-               public override void ChangeDatabase (string databaseName)
+               public override void ChangeDatabase (string value)
 #else
-               void IDbConnection.ChangeDatabase (string databaseName)
+               void IDbConnection.ChangeDatabase (string value)
 #endif
                {
                        throw new NotImplementedException ();
                }
 
-               public OracleCommand CreateCommand ()
+               public
+#if NET_2_0
+               new
+#endif
+               OracleCommand CreateCommand ()
                {
                        OracleCommand command = new OracleCommand ();
                        command.Connection = this;
                        return command;
                }
 
-               [MonoTODO]      
+               [MonoTODO]
                object ICloneable.Clone ()
                {
                        OracleConnection con = new OracleConnection ();
@@ -270,26 +291,22 @@ namespace System.Data.OracleClient
                        return con;
                }
 
+#if !NET_2_0
                IDbTransaction IDbConnection.BeginTransaction ()
                {
                        return BeginTransaction ();
                }
 
-               IDbTransaction IDbConnection.BeginTransaction (IsolationLevel iso)
+               IDbTransaction IDbConnection.BeginTransaction (IsolationLevel il)
                {
-                       return BeginTransaction (iso);
+                       return BeginTransaction (il);
                }
 
                IDbCommand IDbConnection.CreateCommand ()
                {
                        return CreateCommand ();
                }
-
-               void IDisposable.Dispose ()
-               {
-                       Dispose (true);
-                       GC.SuppressFinalize (this);
-               }
+#endif
 
                [MonoTODO]
                protected override void Dispose (bool disposing)
@@ -301,11 +318,11 @@ namespace System.Data.OracleClient
                                transaction = null;
                                oci = null;
                                pool = null;
-                               conInfo.Username = "";
-                               conInfo.Database = "";
-                               conInfo.Password = "";
-                               connectionString = "";
-                               parsedConnectionString = "";
+                               conInfo.Username = string.Empty;
+                               conInfo.Database = string.Empty;
+                               conInfo.Password = string.Empty;
+                               connectionString = null;
+                               parsedConnectionString = null;
                                base.Dispose (disposing);
                                disposed = true;
                        }
@@ -318,7 +335,7 @@ namespace System.Data.OracleClient
                }
 
                // Get NLS_DATE_FORMAT string from Oracle server
-               internal string GetSessionDateFormat () 
+               internal string GetSessionDateFormat ()
                {
                        // 23 is 22 plus 1 for NUL terminated character
                        // a DATE format has a max size of 22
@@ -332,7 +349,7 @@ namespace System.Data.OracleClient
                // item = OciNlsServiceType enum value
                //
                // if unsure how much you need, use OciNlsServiceType.MAXBUFSZ
-               internal string GetNlsInfo (OciHandle handle, uint bufflen, OciNlsServiceType item) 
+               internal string GetNlsInfo (OciHandle handle, uint bufflen, OciNlsServiceType item)
                {
                        byte[] buffer = new Byte[bufflen];
 
@@ -350,12 +367,11 @@ namespace System.Data.OracleClient
                        return ret.ToString ();
                }
 
-                // An instance of IFormatProvider for locale - independent IFormattable.ToString () in Bind ()
+               // An instance of IFormatProvider for locale - independent IFormattable.ToString () in Bind ()
                [MonoTODO("Handle other culture-specific informations, restrict buffer sizes")]
-                internal IFormatProvider SessionFormatProvider {
-                        get {
-                               if (format_info == null && state == ConnectionState.Open)
-                               {
+               internal IFormatProvider SessionFormatProvider {
+                       get {
+                               if (format_info == null && state == ConnectionState.Open) {
                                        NumberFormatInfo numberFormatInfo = new NumberFormatInfo ();
                                        numberFormatInfo.NumberGroupSeparator
                                        = GetNlsInfo (Session, (uint)OciNlsServiceType.MAXBUFSZ, OciNlsServiceType.GROUP);
@@ -367,26 +383,25 @@ namespace System.Data.OracleClient
                                        = GetNlsInfo (Session, (uint)OciNlsServiceType.MAXBUFSZ, OciNlsServiceType.MONDECIMAL);
                                        format_info = numberFormatInfo;
                                }
-                                return format_info;
-                        }
-                }
+                               return format_info;
+                       }
+               }
 
                public
 #if NET_2_0
                override
 #endif         
-               void Open () 
+               void Open ()
                {
                        if (State == ConnectionState.Open)
                                return;
 
                        PersistSecurityInfo ();
 
-                       if (!pooling) { 
+                       if (!pooling) {
                                oci = new OciGlue ();
                                oci.CreateConnection (conInfo);
-                       }
-                       else {
+                       } else {
                                pool = pools.GetConnectionPool (conInfo, minPoolSize, maxPoolSize);
                                oci = pool.GetConnection ();
                        }
@@ -395,35 +410,37 @@ namespace System.Data.OracleClient
                        CreateStateChange (ConnectionState.Closed, ConnectionState.Open);
                }
 
-               internal void CreateInfoMessage (OciErrorInfo info) 
+               internal void CreateInfoMessage (OciErrorInfo info)
                {
                        OracleInfoMessageEventArgs a = new OracleInfoMessageEventArgs (info);
                        OnInfoMessage (a);
                }
 
-               private void OnInfoMessage (OracleInfoMessageEventArgs e) 
+               private void OnInfoMessage (OracleInfoMessageEventArgs e)
                {
                        if (InfoMessage != null)
                                InfoMessage (this, e);
                }
 
-               internal void CreateStateChange (ConnectionState original, ConnectionState current) 
+               internal void CreateStateChange (ConnectionState original, ConnectionState current)
                {
                        StateChangeEventArgs a = new StateChangeEventArgs (original, current);
                        OnStateChange (a);
                }
 
+#if !NET_2_0
                private void OnStateChange (StateChangeEventArgs e) 
                {
                        if (StateChange != null)
                                StateChange (this, e);
                }
+#endif
 
                public
 #if NET_2_0
                override
 #endif
-               void Close () 
+               void Close ()
                {
                        if (transaction != null)
                                transaction.Rollback ();
@@ -438,20 +455,18 @@ namespace System.Data.OracleClient
                }
 
 #if NET_2_0
-               [MonoTODO]
-               protected override Common.DbTransaction BeginDbTransaction (IsolationLevel level)
+               protected override Common.DbTransaction BeginDbTransaction (IsolationLevel isolationLevel)
                {
-                       return null;
+                       return BeginTransaction (isolationLevel);
                }
                
-               [MonoTODO]
                protected override Common.DbCommand CreateDbCommand ()
                {
-                       return null;
-               }               
+                       return CreateCommand ();
+               }
 #endif
 
-               private void PersistSecurityInfo () 
+               private void PersistSecurityInfo ()
                {
                        // persistSecurityInfo:
                        // 0 = true/yes
@@ -463,12 +478,9 @@ namespace System.Data.OracleClient
 
                        persistSecurityInfo = 2;
 
-                       if (connectionString == null)
+                       if (connectionString == null || connectionString.Length == 0)
                                return;
 
-                       if (connectionString == String.Empty)
-                               return;
-                       
                        string conString = connectionString + ";";
 
                        bool inQuote = false;
@@ -540,24 +552,24 @@ namespace System.Data.OracleClient
                        }
                }
 
-               internal void SetConnectionString (string connectionString, bool persistSecurity) 
+               internal void SetConnectionString (string connectionString, bool persistSecurity)
                {
                        persistSecurityInfo = 1;
-                       this.connectionString = String.Copy (connectionString);
-                       this.parsedConnectionString = this.connectionString;
-                       if (this.connectionString == null)
-                               this.connectionString = String.Empty;
-                       conInfo.Username = "";
-                       conInfo.Database = "";
-                       conInfo.Password = "";
+
+                       conInfo.Username = string.Empty;
+                       conInfo.Database = string.Empty;
+                       conInfo.Password = string.Empty;
                        conInfo.CredentialType = OciCredentialType.RDBMS;
 
-                       if (connectionString == null)
+                       if (connectionString == null || connectionString.Length == 0) {
+                               this.connectionString = connectionString;
+                               this.parsedConnectionString = connectionString;
                                return;
+                       }
+
+                       this.connectionString = String.Copy (connectionString);
+                       this.parsedConnectionString = this.connectionString;
 
-                       if (connectionString == String.Empty)
-                               return;
-                       
                        connectionString += ";";
                        NameValueCollection parameters = new NameValueCollection ();
 
@@ -608,12 +620,12 @@ namespace System.Data.OracleClient
 
                        conInfo.ConnectionString = this.connectionString;
 
-                       if (persistSecurity == true)
+                       if (persistSecurity)
                                PersistSecurityInfo ();
                }
 
-               private void SetProperties (NameValueCollection parameters) 
-               {       
+               private void SetProperties (NameValueCollection parameters)
+               {
                        string value;
                        foreach (string name in parameters) {
                                value = parameters[name];
@@ -627,13 +639,13 @@ namespace System.Data.OracleClient
                                        // TODO:
                                        break;
                                case "INTEGRATED SECURITY":
-                                       if (ConvertToBoolean ("integrated security", value) == false)
+                                       if (!ConvertToBoolean ("integrated security", value))
                                                conInfo.CredentialType = OciCredentialType.RDBMS;
                                        else
                                                conInfo.CredentialType = OciCredentialType.External;
                                        break;
                                case "PERSIST SECURITY INFO":
-                                       if (ConvertToBoolean ("persist security info", value) == false)
+                                       if (!ConvertToBoolean ("persist security info", value))
                                                persistSecurityInfo = 1;
                                        else
                                                persistSecurityInfo = 0;
@@ -665,14 +677,13 @@ namespace System.Data.OracleClient
                        }
                }
 
-               private bool ConvertToBoolean(string key, string value) 
+               private bool ConvertToBoolean(string key, string value)
                {
                        string upperValue = value.ToUpper();
 
-                       if (upperValue == "TRUE" ||upperValue == "YES") {
+                       if (upperValue == "TRUE" || upperValue == "YES") {
                                return true;
-                       } 
-                       else if (upperValue == "FALSE" || upperValue == "NO") {
+                       } else if (upperValue == "FALSE" || upperValue == "NO") {
                                return false;
                        }
 
@@ -684,6 +695,8 @@ namespace System.Data.OracleClient
                #endregion // Methods
 
                public event OracleInfoMessageEventHandler InfoMessage;
+#if !NET_2_0
                public event StateChangeEventHandler StateChange;
+#endif
        }
 }
index 81685ab7284f1a23b7bf19adbd93161112b4b7b7..027394416836d5ec45f3e8c57c00a2be13bc4a99 100644 (file)
@@ -27,7 +27,8 @@ using System.Data;
 using System.Data.Common;
 using System.Drawing.Design;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        [DefaultEvent ("RowUpdated")]
        [Designer ("Microsoft.VSDesigner.Data.VS.OracleDataAdapterDesigner, " + Consts.AssemblyMicrosoft_VSDesigner)]
        [ToolboxItem ("Microsoft.VSDesigner.Data.VS.OracleDataAdapterToolboxItem, " + Consts.AssemblyMicrosoft_VSDesigner)]
@@ -35,7 +36,6 @@ namespace System.Data.OracleClient {
        {
                #region Fields
 
-               //bool disposed = false;
                OracleCommand deleteCommand;
                OracleCommand insertCommand;
                OracleCommand selectCommand;
@@ -48,17 +48,16 @@ namespace System.Data.OracleClient {
 
                #region Constructors
 
-               public OracleDataAdapter ()
-                       : this (new OracleCommand ())
+               public OracleDataAdapter () : this ((OracleCommand) null)
                {
                }
 
                public OracleDataAdapter (OracleCommand selectCommand)
                {
-                       DeleteCommand = null;
-                       InsertCommand = null;
                        SelectCommand = selectCommand;
-                       UpdateCommand = null;
+#if NET_2_0
+                       UpdateBatchSize = 1;
+#endif
                }
 
                public OracleDataAdapter (string selectCommandText, OracleConnection selectConnection)
@@ -102,51 +101,36 @@ namespace System.Data.OracleClient {
                        get { return updateCommand; }
                        set { updateCommand = value; }
                }
+
 #if NET_2_0
                public override int UpdateBatchSize {
                        get { return updateBatchSize; }
-                       set { updateBatchSize = value; }
+                       set {
+                               if (value < 0)
+                                       throw new ArgumentOutOfRangeException ("UpdateBatchSize");
+                               updateBatchSize = value; 
+                       }
                }
 #endif
+
                IDbCommand IDbDataAdapter.DeleteCommand {
                        get { return DeleteCommand; }
-                       set {
-                               if (value != null && !(value is OracleCommand))
-                                       throw new ArgumentException ();
-                               DeleteCommand = (OracleCommand) value;
-                       }
+                       set { DeleteCommand = (OracleCommand) value; }
                }
 
                IDbCommand IDbDataAdapter.InsertCommand {
                        get { return InsertCommand; }
-                       set {
-                               if (value != null && !(value is OracleCommand))
-                                       throw new ArgumentException ();
-                               InsertCommand = (OracleCommand) value;
-                       }
+                       set { InsertCommand = (OracleCommand) value; }
                }
 
                IDbCommand IDbDataAdapter.SelectCommand {
                        get { return SelectCommand; }
-                       set {
-                               if (value != null && !(value is OracleCommand))
-                                       throw new ArgumentException ();
-                               SelectCommand = (OracleCommand) value;
-                       }
+                       set { SelectCommand = (OracleCommand) value; }
                }
 
                IDbCommand IDbDataAdapter.UpdateCommand {
                        get { return UpdateCommand; }
-                       set {
-                               if (value != null && !(value is OracleCommand))
-                                       throw new ArgumentException ();
-                               UpdateCommand = (OracleCommand) value;
-                       }
-               }
-
-
-               ITableMappingCollection IDataAdapter.TableMappings {
-                       get { return TableMappings; }
+                       set { UpdateCommand = (OracleCommand) value; }
                }
 
                #endregion // Properties
@@ -184,6 +168,5 @@ namespace System.Data.OracleClient {
                public event OracleRowUpdatingEventHandler RowUpdating;
 
                #endregion // Events and Delegates
-
        }
 }
index 4bc51fa0a910bc61bd28b9530be140026487d5a9..88f169af47421f3d524b9244ab4f5849ba135f8f 100644 (file)
@@ -27,14 +27,22 @@ using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Text;
 
-namespace System.Data.OracleClient {
-       public sealed class OracleDataReader : MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
+namespace System.Data.OracleClient
+{
+       public sealed class OracleDataReader :
+#if NET_2_0
+               DbDataReader
+#else
+               MarshalByRefObject, IDataReader, IDisposable, IDataRecord, IEnumerable
+#endif
        {
                #region Fields
 
                OracleCommand command;
                ArrayList dataTypeNames;
-               bool disposed = false;
+#if !NET_2_0
+               bool disposed;
+#endif
                bool isClosed;
                bool hasRows;
                DataTable schemaTable;
@@ -48,16 +56,15 @@ namespace System.Data.OracleClient {
 
                #region Constructors
 
-               internal OracleDataReader (OracleCommand command, OciStatementHandle statement, bool extHasRows, CommandBehavior behavior) 
+               internal OracleDataReader (OracleCommand command, OciStatementHandle statement, bool extHasRows, CommandBehavior behavior)
                {
                        this.command = command;
                        this.hasRows = extHasRows;
-                       this.isClosed = false;
                        this.schemaTable = ConstructSchemaTable ();
                        this.statement = statement;
                        this.statementType = statement.GetStatementType ();
                        this.behavior = behavior;
-               }
+               }
 
                ~OracleDataReader ()
                {
@@ -68,33 +75,61 @@ namespace System.Data.OracleClient {
 
                #region Properties
 
-               public int Depth {
+               public
+#if NET_2_0
+               override
+#endif
+               int Depth {
                        get { return 0; }
                }
 
-               public int FieldCount {
+               public
+#if NET_2_0
+               override
+#endif
+               int FieldCount {
                        get { return statement.ColumnCount; }
                }
 
-               public bool HasRows {
+               public
+#if NET_2_0
+               override
+#endif
+               bool HasRows {
                        get { return hasRows; }
                }
 
-               public bool IsClosed {
+               public
+#if NET_2_0
+               override
+#endif
+               bool IsClosed {
                        get { return isClosed; }
                }
 
-               public object this [string name] {
+               public
+#if NET_2_0
+               override
+#endif
+               object this [string name] {
                        get { return GetValue (GetOrdinal (name)); }
                }
 
-               public object this [int i] {
+               public
+#if NET_2_0
+               override
+#endif
+               object this [int i] {
                        get { return GetValue (i); }
                }
 
-               public int RecordsAffected {
-                       get { 
-                               return GetRecordsAffected ();                           
+               public
+#if NET_2_0
+               override
+#endif
+               int RecordsAffected {
+                       get {
+                               return GetRecordsAffected ();
                        }
                }
 
@@ -102,8 +137,12 @@ namespace System.Data.OracleClient {
 
                #region Methods
 
-               public void Close ()
-               {       
+               public
+#if NET_2_0
+               override
+#endif
+               void Close ()
+               {
                        if (!isClosed) {
                                GetRecordsAffected ();
                                if (command != null)
@@ -113,6 +152,12 @@ namespace System.Data.OracleClient {
                                statement.Dispose();
                                statement = null;
                        }
+#if NET_2_0
+                       if (schemaTable != null) {
+                               schemaTable.Dispose ();
+                               schemaTable = null;
+                       }
+#endif
                        isClosed = true;
                }
 
@@ -145,13 +190,12 @@ namespace System.Data.OracleClient {
                        return schemaTable;
                }
 
+#if !NET_2_0
                private void Dispose (bool disposing)
                {
                        if (!disposed) {
-                               if (disposing) {
-                                       schemaTable.Dispose ();
+                               if (disposing)
                                        Close ();
-                               }
                                disposed = true;
                        }
                }
@@ -161,112 +205,177 @@ namespace System.Data.OracleClient {
                        Dispose (true);
                        GC.SuppressFinalize (this);
                }
+#endif
 
-               public bool GetBoolean (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               bool GetBoolean (int i)
                {
                        throw new NotSupportedException ();
                }
 
-               public byte GetByte (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               byte GetByte (int i)
                {
                        throw new NotSupportedException ();
                }
 
-               public long GetBytes (int i, long fieldOffset, byte[] buffer2, int bufferoffset, int length)
+               public
+#if NET_2_0
+               override
+#endif
+               long GetBytes (int i, long fieldOffset, byte[] buffer2, int bufferoffset, int length)
                {
-                       object value = GetValue (i);
-                       if (!(value is byte[]))
-                               throw new InvalidCastException ();
+                       byte[] value = (byte[]) GetValue (i);
 
-                        if ( buffer2 == null )
-                               return ((byte []) value).Length; // Return length of data
+                       if (buffer2 == null)
+                               return value.Length; // Return length of data
 
-                        // Copy data into buffer
-                        long lobLength = ((byte []) value).Length;
-                        if ( (lobLength - fieldOffset) < length)
-                                length = (int) (lobLength - fieldOffset);
-                        Array.Copy ( (byte[]) value, (int) fieldOffset, buffer2, bufferoffset, length);
-                        return length; // return actual read count
-                }
+                       // Copy data into buffer
+                       long lobLength = value.Length;
+                       if ((lobLength - fieldOffset) < length)
+                               length = (int) (lobLength - fieldOffset);
+                       Array.Copy (value, (int) fieldOffset, buffer2,
+                               bufferoffset, length);
+                       return length; // return actual read count
+               }
 
-               public char GetChar (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               char GetChar (int i)
                {
                        throw new NotSupportedException ();
                }
 
-               public long GetChars (int i, long fieldOffset, char[] buffer2, int bufferoffset, int length)
+               public
+#if NET_2_0
+               override
+#endif
+               long GetChars (int i, long fieldOffset, char[] buffer2, int bufferoffset, int length)
                {
-                       object value = GetValue (i);
-                       if (!(value is char[]))
-                               throw new InvalidCastException ();
-                       Array.Copy ((char[]) value, (int) fieldOffset, buffer2, bufferoffset, length);
-                       return ((char[]) value).Length - fieldOffset;
+                       char [] value = (char[]) GetValue (i);
+                       Array.Copy (value, (int) fieldOffset, buffer2,
+                               bufferoffset, length);
+                       return (value.Length - fieldOffset);
                }
 
+#if !NET_2_0
                [MonoTODO]
                public IDataReader GetData (int i)
                {
                        throw new NotImplementedException ();
                }
+#endif
 
-               public string GetDataTypeName (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               string GetDataTypeName (int i)
                {
                        return dataTypeNames [i].ToString ().ToUpper ();
                }
 
-               public DateTime GetDateTime (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               DateTime GetDateTime (int i)
                {
                        IConvertible c = (IConvertible) GetValue (i);
                        return c.ToDateTime (CultureInfo.CurrentCulture);
                }
 
-               public decimal GetDecimal (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               decimal GetDecimal (int i)
                {
                        IConvertible c = (IConvertible) GetValue (i);
                        return c.ToDecimal (CultureInfo.CurrentCulture);
                }
 
-               public double GetDouble (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               double GetDouble (int i)
                {
                        IConvertible c = (IConvertible) GetValue (i);
                        return c.ToDouble (CultureInfo.CurrentCulture);
                }
 
-               public Type GetFieldType (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               Type GetFieldType (int i)
                {
                        OciDefineHandle defineHandle = (OciDefineHandle) statement.Values [i];
                        return defineHandle.FieldType;
                }
 
-               public float GetFloat (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               float GetFloat (int i)
                {
                        IConvertible c = (IConvertible) GetValue (i);
                        return c.ToSingle (CultureInfo.CurrentCulture);
                }
 
-               public Guid GetGuid (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               Guid GetGuid (int i)
                {
                        throw new NotSupportedException ();
                }
 
-               public short GetInt16 (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               short GetInt16 (int i)
                {
                        throw new NotSupportedException ();
                }
 
-               public int GetInt32 (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               int GetInt32 (int i)
                {
                        IConvertible c = (IConvertible) GetValue (i);
                        return c.ToInt32 (CultureInfo.CurrentCulture);
                }
 
-               public long GetInt64 (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               long GetInt64 (int i)
                {
                        IConvertible c = (IConvertible) GetValue (i);
                        return c.ToInt64 (CultureInfo.CurrentCulture);
                }
 
-               public string GetName (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               string GetName (int i)
                {
                        return statement.GetParameter (i).GetName ();
                }
@@ -291,8 +400,8 @@ namespace System.Data.OracleClient {
                        if (IsDBNull (i))
                                throw new InvalidOperationException("The value is null");
 
-                        OracleLob output = (OracleLob) ((OciDefineHandle) statement.Values [i]).GetValue (
-                                command.Connection.SessionFormatProvider);
+                       OracleLob output = (OracleLob) ((OciDefineHandle) statement.Values [i]).GetValue (
+                               command.Connection.SessionFormatProvider);
                        output.connection = command.Connection;
                        return output;
                }
@@ -381,7 +490,11 @@ namespace System.Data.OracleClient {
                        return new OracleTimeSpan (GetTimeSpan (i));
                }
 
-               public int GetOrdinal (string name)
+               public
+#if NET_2_0
+               override
+#endif
+               int GetOrdinal (string name)
                {
                        int i = GetOrdinalInternal (name);
                        if (i == -1)
@@ -411,7 +524,7 @@ namespace System.Data.OracleClient {
                        if (statementType == OciStatementType.Select)
                                return -1;
                        else {
-                               if (this.isClosed == false) {
+                               if (!isClosed) {
                                        if (recordsAffected == -1)
                                                if (statement != null)
                                                        recordsAffected = statement.GetAttributeInt32 (OciAttributeType.RowCount, command.ErrorHandle);
@@ -435,9 +548,9 @@ namespace System.Data.OracleClient {
                private StringCollection GetKeyColumns(string owner, string table) 
                {
                        OracleCommand cmd = command.Connection.CreateCommand ();
-                       
+
                        StringCollection columns = new StringCollection ();
-                                               
+
                        if (command.Transaction != null)
                                cmd.Transaction = command.Transaction;
 
@@ -478,15 +591,14 @@ namespace System.Data.OracleClient {
                        int i = 0;
                        bool bTableFound = false;
                
-                       for (; bEnd == false && i < chars.Length; i++) {
+                       for (; !bEnd && i < chars.Length; i++) {
                                char ch = chars[i];
                        
                                if (Char.IsLetter (ch)) {
                                        wb.Append (ch);
-                               }
-                               else if (Char.IsWhiteSpace (ch)) {
+                               } else if (Char.IsWhiteSpace (ch)) {
                                        if (wb.Length > 0) {
-                                               if (bFromFound == false) {
+                                               if (!bFromFound) {
                                                        string word = wb.ToString ().ToUpper ();
                                                        if (word.Equals ("FROM")) {
                                                                bFromFound = true;
@@ -494,8 +606,7 @@ namespace System.Data.OracleClient {
                                                        wb = null;
                                                        wb = new StringBuilder ();
                                                        bTableFound = false;
-                                               }
-                                               else {
+                                               } else {
                                                        switch (wb.ToString ().ToUpper ()) {
                                                        case "WHERE":
                                                        case "ORDER":
@@ -504,27 +615,25 @@ namespace System.Data.OracleClient {
                                                                bTableFound = false;
                                                                break;
                                                        default:
-                                                               if (bTableFound == true)
+                                                               if (bTableFound)
                                                                        bTableFound = false; // this is done in case of a table alias
                                                                else {
                                                                        bTableFound = true;
                                                                        tables.Add (wb.ToString ().ToUpper ());
                                                                }
                                                                wb = null;
-                                                               wb = new StringBuilder ();      
+                                                               wb = new StringBuilder ();
                                                                break;
                                                        }
                                                }
                                        }
-                               }
-                               else if (bFromFound == true) {
+                               } else if (bFromFound) {
                                        switch (ch) {
                                        case ',': 
-                                               if (bTableFound == true)
+                                               if (bTableFound)
                                                        bTableFound = false;
-                                               else {
+                                               else
                                                        tables.Add (wb.ToString ().ToUpper ());
-                                               }
                                                wb = null;
                                                wb = new StringBuilder ();
                                                break;
@@ -536,11 +645,11 @@ namespace System.Data.OracleClient {
                                        }
                                }
                        }
-                       if (bEnd == false) {
+                       if (!bEnd) {
                                if (wb.Length > 0) {
-                                       if (bFromFound == false && wb.ToString ().ToUpper ().Equals ("FROM"))
+                                       if (!bFromFound && wb.ToString ().ToUpper ().Equals ("FROM"))
                                                bFromFound = true;
-                                       if (bFromFound == true) {
+                                       if (bFromFound) {
                                                switch(wb.ToString ().ToUpper ()) {
                                                case "WHERE":
                                                case "ORDER":
@@ -548,9 +657,8 @@ namespace System.Data.OracleClient {
                                                        bEnd = true;
                                                        break;
                                                default:
-                                                       if (bTableFound == false) {
+                                                       if (!bTableFound)
                                                                tables.Add (wb.ToString ().ToUpper ());
-                                                       }
                                                        break;
                                                }
                                        }
@@ -574,15 +682,18 @@ namespace System.Data.OracleClient {
                                name = objectName;
                                cmd.Dispose();
                                cmd = null;
-                       }
-                       else {
+                       } else {
                                owner = objectName.Substring (0, idx);
                                name = objectName.Substring (idx + 1);
                        }
                }
 
                [MonoTODO("Implement this properly, with all needed information.")]
-               public DataTable GetSchemaTable ()
+               public
+#if NET_2_0
+               override
+#endif
+               DataTable GetSchemaTable ()
                {
                        StringCollection keyinfo = null;
 
@@ -636,8 +747,7 @@ namespace System.Data.OracleClient {
                                        row ["BaseSchemaName"]  = owner;
                                        row ["BaseTableName"]   = table;
                                        row ["BaseColumnName"]  = row ["ColumnName"];
-                               }       
-                               else {
+                               } else {
                                        row ["IsKey"]           = DBNull.Value; 
                                        row ["IsUnique"]        = DBNull.Value; 
                                        row ["BaseSchemaName"]  = DBNull.Value; 
@@ -651,23 +761,25 @@ namespace System.Data.OracleClient {
                        return schemaTable;
                }
 
-               public string GetString (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               string GetString (int i)
                {
-                       object value = GetValue (i);
-                       if (!(value is string))
-                               throw new InvalidCastException ();
-                       return (string) value;
+                       return (string) GetValue (i);
                }
 
                public TimeSpan GetTimeSpan (int i)
                {
-                       object value = GetValue (i);
-                       if (!(value is TimeSpan))
-                               throw new InvalidCastException ();
-                       return (TimeSpan) value;
+                       return (TimeSpan) GetValue (i);
                }
 
-               public object GetValue (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               object GetValue (int i)
                {
                        OciDefineHandle defineHandle = (OciDefineHandle) statement.Values [i];
 
@@ -682,11 +794,15 @@ namespace System.Data.OracleClient {
                                lob.Close ();
                                return value;
                        default:
-                                return defineHandle.GetValue (command.Connection.SessionFormatProvider);
+                               return defineHandle.GetValue (command.Connection.SessionFormatProvider);
                        }
                }
 
-               public int GetValues (object[] values)
+               public
+#if NET_2_0
+               override
+#endif
+               int GetValues (object [] values)
                {
                        int len = values.Length;
                        int count = statement.ColumnCount;
@@ -703,25 +819,41 @@ namespace System.Data.OracleClient {
                        return retval;
                }
 
+#if NET_2_0
+               public override IEnumerator GetEnumerator ()
+#else
                IEnumerator IEnumerable.GetEnumerator ()
+#endif
                {
                        return new DbEnumerator (this);
                }
 
-               public bool IsDBNull (int i)
+               public
+#if NET_2_0
+               override
+#endif
+               bool IsDBNull (int i)
                {
                        OciDefineHandle defineHandle = (OciDefineHandle) statement.Values [i];
                        return defineHandle.IsNull;
                }
 
                [MonoTODO]
-               public bool NextResult ()
+               public
+#if NET_2_0
+               override
+#endif
+               bool NextResult ()
                {
                        // FIXME: get next result
                        return false; 
                }
 
-               public bool Read ()
+               public
+#if NET_2_0
+               override
+#endif
+               bool Read ()
                {
                        if (hasRows) {
                                bool retval = statement.Fetch ();
@@ -731,6 +863,26 @@ namespace System.Data.OracleClient {
                        return false;
                }
 
+#if NET_2_0
+               [MonoTODO]
+               public override Type GetProviderSpecificFieldType (int i)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override object GetProviderSpecificValue (int i)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public override int GetProviderSpecificValues (object [] values)
+               {
+                       throw new NotImplementedException ();
+               }
+#endif
+
                #endregion // Methods
        }
 }
index 32900220dd36faa3b08cd594f613824a932a8664..59e7a0147c303e8239eefb88eec8a12ff96b1d38 100644 (file)
@@ -20,7 +20,8 @@ using System.Data.SqlTypes;
 using System.IO;
 using System.Text;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        public sealed class OracleLob : Stream, ICloneable, IDisposable, INullable
        {
                #region Fields
@@ -28,14 +29,14 @@ namespace System.Data.OracleClient {
                public static readonly new OracleLob Null = new OracleLob ();
 
                internal OracleConnection connection;
-               bool isBatched = false;
+               bool isBatched;
                bool isOpen = true;
-               bool notNull = false;
+               bool notNull;
                OciLobLocator locator;
                OracleType type;
 
                long length = -1;
-               long position = 0;
+               long position;
 
                #endregion // Fields
 
@@ -78,7 +79,7 @@ namespace System.Data.OracleClient {
 
                public int ChunkSize {
                        [MonoTODO]
-                       get { 
+                       get {
                                AssertConnectionIsOpen ();
                                AssertObjectNotDisposed ();
                                return locator.GetChunkSize ();
@@ -98,7 +99,7 @@ namespace System.Data.OracleClient {
                }
 
                public bool IsTemporary {
-                       get { 
+                       get {
                                AssertConnectionIsOpen ();
                                AssertObjectNotDisposed ();
                                throw new NotImplementedException ();
@@ -106,7 +107,7 @@ namespace System.Data.OracleClient {
                }
 
                public override long Length {
-                       get { 
+                       get {
                                AssertConnectionIsOpen ();
                                AssertObjectNotDisposed ();
                                if (length >= 0)
@@ -124,7 +125,7 @@ namespace System.Data.OracleClient {
                }
 
                public override long Position {
-                       get { 
+                       get {
                                AssertConnectionIsOpen ();
                                AssertObjectNotDisposed ();
                                return position;
@@ -137,7 +138,7 @@ namespace System.Data.OracleClient {
                }
 
                public object Value {
-                       get { 
+                       get {
                                AssertObjectNotDisposed ();
                                if (IsNull)
                                        return DBNull.Value;
@@ -148,7 +149,7 @@ namespace System.Data.OracleClient {
                                if (len == 0) {
                                        // LOB is not Null, but it is Empty
                                        if (LobType == OracleType.Clob)
-                                               return "";
+                                               return string.Empty;
                                        else // OracleType.Blob
                                                return new byte[0];
                                }
@@ -158,8 +159,7 @@ namespace System.Data.OracleClient {
                                        Read (buffer, 0, len);
                                        UnicodeEncoding encoding = new UnicodeEncoding ();
                                        return encoding.GetString (buffer);
-                               }
-                               else {
+                               } else {
                                        // OracleType.Blob
                                        buffer = new byte [len];
                                        Read (buffer, 0, len);
@@ -173,7 +173,7 @@ namespace System.Data.OracleClient {
                #region Methods
 
                [MonoTODO]
-               public void Append (OracleLob source) 
+               public void Append (OracleLob source)
                {
                        if (source.IsNull)
                                throw new ArgumentNullException ();
@@ -234,10 +234,31 @@ namespace System.Data.OracleClient {
                        throw new NotImplementedException ();
                }
 
+#if !NET_2_0
                [MonoTODO]
                public override void Close ()
                {
-                       locator.Dispose ();
+                       Dispose (true);
+               }
+
+               [MonoTODO]
+               public void Dispose ()
+               {
+                       this.Dispose (true);
+                       GC.SuppressFinalize (this);
+               }
+#endif
+
+#if NET_2_0
+               protected override
+#endif
+               void Dispose (bool disposing)
+               {
+                       if (disposing) {
+                               if (locator != null)
+                                       locator.Dispose ();
+                       }
+                       locator = null;
                        isOpen = false;
                }
 
@@ -265,12 +286,6 @@ namespace System.Data.OracleClient {
                        return (long) locator.Copy (destination.Locator, (uint) amount, (uint) destinationOffset + 1, (uint) sourceOffset + 1);
                }
 
-               [MonoTODO]
-               public void Dispose ()
-               {
-                       throw new NotImplementedException ();
-               }
-
                public void EndBatch ()
                {
                        AssertConnectionIsOpen ();
@@ -314,7 +329,7 @@ namespace System.Data.OracleClient {
                        AssertObjectNotDisposed ();
 
                        int bytesRead;
-                       byte[] output = new byte[count];
+                       byte[] output = new byte [count];
 
                        bytesRead = locator.Read (output, (uint) Position + 1, (uint) count, LobType == OracleType.Blob);
                        output.CopyTo (buffer, offset);
index 354acd0c9e39639d3ac48264f145150c978dbaa2..4c7afd5190ca1da680b85b97e5bf34d925af8450 100644 (file)
@@ -17,7 +17,8 @@
 using System;
 using System.Data.SqlTypes;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        public struct OracleMonthSpan : IComparable, INullable
        {
                #region Fields
@@ -194,9 +195,9 @@ namespace System.Data.OracleClient {
                        return x.value;
                }
 
-               public static explicit operator OracleMonthSpan (string s)
+               public static explicit operator OracleMonthSpan (string x)
                {
-                       return Parse (s);
+                       return Parse (x);
                }
 
                #endregion // Operators and Type Conversions
index 37234b65c47eb43087839b8437e63573778d20b2..d0a1726bdacb4ac34255d2514b21069384cca979 100644 (file)
@@ -23,15 +23,24 @@ using System;
 using System.Collections;
 using System.ComponentModel;
 using System.Data;
+#if NET_2_0
+using System.Data.Common;
+#endif
 using System.Data.SqlTypes;
 using System.Data.OracleClient.Oci;
 using System.Globalization;
 using System.Runtime.InteropServices;
 using System.Text;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        [TypeConverter (typeof(OracleParameter.OracleParameterConverter))]
-       public sealed class OracleParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+       public sealed class OracleParameter :
+#if NET_2_0
+               DbParameter, IDbDataParameter, ICloneable
+#else
+               MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable
+#endif
        {
                #region Fields
 
@@ -44,27 +53,30 @@ namespace System.Data.OracleClient {
                byte precision;
                byte scale;
                string srcColumn;
+#if NET_2_0
+               bool sourceColumnNullMapping;
+#endif
                DataRowVersion srcVersion;
                DbType dbType = DbType.AnsiString;
-               int offset = 0;
-               bool sizeSet = false;
+               int offset;
+               bool sizeSet;
                object value = DBNull.Value;
-               OciLobLocator lobLocator = null;  // only if Blob or Clob
+               OciLobLocator lobLocator;  // only if Blob or Clob
                IntPtr bindOutValue = IntPtr.Zero;
-               OciDateTimeDescriptor dateTimeDesc = null;
+               OciDateTimeDescriptor dateTimeDesc;
                IntPtr cursor = IntPtr.Zero;
 
-               OracleParameterCollection container = null;
+               OracleParameterCollection container;
                OciBindHandle bindHandle;
                //OciErrorHandle errorHandle;
                OracleConnection connection;
-               byte[] bytes = null;
+               byte[] bytes;
                IntPtr bindValue = IntPtr.Zero;
-               bool useRef = false;
+               bool useRef;
                OciDataType bindType;
 
-               short indicator = 0; // TODO: handle indicator to indicate NULL value for OUT parameters
-               int bindSize = 0;
+               short indicator; // TODO: handle indicator to indicate NULL value for OUT parameters
+               int bindSize;
                //uint position = 0;
 
                #endregion // Fields
@@ -72,7 +84,8 @@ namespace System.Data.OracleClient {
                #region Constructors
 
                // constructor for cloning the object
-               internal OracleParameter (OracleParameter value) {
+               internal OracleParameter (OracleParameter value)
+               {
                        this.name = value.name;
                        this.oracleType = value.oracleType;
                        this.ociType = value.ociType;
@@ -99,6 +112,7 @@ namespace System.Data.OracleClient {
                {
                        this.name = name;
                        this.value = value;
+                       srcColumn = string.Empty;
                        SourceVersion = DataRowVersion.Current;
                        InferOracleType (value);
                }
@@ -118,10 +132,26 @@ namespace System.Data.OracleClient {
                {
                }
 
+#if NET_2_0
+               public OracleParameter (string name, OracleType oracleType, int size, ParameterDirection direction, string sourceColumn, DataRowVersion sourceVersion, bool sourceColumnNullMapping, object value)
+               {
+                       this.name = name;
+                       if (size < 0)
+                               throw new ArgumentException("Size must be not be negative.");
+                       this.size = size;
+                       this.value = value;
+                       SourceColumnNullMapping = sourceColumnNullMapping;
+                       OracleType = oracleType;
+                       Direction = direction;
+                       SourceColumn = sourceColumn;
+                       SourceVersion = sourceVersion;
+               }
+#endif
+
                public OracleParameter (string name, OracleType oracleType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value)
                {
                        this.name = name;
-                       if(size < 0)
+                       if (size < 0)
                                throw new ArgumentException("Size must be not be negative.");
                        this.size = size;
                        this.value = value;
@@ -144,31 +174,53 @@ namespace System.Data.OracleClient {
                        set { container = value; }
                }
 
+#if !NET_2_0
                [Browsable (false)]
                [RefreshProperties (RefreshProperties.All)]
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
-               public DbType DbType {
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               DbType DbType {
                        get { return dbType; }
                        set { SetDbType (value); }
                }
 
+#if !NET_2_0
                [DefaultValue (ParameterDirection.Input)]
+#endif
                [RefreshProperties (RefreshProperties.All)]
-               public ParameterDirection Direction {
+               public
+#if NET_2_0
+               override
+#endif
+               ParameterDirection Direction {
                        get { return direction; }
                        set { direction = value; }
                }
 
+#if !NET_2_0
                [Browsable (false)]
                [DesignOnly (true)]
                [DefaultValue (false)]
                [EditorBrowsable (EditorBrowsableState.Never)]
-               public bool IsNullable {
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               bool IsNullable {
                        get { return isNullable; }
                        set { isNullable = value; }
                }
 
+#if NET_2_0
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+#else
                [DefaultValue (0)]
+#endif
                [Browsable (false)]
                public int Offset {
                        get { return offset; }
@@ -177,31 +229,62 @@ namespace System.Data.OracleClient {
 
                [DefaultValue (OracleType.VarChar)]
                [RefreshProperties (RefreshProperties.All)]
+#if NET_2_0
+               [DbProviderSpecificTypeProperty (true)]
+#endif
                public OracleType OracleType {
                        get { return oracleType; }
                        set { SetOracleType (value); }
                }
 
+#if !NET_2_0
                [DefaultValue ("")]
-               public string ParameterName {
-                       get { return name; }
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               string ParameterName {
+                       get {
+                               if (name == null)
+                                       return string.Empty;
+                               return name;
+                       }
                        set { name = value; }
                }
 
+#if NET_2_0
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               [Obsolete("Set the precision of a decimal use the Math classes.")]
+#else
                [DefaultValue (0)]
+#endif
                public byte Precision {
                        get { return precision; }
                        set { /* NO EFFECT*/ }
                }
 
+#if NET_2_0
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               [Obsolete("Set the precision of a decimal use the Math classes.")]
+#else
                [DefaultValue (0)]
+#endif
                public byte Scale {
                        get { return scale; }
                        set { /* NO EFFECT*/ }
                }
 
+#if !NET_2_0
                [DefaultValue (0)]
-               public int Size {
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               int Size {
                        get { return size; }
                        set {
                                sizeSet = true;
@@ -209,27 +292,53 @@ namespace System.Data.OracleClient {
                        }
                }
 
+#if !NET_2_0
                [DefaultValue ("")]
-               public string SourceColumn {
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               string SourceColumn {
                        get { return srcColumn; }
                        set { srcColumn = value; }
                }
 
+#if NET_2_0
+               [MonoTODO]
+               public override bool SourceColumnNullMapping {
+                       get { return sourceColumnNullMapping; }
+                       set { sourceColumnNullMapping = value; }
+               }
+#endif
+
+#if !NET_2_0
                [DefaultValue ("Current")]
-               public DataRowVersion SourceVersion {
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               DataRowVersion SourceVersion {
                        get { return srcVersion; }
                        set { srcVersion = value; }
                }
 
+#if !NET_2_0
                [DefaultValue (null)]
+#endif
                [RefreshProperties (RefreshProperties.All)]
                [TypeConverter (typeof(StringConverter))]
                [MonoTODO("InferOracleType is not always needed")]
-               public object Value {
+               public
+#if NET_2_0
+               override
+#endif
+               object Value {
                        get { return this.value; }
                        set {
                                this.value = value;
-                               InferOracleType(value);
+                               InferOracleType (value);
                        }
                }
 
@@ -489,13 +598,13 @@ namespace System.Data.OracleClient {
                                         || oracleType == OracleType.Int16
                                         || oracleType == OracleType.Byte
                                         || oracleType == OracleType.Float) {
-                                        string svalue = null;
-                                        if(v is IFormattable)
-                                                svalue = ((IFormattable)v).ToString (null, con.SessionFormatProvider);
-                                        else if (v is OracleNumber)
-                                                                                       svalue = ((OracleNumber)v).ToString(con.SessionFormatProvider);
-                                                                               else
-                                                svalue = v.ToString();
+                                       string svalue = null;
+                                       if(v is IFormattable)
+                                               svalue = ((IFormattable)v).ToString (null, con.SessionFormatProvider);
+                                       else if (v is OracleNumber)
+                                               svalue = ((OracleNumber)v).ToString(con.SessionFormatProvider);
+                                       else
+                                               svalue = v.ToString();
                                        rsize = 0;
 
                                        // Get size of buffer
@@ -506,9 +615,8 @@ namespace System.Data.OracleClient {
                                        OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
 
                                        bindType = OciDataType.VarChar2;
-                                        bindSize = svalue.Length;
-                               }
-                               else {
+                                       bindSize = svalue.Length;
+                               } else {
                                        string svalue = v.ToString () + '\0';
                                        rsize = 0;
 
@@ -520,7 +628,7 @@ namespace System.Data.OracleClient {
                                        OciCalls.OCIUnicodeToCharSet (statement.Parent, bytes, svalue, out rsize);
 
                                        bindType = OciDataType.String;
-                                        bindSize = svalue.Length;
+                                       bindSize = svalue.Length;
                                }
                        }
 
@@ -787,12 +895,11 @@ namespace System.Data.OracleClient {
                                throw new ArgumentException (exception);
                        }
                        dbType = type;
-
                }
 
                private void SetOracleType (OracleType type)
                {
-                        FreeHandle ();
+                       FreeHandle ();
                        string exception = String.Format ("No mapping exists from OracleType {0} to a known DbType.", type);
                        switch (type) {
                        case OracleType.BFile:
@@ -890,6 +997,18 @@ namespace System.Data.OracleClient {
                        oracleType = type;
                }
 
+#if NET_2_0
+               public override void ResetDbType ()
+               {
+                       ResetOracleType ();
+               }
+
+               public void ResetOracleType ()
+               {
+                       InferOracleType (value);
+               }
+#endif // NET_2_0
+
                public override string ToString ()
                {
                        return ParameterName;
@@ -933,7 +1052,7 @@ namespace System.Data.OracleClient {
                        case OciDataType.Float:
                                tmp = Marshal.PtrToStringAnsi (bindOutValue, bindSize);
                                if (tmp != null)
-                                        value = Decimal.Parse (String.Copy ((string) tmp), cmd.Connection.SessionFormatProvider);
+                                       value = Decimal.Parse (String.Copy ((string) tmp), cmd.Connection.SessionFormatProvider);
                                break;
                        case OciDataType.TimeStamp:
                                value = dateTimeDesc.GetDateTime (connection.Environment, dateTimeDesc.ErrorHandle);
@@ -971,7 +1090,7 @@ namespace System.Data.OracleClient {
                        FreeHandle ();
                }
 
-                internal void FreeHandle ()
+               internal void FreeHandle ()
                {
                        switch (ociType) {
                        case OciDataType.Clob:
@@ -981,11 +1100,11 @@ namespace System.Data.OracleClient {
                        case OciDataType.Raw:
                                Marshal.FreeHGlobal (bindValue);
                                break;
-                        case OciDataType.TimeStamp:
-                                break;
-                        default:
-                                Marshal.FreeHGlobal (bindOutValue);
-                                break;
+                       case OciDataType.TimeStamp:
+                               break;
+                       default:
+                               Marshal.FreeHGlobal (bindOutValue);
+                               break;
                        }
 
                        bindOutValue = IntPtr.Zero;
@@ -1054,4 +1173,3 @@ namespace System.Data.OracleClient {
                }
        }
 }
-
index 230d3a7c230ba306a8a2397884567b80bc6d2d40..3794f8d5a9cc362fcebb082af4321e94ca17a4c2 100644 (file)
@@ -19,30 +19,33 @@ using System;
 using System.Collections;
 using System.ComponentModel;
 using System.Data;
+#if NET_2_0
+using System.Data.Common;
+#endif
 using System.Data.OracleClient.Oci;
 using System.Drawing.Design;
+using System.Globalization;
 using System.Reflection;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        [ListBindable (false)]
        [Editor ("Microsoft.VSDesigner.Data.Design.DBParametersEditor, " + Consts.AssemblyMicrosoft_VSDesigner, typeof(UITypeEditor))]
-       public sealed class OracleParameterCollection : MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
+       public sealed class OracleParameterCollection :
+#if NET_2_0
+               DbParameterCollection
+#else
+               MarshalByRefObject, IDataParameterCollection, IList, ICollection, IEnumerable
+#endif
        {
                #region Fields
 
-               //OracleCommand command;
-               ArrayList list;
+               readonly ArrayList list;
 
                #endregion // Fields
 
                #region Constructors
 
-               internal OracleParameterCollection (OracleCommand command)
-                       : this ()
-               {
-                       //this.command = command;
-               }
-
                public OracleParameterCollection ()
                {
                        list = new ArrayList ();
@@ -52,73 +55,114 @@ namespace System.Data.OracleClient {
 
                #region Properties
 
-               public int Count {
+               public
+#if NET_2_0
+               override
+#endif
+               int Count {
                        get { return list.Count; }
                }
 
-               public bool IsFixedSize {
+               public
+#if NET_2_0
+               override
+#endif
+               bool IsFixedSize {
                        get { return list.IsFixedSize; }
                }
 
-               public bool IsReadOnly {
+               public
+#if NET_2_0
+               override
+#endif
+               bool IsReadOnly {
                        get { return list.IsReadOnly; }
                }
 
-               public bool IsSynchronized {
+               public
+#if NET_2_0
+               override
+#endif
+               bool IsSynchronized {
                        get { return list.IsSynchronized; }
                }
 
-               public OracleParameter this [string parameterName] {
+               public
+#if NET_2_0
+               new
+#endif
+               OracleParameter this [string parameterName] {
                        get {
-                               foreach (OracleParameter p in list)
-                                       if (p.ParameterName.Equals (parameterName))
-                                               return p;
-                               throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
+                               return (OracleParameter) GetParameter (parameterName);
                        }
                        set {
-                               if (!Contains (parameterName))
-                                       throw new IndexOutOfRangeException ("The specified name does not exist: " + parameterName);
-                               this [IndexOf (parameterName)] = value;
+                               SetParameter (parameterName, value);
                        }
                }
 
-               object IList.this [int index] {
-                       get { return (OracleParameter) this [index]; }
-                       set { this [index] = (OracleParameter) value; }
+               public
+#if NET_2_0
+               override
+#endif
+               object SyncRoot {
+                       get { return this; }
+               }
+
+               public
+#if NET_2_0
+               new
+#endif
+               OracleParameter this [int index]
+               {
+                       get {
+                               return (OracleParameter) GetParameter (index);
+                       }
+                       set {
+                               SetParameter (index, value);
+                       }
                }
 
-               public OracleParameter this [int index] {
-                       get { return (OracleParameter) list [index]; }
-                       set { list [index] = value; }
+#if !NET_2_0
+               object IList.this [int index] {
+                       get { return this [index]; }
+                       set { this [index] = (OracleParameter) value; }
                }
 
-               object IDataParameterCollection.this [string parameterName] {
-                       get { return this [parameterName]; }
+               object IDataParameterCollection.this [string index] {
+                       get { return this [index]; }
                        set {
                                if (!(value is OracleParameter))
                                        throw new InvalidCastException ("The parameter was not an OracleParameter.");
-                               this [parameterName] = (OracleParameter) value;
+                               this [index] = (OracleParameter) value;
                        }
                }
-
-               public object SyncRoot {
-                       get { return this; }
-               }
+#endif
 
                #endregion // Properties
 
                #region Methods
 
-               public int Add (object value)
+#if NET_2_0
+               [EditorBrowsable (EditorBrowsableState.Never)]
+#endif
+               public
+#if NET_2_0
+               override
+#endif
+               int Add (object value)
                {
-                       if (!(value is OracleParameter))
-                               throw new InvalidCastException ("The parameter was not an OracleParameter.");
+                       AssertParameterValid (value);
+
                        Add ((OracleParameter) value);
                        return IndexOf (value);
                }
 
                public OracleParameter Add (OracleParameter value)
                {
+#if NET_2_0
+                       if (value == null)
+                               throw CreateParameterNullException ();
+#endif
                        if (value.Container != null)
                                throw new ArgumentException ("The OracleParameter specified in the value parameter is already added to this or another OracleParameterCollection.");
                        value.Container = this;
@@ -146,73 +190,397 @@ namespace System.Data.OracleClient {
                        return Add (new OracleParameter (parameterName, dataType, size, srcColumn));
                }
 
-               public void Clear ()
+#if NET_2_0
+               public override void AddRange (Array values)
+               {
+                       if (values == null)
+                               throw new ArgumentNullException ("values");
+
+                       foreach (object param in values)
+                               AssertParameterValid (param);
+
+                       foreach (OracleParameter param in values)
+                               Add (param);
+               }
+
+               public void AddRange (OracleParameter [] values)
                {
+                       if (values == null)
+                               throw new ArgumentNullException ("values");
+
+                       foreach (OracleParameter param in values)
+                               if (param == null)
+                                       throw CreateParameterNullException ();
+
+                       foreach (OracleParameter param in values)
+                               Add (param);
+               }
+#endif
+
+               public
+#if NET_2_0
+               override
+#endif
+               void Clear ()
+               {
+                       foreach (OracleParameter param in list)
+                               param.Container = null;
                        list.Clear ();
                }
 
-               public bool Contains (object value)
+               public
+#if NET_2_0
+               override
+#endif
+               bool Contains (object value)
+               {
+                       return (IndexOf (value) != -1);
+               }
+
+#if NET_2_0
+               public bool Contains (OracleParameter value)
                {
-                       if (!(value is OracleParameter))
-                               throw new InvalidCastException ("The parameter was not an OracleParameter.");
-                       return Contains (((OracleParameter) value).ParameterName);
+                       return (IndexOf (value) != -1);
                }
+#endif
 
-               public bool Contains (string parameterName)
+               public
+#if NET_2_0
+               override
+#endif
+               bool Contains (string parameterName)
                {
-                       foreach (OracleParameter p in list)
-                               if (p.ParameterName.Equals (parameterName))
-                                       return true;
-                       return false;
+                       return (IndexOf (parameterName) != -1);
                }
 
-               public void CopyTo (Array array, int index)
+               public
+#if NET_2_0
+               override
+#endif
+               void CopyTo (Array array, int index)
                {
                        list.CopyTo (array, index);
                }
 
-               public IEnumerator GetEnumerator ()
+               public
+#if NET_2_0
+               override
+#endif
+               IEnumerator GetEnumerator ()
                {
                        return list.GetEnumerator ();
                }
 
-               public int IndexOf (object value)
+#if NET_2_0
+               protected override DbParameter GetParameter (int index)
+#else
+               object GetParameter (int index)
+#endif
+               {
+                       AssertIndex (index);
+                       return (OracleParameter) list [index];
+               }
+
+#if NET_2_0
+               protected override DbParameter GetParameter (string parameterName)
+#else
+               object GetParameter (string parameterName)
+#endif
                {
-                       if (!(value is OracleParameter))
-                               throw new InvalidCastException ("The parameter was not an OracleParameter.");
-                       return IndexOf (((OracleParameter) value).ParameterName);
+                       int index = IndexOf (parameterName);
+                       if (index == -1)
+                               throw ParameterNotFoundException (parameterName, index);
+                       return (OracleParameter) list [index];
                }
 
-               public int IndexOf (string parameterName)
+#if NET_2_0
+               protected override void SetParameter (int index, DbParameter value)
+#else
+               void SetParameter (int index, IDbDataParameter value)
+#endif
                {
+                       AssertIndex (index);
+                       AssertParameterValid (value);
+
+                       OracleParameter new_value = (OracleParameter) value;
+                       OracleParameter old_value = (OracleParameter) list [index];
+
+#if !NET_2_0
+                       old_value.Container = null;
+#endif
+
+                       if (new_value.Container != null) {
+                               if (new_value.Container != this)
+                                       throw ParameterAlreadyOwnedException ();
+                               if (IndexOf (new_value) != index)
+                                       throw ParameterAlreadyOwnedException ();
+                       }
+
+                       list [index] = new_value;
+                       new_value.Container = this;
+#if NET_2_0
+                       old_value.Container = null;
+#endif
+               }
+
+#if NET_2_0
+               protected override void SetParameter (string parameterName, DbParameter value)
+#else
+               void SetParameter (string parameterName, IDbDataParameter value)
+#endif
+               {
+                       int index = IndexOf (parameterName);
+                       if (index == -1)
+                               throw ParameterNotFoundException (parameterName, index);
+
+                       AssertParameterValid (value);
+
+                       OracleParameter new_value = (OracleParameter) value;
+                       OracleParameter old_value = (OracleParameter) list [index];
+
+#if !NET_2_0
+                       old_value.Container = null;
+#endif
+
+                       if (new_value.Container != null) {
+                               if (new_value.Container != this)
+                                       throw ParameterAlreadyOwnedException ();
+                               if (IndexOf (new_value) != index)
+                                       throw ParameterAlreadyOwnedException ();
+                       }
+
+                       list [index] = new_value;
+                       new_value.Container = this;
+#if NET_2_0
+                       old_value.Container = null;
+#endif
+               }
+
+               public
+#if NET_2_0
+               override
+#endif
+               int IndexOf (object value)
+               {
+                       if (value != null)
+                               AssertParameterValid (value);
+
                        for (int i = 0; i < Count; i += 1)
-                               if (this [i].ParameterName.Equals (parameterName))
+                               if (list [i] == value)
                                        return i;
                        return -1;
                }
 
-               public void Insert (int index, object value)
+#if NET_2_0
+               public int IndexOf (OracleParameter value)
                {
-                       if (!(value is OracleParameter))
-                               throw new InvalidCastException ("The parameter was not an OracleParameter.");
-                       list.Insert (index, value);
+                       for (int i = 0; i < Count; i += 1)
+                               if (list [i] == value)
+                                       return i;
+                       return -1;
+               }
+#endif
+
+               public
+#if NET_2_0
+               override
+#endif
+               int IndexOf (string parameterName)
+               {
+#if NET_2_0
+                       // case-sensitive lookup
+                       for (int i = 0; i < Count; i += 1) {
+                               OracleParameter param = (OracleParameter) list [i];
+                               if (string.Compare (param.ParameterName, parameterName, false, CultureInfo.CurrentCulture) == 0)
+                                       return i;
+                       }
+#endif
+
+                       // case-insensitive lookup
+                       for (int i = 0; i < Count; i += 1) {
+                               OracleParameter param = (OracleParameter) list [i];
+                               if (string.Compare (param.ParameterName, parameterName, true, CultureInfo.CurrentCulture) == 0)
+                                       return i;
+                       }
+
+                       return -1;
+               }
+
+               public
+#if NET_2_0
+               override
+#endif
+               void Insert (int index, object value)
+               {
+                       AssertParameterValid (value);
+
+                       OracleParameter new_value = (OracleParameter) value;
+
+                       if (new_value.Container != null) {
+                               if (new_value.Container != this)
+                                       throw ParameterAlreadyOwnedException ();
+                               if (IndexOf (value) != -1)
+                                       throw ParameterAlreadyOwnedException ();
+                       }
+
+                       list.Insert (index, new_value);
+                       new_value.Container = this;
+               }
+
+#if NET_2_0
+               public void Insert (int index, OracleParameter value)
+               {
+                       Insert (index, (object) value);
+               }
+#endif
+
+               public
+#if NET_2_0
+               override
+#endif
+               void Remove (object value)
+               {
+                       AssertParameterValid (value);
+
+                       int index = IndexOf (value);
+                       if (index == -1)
+                               throw ParameterNotOwnedException ();
+
+                       ((OracleParameter) value).Container = null;
+                       list.RemoveAt (index);
                }
 
-               public void Remove (object value)
+#if NET_2_0
+               public void Remove (OracleParameter value)
                {
-                       if (!(value is OracleParameter))
-                               throw new InvalidCastException ("The parameter was not an OracleParameter.");
-                       list.Remove (value);
+                       if (value == null)
+                               throw CreateParameterNullException ();
+
+                       int index = IndexOf (value);
+                       if (index == -1)
+                               throw ParameterNotOwnedException ();
+
+                       value.Container = null;
+                       list.RemoveAt (index);
+               }
+#endif
+
+               public
+#if NET_2_0
+               override
+#endif
+               void RemoveAt (int index)
+               {
+                       AssertIndex (index);
+
+                       OracleParameter param = (OracleParameter) list [index];
+                       param.Container = null;
+                       list.RemoveAt (index);
                }
 
-               public void RemoveAt (int index)
+               public
+#if NET_2_0
+               override
+#endif
+               void RemoveAt (string parameterName)
                {
+                       int index = IndexOf (parameterName);
+                       if (index == -1)
+                               throw ParameterNotOwnedException (parameterName);
+
+                       OracleParameter param = (OracleParameter) list [index];
+                       param.Container = null;
                        list.RemoveAt (index);
                }
 
-               public void RemoveAt (string parameterName)
+               static void AssertParameterValid (object value)
+               {
+                       if (value == null)
+                               throw CreateParameterNullException ();
+
+                       if (value is OracleParameter)
+                               return;
+
+                       string msg = string.Format (CultureInfo.InvariantCulture,
+#if NET_2_0
+                               "Only non-null {0} instances are valid for " +
+                               "the {1}, not {2} instances.",
+                               typeof (OracleParameter).Name,
+                               typeof (OracleParameterCollection).Name,
+                               value.GetType ().Name);
+#else
+                               "Value is not {0}.",
+                               typeof (OracleParameter).Name);
+#endif
+                       throw new InvalidCastException (msg);
+               }
+
+               static Exception CreateParameterNullException ()
+               {
+#if NET_2_0
+                       string msg = string.Format (CultureInfo.InvariantCulture,
+                               "Only non-null {0} instances are valid for " +
+                               "{1}.", typeof (OracleParameter).Name,
+                               typeof (OracleParameterCollection).Name);
+                       return new ArgumentNullException ("value", msg);
+#else
+                       return new ArgumentNullException ("value");
+#endif
+               }
+
+               static Exception ParameterAlreadyOwnedException ()
+               {
+                       string msg = string.Format (CultureInfo.InvariantCulture,
+                               "The specified {0} is already owned by this " +
+                               "or another {1}.", typeof (OracleParameter).Name,
+                               typeof (OracleParameterCollection).Name);
+                       throw new ArgumentException (msg);
+               }
+
+               Exception ParameterNotFoundException (string name, int index)
+               {
+                       string msg = string.Format (CultureInfo.InvariantCulture,
+#if NET_2_0
+                               "Index {0} is not valid for this {1}.",
+                               index, typeof (OracleParameterCollection).Name);
+#else
+                               "Parameter '{0}' not found.", name);
+#endif
+                       throw new IndexOutOfRangeException (msg);
+               }
+
+               Exception ParameterNotOwnedException ()
+               {
+                       throw new ArgumentException (string.Format (
+                               CultureInfo.InvariantCulture,
+                               "An {0} instance that is not contained " +
+                               "by this {1} cannot be removed.",
+                               typeof (OracleParameter).Name,
+                               this.GetType ().Name));
+               }
+
+               Exception ParameterNotOwnedException (string name)
+               {
+#if NET_2_0
+                       throw new IndexOutOfRangeException (string.Format (
+                               CultureInfo.InvariantCulture,
+                               "{0} parameter '{1}' is not contained by " +
+                               "this {2}.", typeof (OracleParameter).Name,
+                               name, this.GetType ().Name));
+#else
+                       throw new IndexOutOfRangeException (string.Format (
+                               CultureInfo.InvariantCulture,
+                               "Parameter '{0}' does not exist.", name));
+#endif
+               }
+
+               void AssertIndex (int index)
                {
-                       list.RemoveAt (IndexOf (parameterName));
+                       if (index < 0 || index >= Count)
+                               throw new IndexOutOfRangeException (string.Format (
+                                       CultureInfo.InvariantCulture, "Index {0} " +
+                                       "is not valid for this {1}.", index,
+                                       typeof (OracleParameterCollection).Name));
                }
 
                #endregion // Methods
index fe3fd0a3927829a3ab96ea3392562fe908955b60..1b32f855782972b4bbcb4c3ccff8f978d45dc143 100644 (file)
@@ -24,7 +24,8 @@ using System;
 using System.Data;
 using System.Data.Common;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        public sealed class OracleRowUpdatingEventArgs : RowUpdatingEventArgs
        {
                #region Constructors
@@ -38,6 +39,17 @@ namespace System.Data.OracleClient {
 
                #region Properties
 
+#if NET_2_0
+               protected override IDbCommand BaseCommand {
+                       get {
+                               return base.BaseCommand;
+                       }
+                       set {
+                               base.BaseCommand = value;
+                       }
+               }
+#endif
+
                public new OracleCommand Command {
                        get { return (OracleCommand) base.Command; }
                        set { base.Command = value; }
index edb7bb5bbb9df2ea8ef161e551d4e98e4abdee97..bf61b4826cb7c0ca3217a60e102956b2f4daef6c 100644 (file)
@@ -17,7 +17,8 @@
 using System;
 using System.Data.SqlTypes;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        public struct OracleTimeSpan : IComparable, INullable
        {
                #region Fields
@@ -26,7 +27,7 @@ namespace System.Data.OracleClient {
                public static readonly OracleTimeSpan MinValue = new OracleTimeSpan (TimeSpan.MinValue);
                public static readonly OracleTimeSpan Null = new OracleTimeSpan ();
 
-               bool notNull; 
+               bool notNull;
                TimeSpan value;
 
                #endregion // Fields
@@ -39,8 +40,11 @@ namespace System.Data.OracleClient {
                }
 
                public OracleTimeSpan (OracleTimeSpan from)
-                       : this (from.Value)
                {
+                       if (from.IsNull)
+                               throw new NullReferenceException ();
+                       value = from.value;
+                       notNull = true;
                }
 
                public OracleTimeSpan (TimeSpan ts)
@@ -73,7 +77,7 @@ namespace System.Data.OracleClient {
                }
 
                public int Hours {
-                       get { return Value.Days; }
+                       get { return Value.Hours; }
                }
 
                public bool IsNull {
@@ -93,7 +97,11 @@ namespace System.Data.OracleClient {
                }
 
                public TimeSpan Value {
-                       get { return value; }
+                       get {
+                               if (IsNull)
+                                       throw CreateValueNullException ();
+                               return value;
+                       }
                }
 
                #endregion // Properties
@@ -188,6 +196,11 @@ namespace System.Data.OracleClient {
                        return value.ToString ();
                }
 
+               static Exception CreateValueNullException ()
+               {
+                       return new InvalidOperationException ("The value is Null");
+               }
+
                #endregion // Methods
 
                #region Operators and Type Conversions
@@ -227,9 +240,9 @@ namespace System.Data.OracleClient {
                        return x.Value;
                }
 
-               public static explicit operator OracleTimeSpan (string s)
+               public static explicit operator OracleTimeSpan (string x)
                {
-                       return Parse (s);
+                       return Parse (x);
                }
 
                #endregion // Operators and Type Conversions
index ea045feca8d36833d5fe9dcfd8d9eb386db47578..77a4af6f8315b44cad014961640299d77a4f9935 100644 (file)
@@ -19,10 +19,11 @@ using System.ComponentModel;
 using System.Data;
 using System.Data.OracleClient.Oci;
 
-namespace System.Data.OracleClient {
+namespace System.Data.OracleClient
+{
        public sealed class OracleTransaction :
-#if NET_2_0    
-       Common.DbTransaction, IDbTransaction, IDisposable
+#if NET_2_0
+       Common.DbTransaction
 #else
        MarshalByRefObject, IDbTransaction, IDisposable
 #endif
@@ -55,14 +56,18 @@ namespace System.Data.OracleClient {
                        get { return isOpen; }
                }
 
-               public OracleConnection Connection {
+               public
+#if NET_2_0
+               new
+#endif
+               OracleConnection Connection {
                        get { return connection; }
                }
                
 #if NET_2_0
                [MonoTODO]
                protected override Common.DbConnection DbConnection {
-                       get { return null; }
+                       get { return Connection; }
                }
 #endif
 
@@ -74,9 +79,11 @@ namespace System.Data.OracleClient {
                        get { return isolationLevel; }
                }
 
+#if !NET_2_0
                IDbConnection IDbTransaction.Connection {
                        get { return Connection; }
                }
+#endif
 
                #endregion // Properties
 
@@ -98,7 +105,10 @@ namespace System.Data.OracleClient {
                        isOpen = false;
                }
 
-               private void Dispose (bool disposing)
+#if NET_2_0
+               protected override
+#endif
+               void Dispose (bool disposing)
                {
                        if (!disposed) {
                                if (disposing) {
@@ -111,11 +121,13 @@ namespace System.Data.OracleClient {
                        }
                }
 
+#if !NET_2_0
                public void Dispose ()
                {
                        Dispose (true);
                        GC.SuppressFinalize (this);
                }
+#endif
 
                public
 #if NET_2_0
index b2198e64dea9367d2e7f91f982e41ccc667da239..d89e1f854912ddb986fa5c5d6c53e52fe5742e2a 100755 (executable)
@@ -1,8 +1,11 @@
 System.Data.OracleClient/OraclePermissionAttributeTest.cs
 System.Data.OracleClient/OracleCommandTest.cs
+System.Data.OracleClient/OracleConnectionTest.cs
+System.Data.OracleClient/OracleDataAdapterTest.cs
 System.Data.OracleClient/OracleParameterTest.cs
 System.Data.OracleClient/OracleLobTest.cs
 System.Data.OracleClient/OracleParameterCollectionTest.cs
+System.Data.OracleClient/OracleTimeSpanTest.cs
 System.Data.OracleClient.Oci/OciDefineHandleTest.cs
 System.Data.OracleClient.jvm/MonoTests.System.Data.Utils/ADONetTesterClass.cs
 System.Data.OracleClient.jvm/MonoTests.System.Data.Utils/ConnectedDataProvider.cs
index 0f0ef4c9da2cc91c85cfe90c8c3de85d1b2bbff1..7aeaf5be0db863acdc08a8bff0774f99d4209754 100644 (file)
@@ -1,3 +1,17 @@
+2008-05-07  Gert Driesen  <drieseng@users.sourceforge.net>
+
+       * OracleDataAdapterTest.cs: Added ctor and basic property tests.
+       * OracleParameterCollectionTest.cs: Added tests for Clear,Count,Add,
+       Add,AddRange,Contains,indexers,IndexOf,Insert,Remove and RemoveAt.
+       * OracleCommandTest.cs: Added tests for ctors and CommandText,
+       CommandTimeout, ConnectionTimeout and Connection.
+       * OracleConnectionTest.cs: Added tests for ConnectionString and
+       ConnectionTimeout.
+       * OracleParameterTest.cs: Allow for disconnected tests. Added basic
+       ctor tests and test for ParameterName.
+       * OracleTimeSpanTest.cs: Added ctor tests. Added tests for IsNull,
+       MaxValue, MinValue, Null and ToString.
+
 2007-05-25 Amit Biswas <amit@amitbiswas.com>
 
        * OracleParameterCollectionTest.cs: Created the class OracleParameterCollectionTest and added
index 27caeb8330cd959b03b1f9c49aee5541f5013d48..7e4904d163b477788a19e889c6a863c799d70b82 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using NUnit.Framework;
-using System.Data.OracleClient;
-using System.Data;
 using System;
+using System.Data;
+using System.Data.OracleClient;
+using System.Data.SqlClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.OracleClient
+{
+       [TestFixture]
+       public class OracleCommandTest
+       {
+               const string COMMAND_TEXT = "SELECT * FROM dual";
+
+               OracleCommand command;
+               IDbCommand interface_command;
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       command = new OracleCommand ();
+                       interface_command = command;
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       command.Dispose ();
+               }
+
+               [Test] // ctor ()
+               public void Constructor1 ()
+               {
+                       OracleCommand cmd = new OracleCommand ();
+                       Assert.AreEqual (string.Empty, cmd.CommandText, "#1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#3");
+                       Assert.IsNull (cmd.Connection, "#4");
+                       Assert.IsNull (cmd.Container, "#5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#6");
+                       Assert.IsNotNull (cmd.Parameters, "#7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#8");
+                       Assert.IsNull (cmd.Site, "#9");
+                       Assert.IsNull (cmd.Transaction, "#10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#11");
+               }
+
+               [Test] // ctor (String)
+               public void Constructor2 ()
+               {
+                       OracleCommand cmd = new OracleCommand (COMMAND_TEXT);
+                       Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#A1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#A2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#A3");
+                       Assert.IsNull (cmd.Connection, "#A4");
+                       Assert.IsNull (cmd.Container, "#A5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#A6");
+                       Assert.IsNotNull (cmd.Parameters, "#A7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#A8");
+                       Assert.IsNull (cmd.Site, "#A9");
+                       Assert.IsNull (cmd.Transaction, "#A10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#A11");
+
+                       cmd = new OracleCommand ((string) null);
+                       Assert.AreEqual (string.Empty, cmd.CommandText, "#B1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#B2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#B3");
+                       Assert.IsNull (cmd.Connection, "#B4");
+                       Assert.IsNull (cmd.Container, "#B5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#B6");
+                       Assert.IsNotNull (cmd.Parameters, "#B7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#B8");
+                       Assert.IsNull (cmd.Site, "#B9");
+                       Assert.IsNull (cmd.Transaction, "#B10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#B11");
+               }
+
+               [Test] // ctor (String, OracleConnection)
+               public void Constructor3 ()
+               {
+                       OracleConnection conn = new OracleConnection ();
+                       OracleCommand cmd;
+
+                       cmd = new OracleCommand (COMMAND_TEXT, conn);
+                       Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#A1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#A2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#A3");
+                       Assert.AreSame (conn, cmd.Connection, "#A4");
+                       Assert.IsNull (cmd.Container, "#A5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#A6");
+                       Assert.IsNotNull (cmd.Parameters, "#A7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#A8");
+                       Assert.IsNull (cmd.Site, "#A9");
+                       Assert.IsNull (cmd.Transaction, "#A10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#A11");
+
+                       cmd = new OracleCommand ((string) null, conn);
+                       Assert.AreEqual (string.Empty, cmd.CommandText, "#B1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#B2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#B3");
+                       Assert.AreSame (conn, cmd.Connection, "#B4");
+                       Assert.IsNull (cmd.Container, "#B5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#B6");
+                       Assert.IsNotNull (cmd.Parameters, "#B7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#B8");
+                       Assert.IsNull (cmd.Site, "#B9");
+                       Assert.IsNull (cmd.Transaction, "#B10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#B11");
+
+                       cmd = new OracleCommand (COMMAND_TEXT, (OracleConnection) null);
+                       Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#C1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#C2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#C3");
+                       Assert.IsNull (cmd.Connection, "#C4");
+                       Assert.IsNull (cmd.Container, "#C5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#C6");
+                       Assert.IsNotNull (cmd.Parameters, "#C7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#C8");
+                       Assert.IsNull (cmd.Site, "#C9");
+                       Assert.IsNull (cmd.Transaction, "#C10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#C11");
+               }
+
+               [Test] // ctor (String, OracleConnection, OracleTransaction)
+               public void Constructor4 ()
+               {
+                       OracleConnection conn = new OracleConnection ();
+                       OracleCommand cmd;
+
+                       cmd = new OracleCommand (COMMAND_TEXT, conn, (OracleTransaction) null);
+                       Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#A1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#A2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#A3");
+                       Assert.AreSame (conn, cmd.Connection, "#A4");
+                       Assert.IsNull (cmd.Container, "#A5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#A6");
+                       Assert.IsNotNull (cmd.Parameters, "#A7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#A8");
+                       Assert.IsNull (cmd.Site, "#A9");
+                       Assert.IsNull (cmd.Transaction, "#A10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#A11");
+
+                       cmd = new OracleCommand ((string) null, conn, (OracleTransaction) null);
+                       Assert.AreEqual (string.Empty, cmd.CommandText, "#B1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#B2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#B3");
+                       Assert.AreSame (conn, cmd.Connection, "#B4");
+                       Assert.IsNull (cmd.Container, "#B5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#B6");
+                       Assert.IsNotNull (cmd.Parameters, "#B7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#B8");
+                       Assert.IsNull (cmd.Site, "#B9");
+                       Assert.IsNull (cmd.Transaction, "#B10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#B11");
+
+                       cmd = new OracleCommand (COMMAND_TEXT, (OracleConnection) null, (OracleTransaction) null);
+                       Assert.AreEqual (COMMAND_TEXT, cmd.CommandText, "#C1");
+#if NET_2_0
+                       Assert.AreEqual (0, cmd.CommandTimeout, "#C2");
+#endif
+                       Assert.AreEqual (CommandType.Text, cmd.CommandType, "#C3");
+                       Assert.IsNull (cmd.Connection, "#C4");
+                       Assert.IsNull (cmd.Container, "#C5");
+                       Assert.IsTrue (cmd.DesignTimeVisible, "#C6");
+                       Assert.IsNotNull (cmd.Parameters, "#C7");
+                       Assert.AreEqual (0, cmd.Parameters.Count, "#C8");
+                       Assert.IsNull (cmd.Site, "#C9");
+                       Assert.IsNull (cmd.Transaction, "#C10");
+                       Assert.AreEqual (UpdateRowSource.Both, cmd.UpdatedRowSource, "#C11");
+               }
+
+               [Test] // bug #78765
+               public void AllowNullTransactionTest ()
+               {
+                       command.Transaction = null;
+                       interface_command.Transaction = null;
+               }
+
+               [Test]
+               public void CommandText ()
+               {
+                       OracleCommand cmd = new OracleCommand ();
+                       cmd.CommandText = COMMAND_TEXT;
+                       Assert.AreSame (COMMAND_TEXT, cmd.CommandText, "#1");
+                       cmd.CommandText = null;
+                       Assert.AreEqual (string.Empty, cmd.CommandText, "#2");
+                       cmd.CommandText = COMMAND_TEXT;
+                       Assert.AreSame (COMMAND_TEXT, cmd.CommandText, "#3");
+                       cmd.CommandText = string.Empty;
+                       Assert.AreEqual (string.Empty, cmd.CommandText, "#4");
+               }
+
+#if NET_2_0
+               [Test]
+               public void CommandTimeout ()
+               {
+                       Assert.AreEqual (0, command.CommandTimeout, "#1");
+                       command.CommandTimeout = 10;
+                       Assert.AreEqual (0, command.CommandTimeout, "#2");
+                       command.CommandTimeout = int.MaxValue;
+                       Assert.AreEqual (0, command.CommandTimeout, "#3");
+                       command.CommandTimeout = int.MinValue;
+                       Assert.AreEqual (0, command.CommandTimeout, "#4");
+               }
+#endif
+
+               [Test]
+               public void ConnectionTimeout_IDbConnection ()
+               {
+                       Assert.AreEqual (0, interface_command.CommandTimeout, "#1");
+                       interface_command.CommandTimeout = 10;
+                       Assert.AreEqual (0, interface_command.CommandTimeout, "#2");
+                       interface_command.CommandTimeout = int.MaxValue;
+                       Assert.AreEqual (0, interface_command.CommandTimeout, "#3");
+                       interface_command.CommandTimeout = int.MinValue;
+                       Assert.AreEqual (0, interface_command.CommandTimeout, "#4");
+               }
+
+               [Test]
+               public void Connection ()
+               {
+                       OracleConnection connection = new OracleConnection ();
+
+                       Assert.IsNull (command.Connection, "#1");
+                       command.Connection = connection;
+                       Assert.AreSame (connection, command.Connection, "#2");
+                       Assert.AreSame (connection, interface_command.Connection, "#3");
+                       command.Connection = null;
+                       Assert.IsNull (command.Connection, "#4");
+                       Assert.IsNull (interface_command.Connection, "#5");
+               }
+
+               [Test]
+               public void Connection_IDbConnection ()
+               {
+                       OracleConnection connection = new OracleConnection ();
+
+                       Assert.IsNull (interface_command.Connection, "#A1");
+                       interface_command.Connection = connection;
+                       Assert.AreSame (connection, interface_command.Connection, "#A2");
+                       Assert.AreSame (connection, command.Connection, "#A3");
+                       interface_command.Connection = null;
+                       Assert.IsNull (interface_command.Connection, "#A4");
+                       Assert.IsNull (command.Connection, "#A5");
 
-namespace MonoTests.System.Data.OracleClient {
-
-        [TestFixture]
-        public class OracleCommandTest {
-
-                OracleCommand command;
-                IDbCommand interface_command;
-
-                [SetUp]
-                public void SetUp ()
-                {
-                        command = new OracleCommand ();
-                        interface_command = command;
-                }
-
-                [TearDown]
-                public void TearDown ()
-                {
-                        command.Dispose ();
-                }
-
-                [Test] // regression for bug #78765
-                public void AllowNullConnectionTest ()
-                {
-                        command.Connection = null;
-                        try {
-                                interface_command.Connection = null;
-                        }
-                        catch (Exception) {
-                                Assert.Fail ("Connection property should be nullable");
-                        }
-                }
-
-                [Test] // regression for bug #78765
-                public void AllowNullTransactionTest ()
-                {
-                        command.Transaction = null;
-                        try {
-                                interface_command.Transaction = null;
-                        }
-                        catch (Exception) {
-                                Assert.Fail ("Transaction property should be nullable");
-                        }
-                }
-        }
-}
\ No newline at end of file
+                       try {
+                               interface_command.Connection = new SqlConnection ();
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                       }
+               }
+       }
+}
diff --git a/mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleConnectionTest.cs b/mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleConnectionTest.cs
new file mode 100644 (file)
index 0000000..f46c4ba
--- /dev/null
@@ -0,0 +1,89 @@
+//
+// OracleConnectionTest.cs - NUnit Test Cases for OracleConnection
+//
+// Author:
+//      Gert Driesen  <drieseng@users.sourceforge.net>
+//
+// Copyright (C) 2008 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.
+//
+
+using System;
+using System.Data;
+using System.Data.OracleClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.OracleClient
+{
+       [TestFixture]
+       public class OracleConnectionTest
+       {
+               OracleConnection connection;
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       connection = new OracleConnection ();
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       connection.Dispose ();
+               }
+
+               [Test]
+               public void ConnectionString ()
+               {
+                       connection.ConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
+                       Assert.AreEqual ("Data Source=Oracle8i;Integrated Security=yes",
+                               connection.ConnectionString, "#1");
+                       connection.ConnectionString = null;
+                       Assert.AreEqual (string.Empty, connection.ConnectionString, "#2");
+                       connection.ConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
+                       Assert.AreEqual ("Data Source=Oracle8i;Integrated Security=yes",
+                               connection.ConnectionString, "#3");
+                       connection.ConnectionString = string.Empty;
+                       Assert.AreEqual (string.Empty, connection.ConnectionString, "#3");
+               }
+
+#if NET_2_0
+               [Test]
+               public void ConnectionTimeout ()
+               {
+                       OracleConnection connection = new OracleConnection ();
+                       Assert.AreEqual (0, connection.ConnectionTimeout, "#1");
+                       connection.ConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
+                       Assert.AreEqual (0, connection.ConnectionTimeout, "#2");
+               }
+#endif
+
+               [Test]
+               public void ConnectionTimeout_IDbConnection ()
+               {
+                       IDbConnection connection = new OracleConnection ();
+                       Assert.AreEqual (0, connection.ConnectionTimeout, "#1");
+                       connection.ConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
+                       Assert.AreEqual (0, connection.ConnectionTimeout, "#2");
+               }
+       }
+}
diff --git a/mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleDataAdapterTest.cs b/mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleDataAdapterTest.cs
new file mode 100644 (file)
index 0000000..2f04a59
--- /dev/null
@@ -0,0 +1,555 @@
+//
+// OracleDataAdapterTest.cs - NUnit Test Cases for OracleDataAdapter
+//
+// Author:
+//      Gert Driesen  <drieseng@users.sourceforge.net>
+//
+// Copyright (C) 2008 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.
+//
+
+using System;
+using System.Data;
+using System.Data.OracleClient;
+using System.Data.SqlClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.OracleClient
+{
+       [TestFixture]
+       public class OracleDataAdapterTest
+       {
+               [Test] // ctor ()
+               public void Constructor1 ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNull (da.SelectCommand, "#11");
+                       Assert.IsNull (da.Site, "#12");
+                       Assert.IsNotNull (da.TableMappings, "#13");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#14");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#15");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#16");
+               }
+
+               [Test] // ctor (OracleCommand)
+               public void Constructor2 ()
+               {
+                       OracleCommand cmd = new OracleCommand ();
+                       OracleDataAdapter da = new OracleDataAdapter (cmd);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.AreSame (cmd, da.SelectCommand, "#12");
+                       Assert.IsNull (da.Site, "#13");
+                       Assert.IsNotNull (da.TableMappings, "#14");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#15");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#16");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#17");
+               }
+
+               [Test] // ctor (OracleCommand)
+               public void Constructor2_SelectCommand_Null ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               (OracleCommand) null);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNull (da.SelectCommand, "#11");
+                       Assert.IsNull (da.Site, "#12");
+                       Assert.IsNotNull (da.TableMappings, "#13");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#14");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#15");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#16");
+               }
+
+               [Test] // ctor (String, OracleConnection)
+               public void Constructor3 ()
+               {
+                       string selectCommandText = "SELECT * FROM dual";
+                       OracleConnection selectConnection = new OracleConnection ();
+
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               selectCommandText, selectConnection);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.AreSame (selectCommandText, da.SelectCommand.CommandText, "#12");
+                       Assert.AreSame (selectConnection, da.SelectCommand.Connection, "#13");
+                       Assert.IsNull (da.Site, "#14");
+                       Assert.IsNotNull (da.TableMappings, "#15");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#16");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#17");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#18");
+               }
+
+               [Test] // ctor (String, OracleConnection)
+               public void Constructor3_SelectCommandText_Null ()
+               {
+                       OracleConnection selectConnection = new OracleConnection ();
+
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               (string) null, selectConnection);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.IsNotNull (da.SelectCommand.CommandText, "#12");
+                       Assert.AreEqual (string.Empty, da.SelectCommand.CommandText, "#13");
+                       Assert.AreSame (selectConnection, da.SelectCommand.Connection, "#14");
+                       Assert.IsNull (da.Site, "#15");
+                       Assert.IsNotNull (da.TableMappings, "#16");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#17");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#18");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#19");
+               }
+
+               [Test] // ctor (String, OracleConnection)
+               public void Constructor3_SelectConnection_Null ()
+               {
+                       string selectCommandText = "SELECT * FROM dual";
+
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               selectCommandText, (OracleConnection) null);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.AreSame (selectCommandText, da.SelectCommand.CommandText, "#12");
+                       Assert.IsNull (da.SelectCommand.Connection, "#13");
+                       Assert.IsNull (da.Site, "#14");
+                       Assert.IsNotNull (da.TableMappings, "#15");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#16");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#17");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#18");
+               }
+
+               [Test] // ctor (String, String)]
+               public void Constructor4 ()
+               {
+                       string selectCommandText = "SELECT * FROM dual";
+                       string selectConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
+
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               selectCommandText, selectConnectionString);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.AreSame (selectCommandText, da.SelectCommand.CommandText, "#12");
+                       Assert.IsNotNull (da.SelectCommand.Connection, "#13");
+                       Assert.AreEqual (selectConnectionString, da.SelectCommand.Connection.ConnectionString, "#14");
+                       Assert.IsNull (da.Site, "#15");
+                       Assert.IsNotNull (da.TableMappings, "#16");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#17");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#18");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#19");
+               }
+
+               [Test] // ctor (String, String)]
+               public void Constructor4_SelectCommandText_Null ()
+               {
+                       string selectConnectionString = "Data Source=Oracle8i;Integrated Security=yes";
+
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               (string) null, selectConnectionString);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.IsNotNull (da.SelectCommand.CommandText, "#12");
+                       Assert.AreEqual (string.Empty, da.SelectCommand.CommandText, "#13");
+                       Assert.IsNotNull (da.SelectCommand.Connection, "#14");
+                       Assert.AreEqual (selectConnectionString, da.SelectCommand.Connection.ConnectionString, "#15");
+                       Assert.IsNull (da.Site, "#16");
+                       Assert.IsNotNull (da.TableMappings, "#17");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#18");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#19");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#20");
+               }
+
+               [Test] // ctor (String, String)]
+               public void Constructor4_SelectConnectionString_Null ()
+               {
+                       string selectCommandText = "SELECT * FROM dual";
+
+                       OracleDataAdapter da = new OracleDataAdapter (
+                               selectCommandText, (string) null);
+                       Assert.IsTrue (da.AcceptChangesDuringFill, "#1");
+#if NET_2_0
+                       Assert.IsTrue (da.AcceptChangesDuringUpdate, "#2");
+#endif
+                       Assert.IsNull (da.Container, "#3");
+                       Assert.IsFalse (da.ContinueUpdateOnError, "#4");
+                       Assert.IsNull (da.DeleteCommand, "#5");
+#if NET_2_0
+                       Assert.AreEqual (LoadOption.OverwriteChanges, da.FillLoadOption, "#6");
+#endif
+                       Assert.IsNull (da.InsertCommand, "#7");
+                       Assert.AreEqual (MissingMappingAction.Passthrough, da.MissingMappingAction, "#8");
+                       Assert.AreEqual (MissingSchemaAction.Add, da.MissingSchemaAction, "#9");
+#if NET_2_0
+                       Assert.IsFalse (da.ReturnProviderSpecificTypes, "#10");
+#endif
+                       Assert.IsNotNull (da.SelectCommand, "#11");
+                       Assert.AreSame (selectCommandText, da.SelectCommand.CommandText, "#12");
+                       Assert.IsNotNull (da.SelectCommand.Connection, "#14");
+                       Assert.AreEqual (string.Empty, da.SelectCommand.Connection.ConnectionString, "#15");
+                       Assert.IsNull (da.Site, "#16");
+                       Assert.IsNotNull (da.TableMappings, "#17");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#18");
+#if NET_2_0
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#19");
+#endif
+                       Assert.IsNull (da.UpdateCommand, "#20");
+               }
+
+               [Test]
+               public void DeleteCommand ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.DeleteCommand = cmd1;
+                       Assert.AreSame (cmd1, da.DeleteCommand, "#1");
+                       da.DeleteCommand = cmd2;
+                       Assert.AreSame (cmd2, da.DeleteCommand, "#2");
+                       da.DeleteCommand = null;
+                       Assert.IsNull (da.DeleteCommand, "#3");
+               }
+
+               [Test]
+               public void DeleteCommand_IDbDataAdapter ()
+               {
+                       IDbDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.DeleteCommand = cmd1;
+                       Assert.AreSame (cmd1, da.DeleteCommand, "#A1");
+                       da.DeleteCommand = cmd2;
+                       Assert.AreSame (cmd2, da.DeleteCommand, "#A2");
+                       da.DeleteCommand = null;
+                       Assert.IsNull (da.DeleteCommand, "#A3");
+
+                       try {
+                               da.DeleteCommand = new SqlCommand ();
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                       }
+               }
+
+               [Test]
+               public void Dispose ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       da.DeleteCommand = new OracleCommand ();
+                       da.InsertCommand = new OracleCommand ();
+                       da.SelectCommand = new OracleCommand ();
+                       da.UpdateCommand = new OracleCommand ();
+                       da.Dispose ();
+
+                       Assert.IsNull (da.DeleteCommand, "#1");
+                       Assert.IsNull (da.InsertCommand, "#2");
+                       Assert.IsNull (da.SelectCommand, "#3");
+                       Assert.IsNotNull (da.TableMappings, "#4");
+                       Assert.AreEqual (0, da.TableMappings.Count, "#5");
+                       Assert.IsNull (da.UpdateCommand, "#6");
+               }
+
+               [Test]
+               public void InsertCommand ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.InsertCommand = cmd1;
+                       Assert.AreSame (cmd1, da.InsertCommand, "#1");
+                       da.InsertCommand = cmd2;
+                       Assert.AreSame (cmd2, da.InsertCommand, "#2");
+                       da.InsertCommand = null;
+                       Assert.IsNull (da.InsertCommand, "#3");
+               }
+
+               [Test]
+               public void InsertCommand_IDbDataAdapter ()
+               {
+                       IDbDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.InsertCommand = cmd1;
+                       Assert.AreSame (cmd1, da.InsertCommand, "#A1");
+                       da.InsertCommand = cmd2;
+                       Assert.AreSame (cmd2, da.InsertCommand, "#A2");
+                       da.InsertCommand = null;
+                       Assert.IsNull (da.InsertCommand, "#A3");
+
+                       try {
+                               da.InsertCommand = new SqlCommand ();
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                       }
+               }
+
+               [Test]
+               public void SelectCommand ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.SelectCommand = cmd1;
+                       Assert.AreSame (cmd1, da.SelectCommand, "#1");
+                       da.SelectCommand = cmd2;
+                       Assert.AreSame (cmd2, da.SelectCommand, "#2");
+                       da.SelectCommand = null;
+                       Assert.IsNull (da.SelectCommand, "#3");
+               }
+
+               [Test]
+               public void SelectCommand_IDbDataAdapter ()
+               {
+                       IDbDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.SelectCommand = cmd1;
+                       Assert.AreSame (cmd1, da.SelectCommand, "#A1");
+                       da.SelectCommand = cmd2;
+                       Assert.AreSame (cmd2, da.SelectCommand, "#A2");
+                       da.SelectCommand = null;
+                       Assert.IsNull (da.SelectCommand, "#A3");
+
+                       try {
+                               da.SelectCommand = new SqlCommand ();
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                       }
+               }
+
+#if NET_2_0
+               [Test]
+               public void UpdateBatchSize ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       da.UpdateBatchSize = 0;
+                       Assert.AreEqual (0, da.UpdateBatchSize, "#1");
+                       da.UpdateBatchSize = int.MaxValue;
+                       Assert.AreEqual (int.MaxValue, da.UpdateBatchSize, "#2");
+                       da.UpdateBatchSize = 1;
+                       Assert.AreEqual (1, da.UpdateBatchSize, "#3");
+               }
+
+               [Test]
+               public void UpdateBatchSize_Negative ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       try {
+                               da.UpdateBatchSize = -1;
+                               Assert.Fail ("#1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNotNull (ex.ParamName, "#5");
+                               Assert.AreEqual ("UpdateBatchSize", ex.ParamName, "#6");
+                       }
+               }
+#endif
+
+               [Test]
+               public void UpdateCommand ()
+               {
+                       OracleDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.UpdateCommand = cmd1;
+                       Assert.AreSame (cmd1, da.UpdateCommand, "#1");
+                       da.UpdateCommand = cmd2;
+                       Assert.AreSame (cmd2, da.UpdateCommand, "#2");
+                       da.UpdateCommand = null;
+                       Assert.IsNull (da.UpdateCommand, "#3");
+               }
+
+               [Test]
+               public void UpdateCommand_IDbDataAdapter ()
+               {
+                       IDbDataAdapter da = new OracleDataAdapter ();
+                       OracleCommand cmd1 = new OracleCommand ();
+                       OracleCommand cmd2 = new OracleCommand ();
+
+                       da.UpdateCommand = cmd1;
+                       Assert.AreSame (cmd1, da.UpdateCommand, "#A1");
+                       da.UpdateCommand = cmd2;
+                       Assert.AreSame (cmd2, da.UpdateCommand, "#A2");
+                       da.UpdateCommand = null;
+                       Assert.IsNull (da.UpdateCommand, "#A3");
+
+                       try {
+                               da.UpdateCommand = new SqlCommand ();
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                       }
+               }
+       }
+}
index 741b7ed05707ec95cdf9e89aba67f1ec77756914..0b41f5e10e5115b3f8e014788460eb6cb6bed63c 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using NUnit.Framework;
-using System.Data.OracleClient;
-using System.Data;
 using System;
+using System.Data;
+using System.Data.OracleClient;
+using System.Globalization;
+using System.Threading;
 
-namespace MonoTests.System.Data.OracleClient {
+using NUnit.Framework;
 
+namespace MonoTests.System.Data.OracleClient
+{
        [TestFixture]
-       public class OracleParameterCollectionTest {
+       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);
 
-               OracleParameterCollection o = new OracleParameterCollection ();
+                       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 IsFixedSizeTest ()
+               public void Count ()
                {
-                       Assert.AreEqual (false, o.IsFixedSize, "#1 ");
+                       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 IsReadOnlyTest ()
+               public void IsFixedSize ()
                {
-                       Assert.AreEqual (false, o.IsReadOnly, "#2 ");
+                       Assert.IsFalse (o.IsFixedSize);
                }
 
                [Test]
-               public void IsSynchronizedTest ()
+               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 ()
                {
-                       Assert.AreEqual (false, o.IsSynchronized, "#3 ");
+                       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");
+
+                       o ["ParamI"] = paramG;
+#if NET_2_0
+                       Assert.AreSame (paramE, o ["ParamI"], "#B1");
+#else
+                       Assert.AreSame (paramC, o ["ParamI"], "#B1");
+#endif
+                       Assert.AreSame (paramB, o ["Parami"], "#B2");
+                       Assert.AreSame (paramC, o ["paramI"], "#B3");
+#if NET_2_0
+                       Assert.AreSame (paramD, o ["parami"], "#B4");
+#else
+                       Assert.AreSame (paramB, o ["parami"], "#B4");
+#endif
+                       Assert.AreSame (paramG, o ["paramG"], "#B5");
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#B6");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#B7");
+                       Assert.AreEqual (2, o.IndexOf (paramC), "#B8");
+                       Assert.AreEqual (3, o.IndexOf (paramD), "#B9");
+                       Assert.AreEqual (4, o.IndexOf (paramE), "#B10");
+                       Assert.AreEqual (5, o.IndexOf (paramF), "#B11");
+                       Assert.AreEqual (0, o.IndexOf (paramG), "#B12");
+                       Assert.AreEqual (-1, o.IndexOf (paramH), "#B13");
+
+                       o ["ParamI"] = paramH;
+#if NET_2_0
+                       Assert.AreSame (paramC, o ["ParamI"], "#C1");
+#else
+                       Assert.AreSame (paramE, o ["ParamI"], "#C1");
+#endif
+                       Assert.AreSame (paramB, o ["Parami"], "#C2");
+#if NET_2_0
+                       Assert.AreSame (paramC, o ["paramI"], "#C3");
+                       Assert.AreSame (paramD, o ["parami"], "#C4");
+#else
+                       Assert.AreSame (paramE, o ["paramI"], "#C3");
+                       Assert.AreSame (paramB, o ["parami"], "#C4");
+#endif
+                       Assert.AreSame (paramG, o ["paramG"], "#C5");
+                       Assert.AreSame (paramH, o ["paramH"], "#C6");
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#C6");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#C7");
+#if NET_2_0
+                       Assert.AreEqual (2, o.IndexOf (paramC), "#C8");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#C8");
+#endif
+                       Assert.AreEqual (3, o.IndexOf (paramD), "#C9");
+#if NET_2_0
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#C10");
+#else
+                       Assert.AreEqual (4, o.IndexOf (paramE), "#C10");
+#endif
+                       Assert.AreEqual (5, o.IndexOf (paramF), "#C11");
+                       Assert.AreEqual (0, o.IndexOf (paramG), "#C12");
+#if NET_2_0
+                       Assert.AreEqual (4, o.IndexOf (paramH), "#C13");
+#else
+                       Assert.AreEqual (2, o.IndexOf (paramH), "#C13");
+#endif
+
+                       o ["paramG"] = paramA;
+                       Assert.AreSame (paramA, o ["ParamI"], "#D1");
+                       Assert.AreSame (paramB, o ["Parami"], "#D2");
+#if NET_2_0
+                       Assert.AreSame (paramC, o ["paramI"], "#D3");
+                       Assert.AreSame (paramD, o ["parami"], "#D4");
+#else
+                       Assert.AreSame (paramA, o ["paramI"], "#D3");
+                       Assert.AreSame (paramB, o ["parami"], "#D4");
+#endif
+                       Assert.AreSame (paramH, o ["paramH"], "#D5");
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#D6");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#D7");
+#if NET_2_0
+                       Assert.AreEqual (2, o.IndexOf (paramC), "#D8");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#D8");
+#endif
+                       Assert.AreEqual (3, o.IndexOf (paramD), "#D9");
+#if NET_2_0
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#D10");
+#else
+                       Assert.AreEqual (4, o.IndexOf (paramE), "#D10");
+#endif
+                       Assert.AreEqual (5, o.IndexOf (paramF), "#D11");
+                       Assert.AreEqual (-1, o.IndexOf (paramG), "#D12");
+#if NET_2_0
+                       Assert.AreEqual (4, o.IndexOf (paramH), "#D13");
+#else
+                       Assert.AreEqual (2, o.IndexOf (paramH), "#D13");
+#endif
+
+                       o ["ParamI"] = paramA;
+                       Assert.AreSame (paramA, o ["ParamI"], "#E1");
+                       Assert.AreSame (paramB, o ["Parami"], "#E2");
+#if NET_2_0
+                       Assert.AreSame (paramC, o ["paramI"], "#E3");
+                       Assert.AreSame (paramD, o ["parami"], "#E4");
+#else
+                       Assert.AreSame (paramA, o ["paramI"], "#E3");
+                       Assert.AreSame (paramB, o ["parami"], "#E4");
+#endif
+                       Assert.AreSame (paramH, o ["paramH"], "#E5");
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#E6");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#E7");
+#if NET_2_0
+                       Assert.AreEqual (2, o.IndexOf (paramC), "#E8");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#E8");
+#endif
+                       Assert.AreEqual (3, o.IndexOf (paramD), "#E9");
+#if NET_2_0
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#E10");
+#else
+                       Assert.AreEqual (4, o.IndexOf (paramE), "#E10");
+#endif
+                       Assert.AreEqual (5, o.IndexOf (paramF), "#E11");
+                       Assert.AreEqual (-1, o.IndexOf (paramG), "#E12");
+#if NET_2_0
+                       Assert.AreEqual (4, o.IndexOf (paramH), "#E13");
+#else
+                       Assert.AreEqual (2, o.IndexOf (paramH), "#E13");
+#endif
+
+                       o ["paramI"] = paramC;
+#if NET_2_0
+                       Assert.AreSame (paramA, o ["ParamI"], "#F1");
+#else
+                       Assert.AreSame (paramC, o ["ParamI"], "#F1");
+#endif
+                       Assert.AreSame (paramB, o ["Parami"], "#F2");
+                       Assert.AreSame (paramC, o ["paramI"], "#F3");
+#if NET_2_0
+                       Assert.AreSame (paramD, o ["parami"], "#F4");
+#else
+                       Assert.AreSame (paramB, o ["parami"], "#F4");
+#endif
+                       Assert.AreSame (paramH, o ["paramH"], "#F5");
+#if NET_2_0
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#F6");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#F6");
+#endif
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#F7");
+#if NET_2_0
+                       Assert.AreEqual (2, o.IndexOf (paramC), "#F8");
+#else
+                       Assert.AreEqual (0, o.IndexOf (paramC), "#F8");
+#endif
+                       Assert.AreEqual (3, o.IndexOf (paramD), "#F9");
+#if NET_2_0
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#F10");
+#else
+                       Assert.AreEqual (4, o.IndexOf (paramE), "#F10");
+#endif
+                       Assert.AreEqual (5, o.IndexOf (paramF), "#F11");
+                       Assert.AreEqual (-1, o.IndexOf (paramG), "#F12");
+#if NET_2_0
+                       Assert.AreEqual (4, o.IndexOf (paramH), "#F13");
+#else
+                       Assert.AreEqual (2, o.IndexOf (paramH), "#F13");
+#endif
+
+                       OracleParameterCollection o2 = new OracleParameterCollection ();
+#if NET_2_0
+                       o2.Add (paramE);
+#else
+                       o2.Add (paramA);
+#endif
+               }
+
+               [Test] // OracleParameter this [String]
+               public void Indexer2_ParameterName_NotFound ()
+               {
+                       OracleParameter param = new OracleParameter ("ParamI", 1);
+                       o.Add (param);
+
+                       try {
+                               o ["NotFound"] = 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");
+                               Assert.IsFalse (ex.Message.IndexOf ("'NotFound'") != -1, "#A6");
+#else
+                               // Parameter 'NotFound' not found
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
+                               Assert.IsTrue (ex.Message.IndexOf ("'NotFound'") != -1, "#A6");
+#endif
+                       }
+
+                       try {
+                               o [(string) null] = 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");
+                               Assert.IsFalse (ex.Message.IndexOf ("''") != -1, "#B6");
+#else
+                               // Parameter '' not found
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
+                               Assert.IsTrue (ex.Message.IndexOf ("''") != -1, "#B6");
+#endif
+                       }
+
+                       try {
+                               object value = o ["NotFound"];
+                               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");
+                               Assert.IsFalse (ex.Message.IndexOf ("'NotFound'") != -1, "#C6");
+#else
+                               // Parameter 'NotFound' not found
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#C2");
+                               Assert.IsNull (ex.InnerException, "#C3");
+                               Assert.IsNotNull (ex.Message, "#C4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#C5");
+                               Assert.IsTrue (ex.Message.IndexOf ("'NotFound'") != -1, "#C6");
+#endif
+                       }
+
+                       try {
+                               object value = o [(string) null];
+                               Assert.Fail ("#D1:" + value);
+                       } 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");
+                               Assert.IsFalse (ex.Message.IndexOf ("''") != -1, "#D6");
+#else
+                               // Parameter 'NotFound' not found
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#D2");
+                               Assert.IsNull (ex.InnerException, "#D3");
+                               Assert.IsNotNull (ex.Message, "#D4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#D5");
+                               Assert.IsTrue (ex.Message.IndexOf ("''") != -1, "#D6");
+#endif
+                       }
+               }
+
+               [Test] // OracleParameter this [String]
+               public void Indexer2_Value_Null ()
+               {
+                       OracleParameter param = new OracleParameter ("ParamI", 1);
+                       o.Add (param);
+
+                       try {
+                               o ["ParamI"] = 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 [String]
+               public void Indexer2_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);
+#if !NET_2_0
+                       o.Add (paramC);
+                       o ["paramI"] = paramA;
+#endif
+
+                       // attempt to add same OracleParameter to collection twice
+                       try {
+#if NET_2_0
+                               o ["paramI"] = paramA;
+#else
+                               o ["Parami"] = paramA;
+#endif
+                               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 ["Parami"] = 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 ["paramI"] = paramA;
+                       o.Remove (paramA);
+                       o2 ["Parami"] = paramA;
+               }
+
+               [Test] // IndexOf (Object)
+               public void IndexOf1 ()
+               {
+                       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", 1);
+                       OracleParameter paramF = new OracleParameter ("Parami", 2);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+
+                       Assert.AreEqual (1, o.IndexOf ((object) paramB), "#A1");
+                       Assert.AreEqual (0, o.IndexOf ((object) paramA), "#A2");
+                       Assert.AreEqual (-1, o.IndexOf ((object) paramD), "#A3");
+                       Assert.AreEqual (-1, o.IndexOf ((object) paramC), "#A4");
+                       Assert.AreEqual (-1, o.IndexOf ((object) paramF), "#A5");
+                       Assert.AreEqual (-1, o.IndexOf ((object) paramE), "#A6");
+                       Assert.AreEqual (-1, o.IndexOf ((object) null), "#A7");
+
+                       o.Add (paramC);
+                       o.Add (paramD);
+
+                       Assert.AreEqual (1, o.IndexOf ((object) paramB), "#B1");
+                       Assert.AreEqual (0, o.IndexOf ((object) paramA), "#B2");
+                       Assert.AreEqual (3, o.IndexOf ((object) paramD), "#B3");
+                       Assert.AreEqual (2, o.IndexOf ((object) paramC), "#B4");
+                       Assert.AreEqual (-1, o.IndexOf ((object) paramF), "#B5");
+                       Assert.AreEqual (-1, o.IndexOf ((object) paramE), "#B6");
+                       Assert.AreEqual (-1, o.IndexOf ((object) null), "#B7");
+               }
+
+               [Test] // IndexOf (Object)
+               public void IndexOf1_Value_InvalidType ()
+               {
+                       try {
+                               o.IndexOf ((object) "ParamI");
+                               Assert.Fail ("#A1");
+                       } catch (InvalidCastException ex) {
+#if NET_2_0
+                               // 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");
+#else
+                               // argument value must be of type System.Data.OracleClient.OracleParameter
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
+                               Assert.IsFalse (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");
+#endif
+                       }
+
+                       try {
+                               o.IndexOf ((object) 5);
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+#if NET_2_0
+                               // 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");
+                               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");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
+#else
+                               // argument value must be of type System.Data.OracleClient.OracleParameter
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (string).Name) != -1, "#B6");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (int).Name) != -1, "#B7");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
+#endif
+                       }
+               }
+
+               [Test] // IndexOf (OracleParameter)
+               public void IndexOf2 ()
+               {
+                       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", 1);
+                       OracleParameter paramF = new OracleParameter ("Parami", 2);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#A1");
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#A2");
+                       Assert.AreEqual (-1, o.IndexOf (paramD), "#A3");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#A4");
+                       Assert.AreEqual (-1, o.IndexOf (paramF), "#A5");
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#A6");
+                       Assert.AreEqual (-1, o.IndexOf (null), "#A7");
+
+                       o.Add (paramC);
+                       o.Add (paramD);
+
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#B1");
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#B2");
+                       Assert.AreEqual (3, o.IndexOf (paramD), "#B3");
+                       Assert.AreEqual (2, o.IndexOf (paramC), "#B4");
+                       Assert.AreEqual (-1, o.IndexOf (paramF), "#B5");
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#B6");
+                       Assert.AreEqual (-1, o.IndexOf (null), "#B7");
+               }
+
+               [Test] // IndexOf (String)
+               public void IndexOf3 ()
+               {
+                       OracleParameter paramA = new OracleParameter ("ParamI", 5);
+                       OracleParameter paramB = new OracleParameter ("Parami", 4);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+
+                       Assert.AreEqual (1, o.IndexOf ("Parami"), "#1");
+                       Assert.AreEqual (0, o.IndexOf ("ParamI"), "#2");
+                       Assert.AreEqual (0, o.IndexOf ("paramI"), "#3");
+                       Assert.AreEqual (1, o.IndexOf ("parami"), "#4");
+                       Assert.AreEqual (-1, o.IndexOf ("NotFound"), "#5");
+                       Assert.AreEqual (-1, o.IndexOf (string.Empty), "#6");
+                       Assert.AreEqual (-1, o.IndexOf ((string) null), "#7");
+               }
+
+               [Test] // Insert (Int32, Object)
+               public void Insert1_Value_InvalidType ()
+               {
+                       OracleParameter param = new OracleParameter ("ParamI", 1);
+
+                       o.Insert (0, (object) param);
+
+                       try {
+                               o.Insert (0, (object) "ParamI");
+                               Assert.Fail ("#A1");
+                       } catch (InvalidCastException ex) {
+#if NET_2_0
+                               // 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");
+#else
+                               // argument value must be of type System.Data.OracleClient.OracleParameter
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
+                               Assert.IsFalse (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");
+#endif
+                       }
+
+                       try {
+                               o.Insert (0, (object) 5);
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+#if NET_2_0
+                               // 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");
+                               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");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
+#else
+                               // argument value must be of type System.Data.OracleClient.OracleParameter
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (string).Name) != -1, "#B6");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (int).Name) != -1, "#B7");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
+#endif
+                       }
+               }
+
+               [Test] // Insert (Int32, Object)
+               public void Insert1_Value_Null ()
+               {
+                       try {
+                               o.Insert (0, (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] // Insert (Int32, Object)
+               public void Insert1_Value_Owned ()
+               {
+                       OracleParameter param = new OracleParameter ("ParamI", 1);
+
+                       o.Insert (0, (object) param);
+
+                       // attempt to add same OracleParameter to collection twice
+                       try {
+                               o.Insert (1, (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.Insert (0, (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 (param);
+                       o.Insert (0, (object) param);
+                       o.Remove (param);
+                       o2.Insert (0, (object) param);
+               }
+
+               [Test] // Insert (Int32, OracleParameter)
+               public void Insert2_Value_Null ()
+               {
+                       try {
+                               o.Insert (0, (OracleParameter) 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] // Insert (Int32, OracleParameter)
+               public void Insert2_Value_Owned ()
+               {
+                       OracleParameter param = new OracleParameter ("ParamI", 1);
+
+                       o.Insert (0, param);
+
+                       // attempt to add same OracleParameter to collection twice
+                       try {
+                               o.Insert (1, 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.Insert (0, 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.Insert (0, param);
+                       o.Remove (param);
+                       o2.Insert (0, param);
+               }
+
+               [Test] // Remove (Object)
+               public void Remove1 ()
+               {
+                       OracleParameter paramA = new OracleParameter ("ParamI", 1);
+                       OracleParameter paramB = new OracleParameter ("Parami", 2);
+                       OracleParameter paramC = new OracleParameter ("paramI", 3);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+                       o.Remove ((object) paramA);
+
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#A1");
+                       Assert.AreEqual (0, o.IndexOf (paramB), "#A2");
+
+                       o.Add (paramA);
+
+                       Assert.AreEqual (1, o.IndexOf (paramA), "#B1");
+                       Assert.AreEqual (0, o.IndexOf (paramB), "#B2");
+
+                       o.Remove ((object) paramB);
+
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#C1");
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#C2");
+
+                       OracleParameterCollection o2 = new OracleParameterCollection ();
+                       o2.Add (paramB);
+               }
+
+               [Test] // Remove (Object)
+               public void Remove1_Value_InvalidType ()
+               {
+                       try {
+                               o.Remove ((object) "ParamI");
+                               Assert.Fail ("#A1");
+                       } catch (InvalidCastException ex) {
+#if NET_2_0
+                               // 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");
+#else
+                               // argument value must be of type System.Data.OracleClient.OracleParameter
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A5");
+                               Assert.IsFalse (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");
+#endif
+                       }
+
+                       try {
+                               o.Remove ((object) 5);
+                               Assert.Fail ("#B1");
+                       } catch (InvalidCastException ex) {
+#if NET_2_0
+                               // 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");
+                               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");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
+#else
+                               // argument value must be of type System.Data.OracleClient.OracleParameter
+                               Assert.AreEqual (typeof (InvalidCastException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B5");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (string).Name) != -1, "#B6");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (int).Name) != -1, "#B7");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B8");
+#endif
+                       }
+               }
+
+               [Test] // Remove (Object)
+               public void Remove1_Value_NotOwned ()
+               {
+                       OracleParameter paramA = new OracleParameter ("ParamI", 1);
+
+                       try {
+                               o.Remove ((object) paramA);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+#if NET_2_0
+                               // Attempted to remove an OracleParameter that
+                               // is not contained by this 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");
+#else
+                               // Parameter not found
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsNull (ex.ParamName, "#B5");
+#endif
+                       }
+               }
+
+               [Test] // Remove (Object)
+               public void Remove1_Value_Null ()
+               {
+                       try {
+                               o.Remove ((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] // Remove (OracleParameter)
+               public void Remove2 ()
+               {
+                       OracleParameter paramA = new OracleParameter ("ParamI", 1);
+                       OracleParameter paramB = new OracleParameter ("Parami", 2);
+                       OracleParameter paramC = new OracleParameter ("paramI", 3);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+                       o.Remove (paramA);
+
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#A1");
+                       Assert.AreEqual (0, o.IndexOf (paramB), "#A2");
+
+                       o.Add (paramA);
+
+                       Assert.AreEqual (1, o.IndexOf (paramA), "#B1");
+                       Assert.AreEqual (0, o.IndexOf (paramB), "#B2");
+
+                       o.Remove (paramB);
+
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#C1");
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#C2");
+
+                       OracleParameterCollection o2 = new OracleParameterCollection ();
+                       o2.Add (paramB);
+               }
+
+               [Test] // Remove (OracleParameter)
+               public void Remove2_Value_NotOwned ()
+               {
+                       OracleParameter paramA = new OracleParameter ("ParamI", 1);
+
+                       try {
+                               o.Remove (paramA);
+                               Assert.Fail ("#1");
+                       } catch (ArgumentException ex) {
+#if NET_2_0
+                               // Attempted to remove an OracleParameter that
+                               // is not contained by this OracleParameterCollection
+                               Assert.AreEqual (typeof (ArgumentException), 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.IsNull (ex.ParamName, "#7");
+#else
+                               // Parameter not found
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");
+                               Assert.IsNull (ex.InnerException, "#3");
+                               Assert.IsNotNull (ex.Message, "#4");
+                               Assert.IsNull (ex.ParamName, "#5");
+#endif
+                       }
+               }
+
+               [Test] // Remove (OracleParameter)
+               public void Remove2_Value_Null ()
+               {
+                       try {
+                               o.Remove ((OracleParameter) 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] // RemoveAt (Int32)
+               public void RemoveAt1 ()
+               {
+                       OracleParameter paramA = new OracleParameter ("ParamI", 1);
+                       OracleParameter paramB = new OracleParameter ("Parami", 2);
+                       OracleParameter paramC = new OracleParameter ("paramI", 3);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+                       o.Add (paramC);
+
+                       o.RemoveAt (2);
+
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#A1");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#A2");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#A3");
+
+                       o.RemoveAt (0);
+
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#B1");
+                       Assert.AreEqual (0, o.IndexOf (paramB), "#B2");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
+
+                       o.RemoveAt (0);
+
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#C1");
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#C2");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#C3");
+
+                       o.Add (paramA);
+                       o.Add (paramC);
+
+                       OracleParameterCollection o2 = new OracleParameterCollection ();
+                       o2.Add (paramB);
+               }
+
+               [Test] // RemoveAt (Int32)
+               public void RemoveAt1_Index_Invalid ()
+               {
+                       try {
+                               o.RemoveAt (0);
+                               Assert.Fail ("#A1");
+                       } catch (IndexOutOfRangeException ex) {
+#if NET_2_0
+                               // Invalid index 0 for this OracleParameterCollection
+                               // with Count=0
+                               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 0 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.RemoveAt (-1);
+                               Assert.Fail ("#B1");
+                       } catch (IndexOutOfRangeException ex) {
+#if NET_2_0
+                               // Invalid index -1 for this OracleParameterCollection
+                               // with Count=0
+                               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
+                       }
+               }
+
+               [Test] // RemoveAt (String)
+               public void RemoveAt2 ()
+               {
+                       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);
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+                       o.Add (paramC);
+                       o.Add (paramD);
+                       o.Add (paramE);
+
+                       o.RemoveAt ("paramI");
+
+#if NET_2_0
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#A1");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#A2");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#A3");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#A1");
+                       Assert.AreEqual (0, o.IndexOf (paramB), "#A2");
+                       Assert.AreEqual (1, o.IndexOf (paramC), "#A3");
+#endif
+                       Assert.AreEqual (2, o.IndexOf (paramD), "#A4");
+                       Assert.AreEqual (3, o.IndexOf (paramE), "#A5");
+
+                       o.RemoveAt ("parami");
+
+#if NET_2_0
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#B1");
+                       Assert.AreEqual (1, o.IndexOf (paramB), "#B2");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#B3");
+                       Assert.AreEqual (-1, o.IndexOf (paramD), "#B4");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#B1");
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#B2");
+                       Assert.AreEqual (0, o.IndexOf (paramC), "#B3");
+                       Assert.AreEqual (1, o.IndexOf (paramD), "#B4");
+#endif
+                       Assert.AreEqual (2, o.IndexOf (paramE), "#B5");
+
+                       o.RemoveAt ("Parami");
+
+#if NET_2_0
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#C1");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#C1");
+#endif
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#C2");
+#if NET_2_0
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#C3");
+#else
+                       Assert.AreEqual (0, o.IndexOf (paramC), "#C3");
+#endif
+                       Assert.AreEqual (-1, o.IndexOf (paramD), "#C4");
+                       Assert.AreEqual (1, o.IndexOf (paramE), "#C5");
+
+                       o.RemoveAt ("Parami");
+
+#if NET_2_0
+                       Assert.AreEqual (0, o.IndexOf (paramA), "#D1");
+#else
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#D1");
+#endif
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#D2");
+#if NET_2_0
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#D3");
+#else
+                       Assert.AreEqual (0, o.IndexOf (paramC), "#D3");
+#endif
+                       Assert.AreEqual (-1, o.IndexOf (paramD), "#D4");
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#D5");
+
+                       o.RemoveAt ("ParamI");
+
+                       Assert.AreEqual (-1, o.IndexOf (paramA), "#E1");
+                       Assert.AreEqual (-1, o.IndexOf (paramB), "#E2");
+                       Assert.AreEqual (-1, o.IndexOf (paramC), "#E3");
+                       Assert.AreEqual (-1, o.IndexOf (paramD), "#E4");
+                       Assert.AreEqual (-1, o.IndexOf (paramE), "#E5");
+
+                       o.Add (paramA);
+                       o.Add (paramB);
+                       o.Add (paramE);
+
+                       OracleParameterCollection o2 = new OracleParameterCollection ();
+                       o2.Add (paramC);
+                       o2.Add (paramD);
+               }
+
+               [Test] // RemoveAt (String)
+               public void RemoveAt2_ParameterName_NotFound ()
+               {
+                       o.Add (new OracleParameter ((string) null, 1));
+                       o.Add (new OracleParameter (string.Empty, 1));
+
+                       try {
+                               o.RemoveAt ("NotFound");
+                               Assert.Fail ("#A1");
+                       } catch (IndexOutOfRangeException ex) {
+#if NET_2_0
+                               // An OracleParameter with ParameterName 'NotFound'
+                               // is not contained by this OracleParameterCollection
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A5");
+                               Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A6");
+                               Assert.IsTrue (ex.Message.IndexOf ("'NotFound'") != -1, "#A7");
+#else
+                               // Parameter 'NotFound' not found
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#A5");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#A6");
+                               Assert.IsTrue (ex.Message.IndexOf ("'NotFound'") != -1, "#A7");
+#endif
+                       }
+
+                       try {
+                               o.RemoveAt ((string) null);
+                               Assert.Fail ("#B1");
+                       } catch (IndexOutOfRangeException ex) {
+#if NET_2_0
+                               // An OracleParameter with ParameterName '' is
+                               // not contained by this OracleParameterCollection
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B5");
+                               Assert.IsTrue (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B6");
+                               Assert.IsTrue (ex.Message.IndexOf ("''") != -1, "#B7");
+#else
+                               // Parameter '' not found
+                               Assert.AreEqual (typeof (IndexOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsFalse (ex.Message.IndexOf (typeof (OracleParameter).Name) != -1, "#B5");
+                               Assert.IsFalse (ex.Message.IndexOf (o.GetType ().Name) != -1, "#B6");
+                               Assert.IsTrue (ex.Message.IndexOf ("''") != -1, "#B7");
+#endif
+                       }
                }
        }
 }
index eb67f5583cbb60aad428eee1ae2abef015d8603f..4bc6a3ead9e99a40256dfce5294d2545caa812d1 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using NUnit.Framework;
+using System;
 using System.Configuration;
+using System.Data;
+using System.Data.OracleClient;
 using System.Globalization;
 using System.Threading;
-using System.Data.OracleClient;
-using System.Data;
-using System;
 
-namespace MonoTests.System.Data.OracleClient {
-
-        [TestFixture]
-        public class OracleParameterTest {
-
-                String connection_string;
-                OracleConnection connection;
-                OracleCommand command;
-
-                // test string
-                string test_value = "  simply trim test      ";
-                string test_value2 = "  simply trim test in query      ";
-
-                [TestFixtureSetUp]
-                public void FixtureSetUp ()
-                {
-                        connection_string = ConfigurationSettings.AppSettings.Get ("ConnectionString");
-                        if(connection_string == null)
-                                Assert.Ignore ("Please consult README.tests.");
-                }
-
-                [SetUp]
-                public void SetUp ()
-                {
-                        connection = new OracleConnection (connection_string);
-                        connection.Open ();
-                        using (command = connection.CreateCommand ()) {
-                                // create the tables
-                                command.CommandText =
-                                                "create table oratest (id number(10), text varchar2(64), text2 varchar2(64) )";
-                                command.ExecuteNonQuery ();
-
-                                command.CommandText =
-                                                "create table culture_test (id number(10), value1 float,"
-                                                                                               + " value2 number(20,10), value3 number (20,10))";
-                                command.ExecuteNonQuery ();
-
-                                                               command.CommandText =
-                                                                       "create table oratypes_test (id NUMBER(10), value1 VARCHAR2(100),"
-                                                                       + " value2 DATE)";
-                                                               command.ExecuteNonQuery ();
-
-                                                               command.CommandText =
-                                                                       "create or replace procedure params_pos_test (param1 in number,"
-                                                                       + "param2 in number,param3 in number,result out number) as"
-                                                                       + " begin result:=param3; end;";
-                                                               command.ExecuteNonQuery ();
-                        }
-                }
-
-                [TearDown]
-                public void TearDown ()
-                {
-                        using (command = connection.CreateCommand ()) {
-                                command.CommandText = "drop table oratest";
-                                command.ExecuteNonQuery ();
-                                command.CommandText = "drop table culture_test";
-                                command.ExecuteNonQuery ();
-                                                               command.CommandText = "drop table oratypes_test";
-                                                               command.ExecuteNonQuery ();
-                        }
-
-                        connection.Close ();
-                        connection.Dispose ();
-                }
-
-                [Test] // regression for bug #78509
-                public void TrimsTrailingSpacesTest ()
-                {
-                        using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
-
-                                // insert test values
-                                command.CommandText =
-                                                "insert into oratest (id,text,text2) values (:id,:txt,'" + test_value2 + "')";
-                                command.Parameters.Add (new OracleParameter ("ID", OracleType.Int32));
-                                command.Parameters.Add( new OracleParameter ("TXT", OracleType.VarChar));
-                                command.Parameters ["ID"].Value = 100;
-                                command.Parameters ["TXT"].Value = test_value;
-                                command.ExecuteNonQuery ();
-
-                                // read test values
-                                command.CommandText =
-                                                "select text,text2 from oratest where id = 100";
-                                command.Parameters.Clear ();
-                                using (OracleDataReader reader = command.ExecuteReader ()) {
-                                        if (reader.Read ()) {
-                                                Assert.AreEqual (test_value2, reader.GetString (1), "Directly passed value mismatched");
-                                                Assert.AreEqual (test_value, reader.GetString (0), "Passed through bind value mismatched");
-                                        }
-                                        else {
-                                                Assert.Fail ("Expected records not found.");
-                                        }
-                                }
-                        }
-                }
-
-                [Test] // regression for bug #79284
-                public void CultureSensitiveNumbersTest ()
-                {
-                        CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
-
-                        Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-GB", false);
-                        CultureSensitiveNumbersInsertTest (1);
-                        CultureSensitiveNumbersSelectTest (1);
-
-                        Thread.CurrentThread.CurrentCulture = new CultureInfo ("pl-PL", false);
-                        CultureSensitiveNumbersInsertTest (2);
-                        CultureSensitiveNumbersSelectTest (2);
-
-                        Thread.CurrentThread.CurrentCulture = new CultureInfo ("ja-JP", false);
-                        CultureSensitiveNumbersInsertTest (3);
-                        CultureSensitiveNumbersSelectTest (3);
-
-                        Thread.CurrentThread.CurrentCulture = currentCulture;
-                }
-
-                // regression for bug #79284
-                protected void CultureSensitiveNumbersInsertTest (int id)
-                {
-                        using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
-                                // insert test values
-                                command.CommandText =
-                                                               "insert into culture_test (id,value1,value2,value3) values (:id,:value1,:value2,:value3)";
-                                command.Parameters.Add (new OracleParameter ("ID", OracleType.Int32));
-                                command.Parameters.Add( new OracleParameter ("VALUE1", OracleType.Float));
-                                command.Parameters.Add( new OracleParameter ("VALUE2", OracleType.Double));
-                                                               command.Parameters.Add( new OracleParameter ("VALUE3", OracleType.Number));
-                                command.Parameters ["ID"].Value = id;
-                                command.Parameters ["VALUE1"].Value = 2346.2342f;
-                                command.Parameters ["VALUE2"].Value = 4567456.23412m;
-                                                               command.Parameters ["VALUE3"].Value = new OracleNumber(4567456.23412m);
-                                try {
-                                        command.ExecuteNonQuery ();
-                                }
-                                catch (OracleException e) {
-                                        if (e.Code == 1722)
-                                                Assert.Fail("Culture incompatibility error while inserting [" + id + ']');
-                                        else throw;
-                                }
-                        }
-                }
-
-                // regression for bug #79284
-                protected void CultureSensitiveNumbersSelectTest (int id)
-                {
-                        using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
-                                // read test values
-                                command.CommandText =
-                                                "select value1,value2,value3 from culture_test where id = " + id;
-                                command.Parameters.Clear ();
-                                try {
-                                        using (OracleDataReader reader = command.ExecuteReader ()) {
-                                                if (reader.Read ()) {
-                                                        Assert.AreEqual (2346.2342f,reader.GetFloat(0),
-                                                                "Float value improperly stored [" + id + ']');
-                                                        Assert.AreEqual (4567456.23412m, reader.GetDecimal (1),
-                                                                "Decimal value improperly stored [" + id + ']');
-                                                                                                               Assert.AreEqual (4567456.23412m, reader.GetOracleNumber(2).Value,
-                                                                                                                                        "OracleNumber value improperly stored [" + id + ']');
-                                                }
-                                                else {
-                                                        Assert.Fail ("Expected records not found [" + id + ']');
-                                                }
-                                        }
-                                }
-                                catch (FormatException) {
-                                        Assert.Fail("Culture incompatibility error while reading [" + id + ']');
-                                }
-                        }
-                }
-
-                               // added support for OracleString, OracleNumber and OracleDateTime in OracleParameter
-                               [Test]
-                               public void OracleTypesInValueTest ()
-                               {
-                                       try {
-                                               int test_int = 10;
-                                               string test_string = "koza";
-                                               DateTime test_dateTime = DateTime.MinValue;
-                                               using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
-
-                                                       // insert test values
-                                                       command.CommandText =
-                                                               "insert into oratypes_test (id,value1,value2)"
-                                                               +" values (:idx,:txtx,:datex)";
-
-                                                       command.Parameters.Add(
-                                                               new OracleParameter("IDX", OracleType.Number))
-                                                               .Direction = ParameterDirection.Input;
-                                                       command.Parameters.Add(
-                                                               new OracleParameter("TXTX", OracleType.VarChar))
-                                                               .Direction = ParameterDirection.Input;
-                                                       command.Parameters.Add(
-                                                               new OracleParameter("DATEX", OracleType.DateTime))
-                                                               .Direction = ParameterDirection.Input;
-
-                                                       command.Parameters ["IDX"].Value = new OracleNumber(test_int);
-                                                       command.Parameters ["TXTX"].Value = new OracleString(test_string);
-                                                       command.Parameters ["DATEX"].Value = new OracleDateTime(test_dateTime);
-
-                                                       command.ExecuteNonQuery ();
-
-                                                       // read test values
-                                                       command.CommandText =
-                                                               "select value1,value2 from oratypes_test where id = "
-                                                               + test_int;
-                                                       command.Parameters.Clear ();
-                                                       using (OracleDataReader reader = command.ExecuteReader ()) {
-                                                               if (reader.Read ()) {
-                                                                       Assert.AreEqual (test_string, reader.GetString (0), "OracleString mismatched");
-                                                                       Assert.AreEqual (test_dateTime, reader.GetDateTime(1), "OracleDateTime mismatched");
-                                                               }
-                                                               else {
-                                                                       Assert.Fail ("Expected records not found.");
-                                                               }
-                                                       }
-                                               }
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.OracleClient
+{
+       [TestFixture]
+       public class OracleParameterTest
+       {
+               String connection_string;
+               OracleConnection connection;
+               OracleCommand command;
+
+               // test string
+               string test_value = "  simply trim test      ";
+               string test_value2 = "  simply trim test in query      ";
+
+               [TestFixtureSetUp]
+               public void FixtureSetUp ()
+               {
+                       connection_string = ConfigurationSettings.AppSettings.Get ("ConnectionString");
+               }
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       if (connection_string == null)
+                               return;
+
+                       connection = new OracleConnection (connection_string);
+                       connection.Open ();
+                       using (command = connection.CreateCommand ()) {
+                               // create the tables
+                               command.CommandText =
+                                       "create table oratest (id number(10), text varchar2(64),"
+                                       + " text2 varchar2(64) )";
+                               command.ExecuteNonQuery ();
+
+                               command.CommandText =
+                                       "create table culture_test (id number(10), value1 float,"
+                                       + " value2 number(20,10), value3 number (20,10))";
+                               command.ExecuteNonQuery ();
+
+                               command.CommandText =
+                                       "create table oratypes_test (id NUMBER(10), value1 VARCHAR2(100),"
+                                       + " value2 DATE)";
+                               command.ExecuteNonQuery ();
+
+                               command.CommandText =
+                                       "create or replace procedure params_pos_test (param1 in number,"
+                                       + "param2 in number,param3 in number,result out number) as"
+                                       + " begin result:=param3; end;";
+                               command.ExecuteNonQuery ();
+                       }
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       if (connection_string == null)
+                               return;
+
+                       using (command = connection.CreateCommand ()) {
+                               command.CommandText = "drop table oratest";
+                               command.ExecuteNonQuery ();
+                               command.CommandText = "drop table culture_test";
+                               command.ExecuteNonQuery ();
+                               command.CommandText = "drop table oratypes_test";
+                               command.ExecuteNonQuery ();
+                       }
+
+                       connection.Close ();
+                       connection.Dispose ();
+               }
+
+               [Test] // ctor ()
+               public void Constructor1 ()
+               {
+                       OracleParameter param = new OracleParameter ();
+                       Assert.AreEqual (DbType.AnsiString, param.DbType, "#1");
+                       Assert.AreEqual (ParameterDirection.Input, param.Direction, "#2");
+                       Assert.IsFalse (param.IsNullable, "#3");
+                       Assert.AreEqual (OracleType.VarChar, param.OracleType, "#4");
+                       Assert.AreEqual (string.Empty, param.ParameterName, "#5");
+                       Assert.AreEqual ((byte) 0, param.Precision, "#6");
+                       Assert.AreEqual ((byte) 0, param.Scale, "#7");
+                       Assert.AreEqual (0, param.Size, "#8");
+                       Assert.AreEqual (string.Empty, param.SourceColumn, "#9");
+#if NET_2_0
+                       Assert.IsFalse (param.SourceColumnNullMapping, "#10");
+#endif
+                       Assert.AreEqual (DataRowVersion.Current, param.SourceVersion, "#11");
+                       Assert.IsNull (param.Value, "#12");
+               }
+
+               [Test] // ctor ()
+#if NET_2_0
+               [Category ("NotWorking")] // #A8 fails
+#endif
+               public void Constructor2 ()
+               {
+                       OracleParameter param;
+
+                       param = new OracleParameter ("firstName", "Miguel");
+                       Assert.AreEqual (DbType.AnsiString, param.DbType, "#A1");
+                       Assert.AreEqual (ParameterDirection.Input, param.Direction, "#A2");
+                       Assert.IsFalse (param.IsNullable, "#A3");
+                       Assert.AreEqual (OracleType.VarChar, param.OracleType, "#A4");
+                       Assert.AreEqual ("firstName", param.ParameterName, "#A5");
+                       Assert.AreEqual ((byte) 0, param.Precision, "#A6");
+                       Assert.AreEqual ((byte) 0, param.Scale, "#A7");
+#if NET_2_0
+                       Assert.AreEqual (6, param.Size, "#A8");
+#else
+                       Assert.AreEqual (0, param.Size, "#A8");
+#endif
+                       Assert.AreEqual (string.Empty, param.SourceColumn, "#A9");
+#if NET_2_0
+                       Assert.IsFalse (param.SourceColumnNullMapping, "#A10");
+#endif
+                       Assert.AreEqual (DataRowVersion.Current, param.SourceVersion, "#A11");
+                       Assert.AreEqual ("Miguel", param.Value, "#A12");
+
+                       param = new OracleParameter ((string) null, new DateTime (2006, 1, 5));
+                       Assert.AreEqual (DbType.DateTime, param.DbType, "#B1");
+                       Assert.AreEqual (ParameterDirection.Input, param.Direction, "#B2");
+                       Assert.IsFalse (param.IsNullable, "#B3");
+                       Assert.AreEqual (OracleType.DateTime, param.OracleType, "#B4");
+                       Assert.AreEqual (string.Empty, param.ParameterName, "#B5");
+                       Assert.AreEqual ((byte) 0, param.Precision, "#B6");
+                       Assert.AreEqual ((byte) 0, param.Scale, "#B7");
+                       Assert.AreEqual (0, param.Size, "#B8");
+                       Assert.AreEqual (string.Empty, param.SourceColumn, "#B9");
+#if NET_2_0
+                       Assert.IsFalse (param.SourceColumnNullMapping, "#B10");
+#endif
+                       Assert.AreEqual (DataRowVersion.Current, param.SourceVersion, "#B11");
+                       Assert.AreEqual (new DateTime (2006, 1, 5), param.Value, "#B12");
+               }
+
+               [Test]
+               public void ParameterName ()
+               {
+                       OracleParameter param = new OracleParameter ("A", "B");
+                       param.ParameterName = null;
+                       Assert.AreEqual (string.Empty, param.ParameterName, "#1");
+                       param.ParameterName = "B";
+                       Assert.AreEqual ("B", param.ParameterName, "#2");
+                       param.ParameterName = string.Empty;
+                       Assert.AreEqual (string.Empty, param.ParameterName, "#3");
+               }
+       
+               [Test] // bug #78509
+               public void TrimsTrailingSpacesTest ()
+               {
+                       if (connection_string == null)
+                               Assert.Ignore ("Please consult README.tests.");
+
+                       using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
+                               // insert test values
+                               command.CommandText =
+                                       "insert into oratest (id,text,text2) values (:id,:txt,'"
+                                       + test_value2 + "')";
+                               command.Parameters.Add (new OracleParameter ("ID", OracleType.Int32));
+                               command.Parameters.Add( new OracleParameter ("TXT", OracleType.VarChar));
+                               command.Parameters ["ID"].Value = 100;
+                               command.Parameters ["TXT"].Value = test_value;
+                               command.ExecuteNonQuery ();
+
+                               // read test values
+                               command.CommandText =
+                                       "select text,text2 from oratest where id = 100";
+                               command.Parameters.Clear ();
+                               using (OracleDataReader reader = command.ExecuteReader ()) {
+                                       if (reader.Read ()) {
+                                               Assert.AreEqual (test_value2, reader.GetString (1), "Directly passed value mismatched");
+                                               Assert.AreEqual (test_value, reader.GetString (0), "Passed through bind value mismatched");
+                                       } else {
+                                               Assert.Fail ("Expected records not found.");
                                        }
-                                       catch (ArgumentException e) {
-                                               Assert.Fail("OracleType not handled: " + e.Message);
+                               }
+                       }
+               }
+
+               [Test] // bug #79284
+               public void CultureSensitiveNumbersTest ()
+               {
+                       if (connection_string == null)
+                               Assert.Ignore ("Please consult README.tests.");
+
+                       CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
+
+                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-GB", false);
+                       CultureSensitiveNumbersInsertTest (1);
+                       CultureSensitiveNumbersSelectTest (1);
+
+                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("pl-PL", false);
+                       CultureSensitiveNumbersInsertTest (2);
+                       CultureSensitiveNumbersSelectTest (2);
+
+                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("ja-JP", false);
+                       CultureSensitiveNumbersInsertTest (3);
+                       CultureSensitiveNumbersSelectTest (3);
+
+                       Thread.CurrentThread.CurrentCulture = currentCulture;
+               }
+
+               // regression for bug #79284
+               protected void CultureSensitiveNumbersInsertTest (int id)
+               {
+                       using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
+                               // insert test values
+                               command.CommandText =
+                                       "insert into culture_test (id,value1,value2,value3) values (:id,:value1,:value2,:value3)";
+                               command.Parameters.Add (new OracleParameter ("ID", OracleType.Int32));
+                               command.Parameters.Add( new OracleParameter ("VALUE1", OracleType.Float));
+                               command.Parameters.Add( new OracleParameter ("VALUE2", OracleType.Double));
+                               command.Parameters.Add( new OracleParameter ("VALUE3", OracleType.Number));
+                               command.Parameters ["ID"].Value = id;
+                               command.Parameters ["VALUE1"].Value = 2346.2342f;
+                               command.Parameters ["VALUE2"].Value = 4567456.23412m;
+                               command.Parameters ["VALUE3"].Value = new OracleNumber(4567456.23412m);
+
+                               try {
+                                       command.ExecuteNonQuery ();
+                               } catch (OracleException e) {
+                                       if (e.Code == 1722)
+                                               Assert.Fail("Culture incompatibility error while inserting [" + id + ']');
+                                       else throw;
+                               }
+                       }
+               }
+
+               // regression for bug #79284
+               protected void CultureSensitiveNumbersSelectTest (int id)
+               {
+                       using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
+                               // read test values
+                               command.CommandText =
+                                       "select value1,value2,value3 from culture_test where id = " + id;
+                               command.Parameters.Clear ();
+                               try {
+                                       using (OracleDataReader reader = command.ExecuteReader ()) {
+                                               if (reader.Read ()) {
+                                                       Assert.AreEqual (2346.2342f,reader.GetFloat(0),
+                                                               "Float value improperly stored [" + id + ']');
+                                                       Assert.AreEqual (4567456.23412m, reader.GetDecimal (1),
+                                                               "Decimal value improperly stored [" + id + ']');
+                                                       Assert.AreEqual (4567456.23412m, reader.GetOracleNumber(2).Value,
+                                                               "OracleNumber value improperly stored [" + id + ']');
+                                               } else {
+                                                       Assert.Fail ("Expected records not found [" + id + ']');
+                                               }
                                        }
+                               } catch (FormatException) {
+                                       Assert.Fail("Culture incompatibility error while reading [" + id + ']');
                                }
-
-                       [Test] // verify that parameters are bound by name
-                       public void ProcedureParametersByNameTest ()
-                       {
+                       }
+               }
+
+               // added support for OracleString, OracleNumber and OracleDateTime in OracleParameter
+               [Test]
+               public void OracleTypesInValueTest ()
+               {
+                       if (connection_string == null)
+                               Assert.Ignore ("Please consult README.tests.");
+
+                       try {
+                               int test_int = 10;
+                               string test_string = "koza";
+                               DateTime test_dateTime = DateTime.MinValue;
                                using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
+                                       // insert test values
+                                       command.CommandText =
+                                               "insert into oratypes_test (id,value1,value2)"
+                                               +" values (:idx,:txtx,:datex)";
+                                       command.Parameters.Add(
+                                               new OracleParameter("IDX", OracleType.Number))
+                                               .Direction = ParameterDirection.Input;
+                                       command.Parameters.Add(
+                                               new OracleParameter("TXTX", OracleType.VarChar))
+                                               .Direction = ParameterDirection.Input;
+                                       command.Parameters.Add(
+                                               new OracleParameter("DATEX", OracleType.DateTime))
+                                               .Direction = ParameterDirection.Input;
+
+                                       command.Parameters ["IDX"].Value = new OracleNumber(test_int);
+                                       command.Parameters ["TXTX"].Value = new OracleString(test_string);
+                                       command.Parameters ["DATEX"].Value = new OracleDateTime(test_dateTime);
+
+                                       command.ExecuteNonQuery ();
 
+                                       // read test values
                                        command.CommandText =
-                                               "params_pos_test";
-                                       command.CommandType = CommandType.StoredProcedure;
+                                               "select value1,value2 from oratypes_test where id = "
+                                               + test_int;
+                                       command.Parameters.Clear ();
+                                       using (OracleDataReader reader = command.ExecuteReader ()) {
+                                               if (reader.Read ()) {
+                                                       Assert.AreEqual (test_string, reader.GetString (0), "OracleString mismatched");
+                                                       Assert.AreEqual (test_dateTime, reader.GetDateTime(1), "OracleDateTime mismatched");
+                                               } else {
+                                                       Assert.Fail ("Expected records not found.");
+                                               }
+                                       }
+                               }
+                       } catch (ArgumentException e) {
+                               Assert.Fail("OracleType not handled: " + e.Message);
+                       }
+               }
 
-                                       command.Parameters.Add (new OracleParameter ("PARAM3", OracleType.Int32));
-                                       command.Parameters.Add (new OracleParameter ("PARAM1", OracleType.Int32));
-                                       command.Parameters.Add (new OracleParameter ("PARAM2", OracleType.Int32));
-                                       command.Parameters.Add (new OracleParameter ("RESULT", OracleType.Int32))
-                                                                                       .Direction = ParameterDirection.Output;
+               [Test] // verify that parameters are bound by name
+               public void ProcedureParametersByNameTest ()
+               {
+                       if (connection_string == null)
+                               Assert.Ignore ("Please consult README.tests.");
 
-                                       command.Parameters ["PARAM1"].Value = 1;
-                                       command.Parameters ["PARAM2"].Value = 2;
-                                       command.Parameters ["PARAM3"].Value = 3;
+                       using (command = connection.CreateCommand ()) { // reusing command from SetUp causes parameter names mismatch
+                               command.CommandText = "params_pos_test";
+                               command.CommandType = CommandType.StoredProcedure;
 
-                                       command.ExecuteNonQuery ();
+                               command.Parameters.Add (new OracleParameter ("PARAM3", OracleType.Int32));
+                               command.Parameters.Add (new OracleParameter ("PARAM1", OracleType.Int32));
+                               command.Parameters.Add (new OracleParameter ("PARAM2", OracleType.Int32));
+                               command.Parameters.Add (new OracleParameter ("RESULT", OracleType.Int32))
+                                       .Direction = ParameterDirection.Output;
 
-                                       Assert.AreEqual (3, command.Parameters ["RESULT"].Value,
-                                               "Unexpected result value.");
-                               }
+                               command.Parameters ["PARAM1"].Value = 1;
+                               command.Parameters ["PARAM2"].Value = 2;
+                               command.Parameters ["PARAM3"].Value = 3;
+
+                               command.ExecuteNonQuery ();
+
+                               Assert.AreEqual (3, command.Parameters ["RESULT"].Value,
+                                       "Unexpected result value.");
                        }
-        }
+               }
+       }
 }
diff --git a/mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleTimeSpanTest.cs b/mcs/class/System.Data.OracleClient/Test/System.Data.OracleClient/OracleTimeSpanTest.cs
new file mode 100644 (file)
index 0000000..e699c8f
--- /dev/null
@@ -0,0 +1,241 @@
+//
+// OracleTimeSpanTest.cs - NUnit Test Cases for OracleTimeSpan
+//
+// Author:
+//      Gert Driesen  <drieseng@users.sourceforge.net>
+//
+// Copyright (C) 2008 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.
+//
+
+using System;
+using System.Data;
+using System.Data.OracleClient;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.OracleClient
+{
+       [TestFixture]
+       public class OracleTimeSpanTest
+       {
+               [SetUp]
+               public void SetUp ()
+               {
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+               }
+
+               [Test] // ctor (Int64)
+               public void Constructor1 ()
+               {
+                       OracleTimeSpan ots;
+                       TimeSpan ts;
+                       
+                       ts = new TimeSpan (29, 7, 34, 58, 200);
+                       ots = new OracleTimeSpan (ts.Ticks);
+                       Assert.AreEqual (ts.Days, ots.Days, "#A1");
+                       Assert.AreEqual (ts.Hours, ots.Hours, "#A2");
+                       Assert.IsFalse (ots.IsNull, "#A3");
+                       Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#A4");
+                       Assert.AreEqual (ts.Minutes, ots.Minutes, "#A5");
+                       Assert.AreEqual (ts.Seconds, ots.Seconds, "#A6");
+                       Assert.AreEqual (ts, ots.Value, "#A7");
+                       Assert.AreEqual (ts.ToString (), ots.ToString (), "#A8");
+
+                       ts = new TimeSpan (0L);
+                       ots = new OracleTimeSpan (0L);
+                       Assert.AreEqual (ts.Days, ots.Days, "#B1");
+                       Assert.AreEqual (ts.Hours, ots.Hours, "#B2");
+                       Assert.IsFalse (ots.IsNull, "#B3");
+                       Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#B4");
+                       Assert.AreEqual (ts.Minutes, ots.Minutes, "#B5");
+                       Assert.AreEqual (ts.Seconds, ots.Seconds, "#B6");
+                       Assert.AreEqual (ts, ots.Value, "#B7");
+                       Assert.AreEqual (ts.ToString (), ots.ToString (), "#B8");
+               }
+
+               [Test] // ctor (OracleTimeSpan)
+               public void Constructor2 ()
+               {
+                       TimeSpan ts = new TimeSpan (29, 7, 34, 58, 200);
+
+                       OracleTimeSpan ots = new OracleTimeSpan (new OracleTimeSpan (ts));
+                       Assert.AreEqual (ts.Days, ots.Days, "#1");
+                       Assert.AreEqual (ts.Hours, ots.Hours, "#2");
+                       Assert.IsFalse (ots.IsNull, "#3");
+                       Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#4");
+                       Assert.AreEqual (ts.Minutes, ots.Minutes, "#5");
+                       Assert.AreEqual (ts.Seconds, ots.Seconds, "#6");
+                       Assert.AreEqual (ts, ots.Value, "#7");
+                       Assert.AreEqual (ts.ToString (), ots.ToString (), "#8");
+               }
+
+               [Test] // ctor (OracleTimeSpan)
+               [ExpectedException (typeof (NullReferenceException))]
+               public void Constructor2_From_Null ()
+               {
+                       new OracleTimeSpan (OracleTimeSpan.Null);
+               }
+
+               [Test] // ctor (TimeSpan)
+               public void Constructor3 ()
+               {
+                       TimeSpan ts = new TimeSpan (29, 7, 34, 58, 200);
+
+                       OracleTimeSpan ots = new OracleTimeSpan (ts);
+                       Assert.AreEqual (ts.Days, ots.Days, "#1");
+                       Assert.AreEqual (ts.Hours, ots.Hours, "#2");
+                       Assert.IsFalse (ots.IsNull, "#3");
+                       Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#4");
+                       Assert.AreEqual (ts.Minutes, ots.Minutes, "#5");
+                       Assert.AreEqual (ts.Seconds, ots.Seconds, "#6");
+                       Assert.AreEqual (ts, ots.Value, "#7");
+                       Assert.AreEqual (ts.ToString (), ots.ToString (), "#8");
+               }
+
+               [Test]
+               public void IsNull ()
+               {
+                       Assert.IsFalse (OracleTimeSpan.MaxValue.IsNull, "#1");
+                       Assert.IsFalse (OracleTimeSpan.MinValue.IsNull, "#2");
+                       Assert.IsTrue (OracleTimeSpan.Null.IsNull, "#3");
+               }
+
+               [Test]
+               public void MaxValue ()
+               {
+                       TimeSpan ts = TimeSpan.MaxValue;
+                       OracleTimeSpan ots = OracleTimeSpan.MaxValue;
+                       Assert.AreEqual (ts.Days, ots.Days, "#1");
+                       Assert.AreEqual (ts.Hours, ots.Hours, "#2");
+                       Assert.IsFalse (ots.IsNull, "#3");
+                       Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#4");
+                       Assert.AreEqual (ts.Minutes, ots.Minutes, "#5");
+                       Assert.AreEqual (ts.Seconds, ots.Seconds, "#6");
+                       Assert.AreEqual (ts, ots.Value, "#7");
+                       Assert.AreEqual (ts.ToString (), ots.ToString (), "#8");
+               }
+
+               [Test]
+               public void MinValue ()
+               {
+                       TimeSpan ts = TimeSpan.MinValue;
+                       OracleTimeSpan ots = OracleTimeSpan.MinValue;
+                       Assert.AreEqual (ts.Days, ots.Days, "#1");
+                       Assert.AreEqual (ts.Hours, ots.Hours, "#2");
+                       Assert.IsFalse (ots.IsNull, "#3");
+                       Assert.AreEqual (ts.Milliseconds, ots.Milliseconds, "#4");
+                       Assert.AreEqual (ts.Minutes, ots.Minutes, "#5");
+                       Assert.AreEqual (ts.Seconds, ots.Seconds, "#6");
+                       Assert.AreEqual (ts, ots.Value, "#7");
+                       Assert.AreEqual (ts.ToString (), ots.ToString (), "#8");
+               }
+
+               [Test]
+               public void Null ()
+               {
+                       OracleTimeSpan ots = OracleTimeSpan.Null;
+
+                       try {
+                               int days = ots.Days;
+                               Assert.Fail ("#A1:" + days);
+                       } catch (InvalidOperationException ex) {
+                               // The value is Null.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
+                               Assert.IsNull (ex.InnerException, "#A3");
+                               Assert.IsNotNull (ex.Message, "#A4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Null") != -1, "#A5");
+                       }
+
+                       try {
+                               int hours = ots.Hours;
+                               Assert.Fail ("#B1:" + hours);
+                       } catch (InvalidOperationException ex) {
+                               // The value is Null.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.InnerException, "#B3");
+                               Assert.IsNotNull (ex.Message, "#B4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Null") != -1, "#B5");
+                       }
+
+                       try {
+                               int milliseconds = ots.Milliseconds;
+                               Assert.Fail ("#C1:" + milliseconds);
+                       } catch (InvalidOperationException ex) {
+                               // The value is Null.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#C2");
+                               Assert.IsNull (ex.InnerException, "#C3");
+                               Assert.IsNotNull (ex.Message, "#C4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Null") != -1, "#C5");
+                       }
+
+                       try {
+                               int minutes = ots.Minutes;
+                               Assert.Fail ("#D1:" + minutes);
+                       } catch (InvalidOperationException ex) {
+                               // The value is Null.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#D2");
+                               Assert.IsNull (ex.InnerException, "#D3");
+                               Assert.IsNotNull (ex.Message, "#D4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Null") != -1, "#D5");
+                       }
+
+                       try {
+                               int seconds = ots.Seconds;
+                               Assert.Fail ("#E1:" + seconds);
+                       } catch (InvalidOperationException ex) {
+                               // The value is Null.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#E2");
+                               Assert.IsNull (ex.InnerException, "#E3");
+                               Assert.IsNotNull (ex.Message, "#E4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Null") != -1, "#E5");
+                       }
+
+                       try {
+                               TimeSpan value = ots.Value;
+                               Assert.Fail ("#F1:" + value);
+                       } catch (InvalidOperationException ex) {
+                               // The value is Null.
+                               Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#F2");
+                               Assert.IsNull (ex.InnerException, "#F3");
+                               Assert.IsNotNull (ex.Message, "#F4");
+                               Assert.IsTrue (ex.Message.IndexOf ("Null") != -1, "#F5");
+                       }
+               }
+
+               [Test]
+               public void ToStringTest ()
+               {
+                       OracleTimeSpan ots;
+
+                       ots = OracleTimeSpan.MaxValue;
+                       Assert.AreEqual (TimeSpan.MaxValue.ToString (), ots.ToString (), "#1");
+                       ots = OracleTimeSpan.MinValue;
+                       Assert.AreEqual (TimeSpan.MinValue.ToString (), ots.ToString (), "#2");
+                       ots = OracleTimeSpan.Null;
+                       Assert.AreEqual ("Null", ots.ToString (), "#3");
+               }
+       }
+}