mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
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
90 lines
2.9 KiB
C#
90 lines
2.9 KiB
C#
//
|
|
// OracleConnectionTest.cs - NUnit Test Cases for OracleConnection
|
|
//
|
|
// Author:
|
|
// Gert Driesen <[email protected]>
|
|
//
|
|
// 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");
|
|
}
|
|
}
|
|
}
|