瀏覽代碼

Added SqlClient automated tests for TARGET_JVM

svn path=/trunk/mcs/; revision=58074
Boris Kirzner 20 年之前
父節點
當前提交
0ec383c797
共有 16 個文件被更改,包括 1379 次插入2 次删除
  1. 3 0
      mcs/class/System.Data/ChangeLog
  2. 4 0
      mcs/class/System.Data/Test/ProviderTests/ChangeLog
  3. 12 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.OleDb.Tests.J2EE.vmwcsproj
  4. 86 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommand/SqlCommand_ExecuteReader_.cs
  5. 90 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommand/SqlCommand_ExecuteXmlReader_.cs
  6. 140 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommand/SqlCommand_Parameters.cs
  7. 122 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommandBuilder/SqlCommandBuilder_DeriveParameters_S.cs
  8. 104 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlConnection/SqlConnection_BeginTransaction_S.cs
  9. 110 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlConnection/SqlConnection_InfoMessage.cs
  10. 128 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlConnection/SqlConnection_StateChange.cs
  11. 132 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlDataAdapter/SqlDataAdapter_RowUpdated.cs
  12. 145 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlDataAdapter/SqlDataAdapter_RowUpdating.cs
  13. 145 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlParameter/SqlParameter_Direction.cs
  14. 89 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlParameter/SqlParameter_ctor_SO.cs
  15. 69 0
      mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlParameter/SqlParameter_set_DbType_D.cs
  16. 0 2
      mcs/class/System.Data/run-tests.test.connected.bat

+ 3 - 0
mcs/class/System.Data/ChangeLog

@@ -1,3 +1,6 @@
+2006-03-16 	Boris Kirzner <[email protected]>
+	* run-tests.test.connected.bat - fix in TARGET_JVM test script.
+
 2006-03-16 	Boris Kirzner <[email protected]>
 	* run-tests.test.connected.bat - fix classpath in TARGET_JVM test script.
 

+ 4 - 0
mcs/class/System.Data/Test/ProviderTests/ChangeLog

@@ -1,3 +1,7 @@
+2006-03-16	Boris Kirzner <[email protected]>
+	* System.Data.SqlClient.jvm: added SqlClient tests for TARGET_JVM
+	* System.Data.OleDb.Tests.J2EE.vmwcsproj: added SqlClient tests for TARGET_JVM
+
 2006-03-12	Boris Kirzner <[email protected]>
 	* System.Data.OleDb.J2EE.sln, System.Data.OleDb.Tests.J2EE.vmwcsproj:
 	changes for automated testing for TARGET_JVM.

+ 12 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.OleDb.Tests.J2EE.vmwcsproj

@@ -134,6 +134,18 @@
 				<File RelPath="System.Data.OleDb.jvm\OleDbTransaction\OleDbTransaction_Rollback.cs" SubType="Code" BuildAction="Compile"/>
 				<File RelPath="System.Data.OleDb.jvm\OleDbType\OleDbType.cs" SubType="Code" BuildAction="Compile"/>
 				<File RelPath="System.Data.OleDb.jvm\OleDbType\OleDbType_Date.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlCommand\SqlCommand_ExecuteReader_.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlCommand\SqlCommand_ExecuteXmlReader_.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlCommand\SqlCommand_Parameters.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlCommandBuilder\SqlCommandBuilder_DeriveParameters_S.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlConnection\SqlConnection_BeginTransaction_S.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlConnection\SqlConnection_InfoMessage.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlConnection\SqlConnection_StateChange.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlDataAdapter\SqlDataAdapter_RowUpdated.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlDataAdapter\SqlDataAdapter_RowUpdating.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlParameter\SqlParameter_ctor_SO.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlParameter\SqlParameter_Direction.cs" SubType="Code" BuildAction="Compile"/>
+				<File RelPath="System.Data.SqlClient.jvm\SqlParameter\SqlParameter_set_DbType_D.cs" SubType="Code" BuildAction="Compile"/>
 			</Include>
 		</Files>
 		<UserProperties jarserver="ipa" project.JDKType="1.5.0_05" REFS.JarPath.rt="..\..\..\..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE\jre5\lib\rt.jar" REFS.JarPath.system.xml="..\..\..\..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE\jgac\vmw4j2ee_110\System.Xml.jar" REFS.JarPath.system.data="..\..\..\..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE\jgac\vmw4j2ee_110\System.Data.jar" REFS.JarPath.system="..\..\..\..\..\..\..\..\Program Files\Mainsoft\Visual MainWin for J2EE\jgac\vmw4j2ee_110\System.jar"/>

+ 86 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommand/SqlCommand_ExecuteReader_.cs

@@ -0,0 +1,86 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlCommand_ExecuteReader_ : ADONetTesterClass
+	{
+		private Exception exp;
+		public static void Main()
+		{
+			SqlCommand_ExecuteReader_ tc = new SqlCommand_ExecuteReader_();
+			try
+			{
+				// Every Test must begin with BeginTest
+				tc.BeginTest("SqlCommand_ExecuteReader");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				tc.exp = ex;
+			}
+			finally
+			{
+				// Every Test must End with EndTest
+				tc.EndTest(tc.exp);
+			}
+		}
+
+
+		[Test] 
+		public void run()
+		{
+			// testing only SQLServerr
+			if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer)
+			{
+				Log("This test is relevant only for MSSQLServer!");
+				return;
+			}
+
+			TestCheckSqlStatementThatDeclaresLocalVariableAndUsesIt();
+		}
+
+		public void TestCheckSqlStatementThatDeclaresLocalVariableAndUsesIt()
+		{
+			SqlConnection conn = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+			SqlDataReader rdr=null;
+			try
+			{
+				BeginCase("Check sql statement that declares a local variable and uses it.");
+				SqlCommand cmd = new SqlCommand();
+				conn.Open();
+				cmd.Connection = conn;
+
+				cmd.CommandText = "declare @var int; select @var=1;";
+				cmd.CommandType = CommandType.Text;
+				
+				rdr = cmd.ExecuteReader();
+				Compare(rdr.Read(), false);
+			}
+			catch (Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				exp = null;
+				if (conn != null && conn.State != ConnectionState.Closed)
+				{
+					conn.Close();
+				}
+				if (rdr != null && !rdr.IsClosed)
+				{
+					rdr.Close();
+				}
+			}
+		}
+
+	}
+}

+ 90 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommand/SqlCommand_ExecuteXmlReader_.cs

@@ -0,0 +1,90 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+using System.Xml;
+using System.Text;
+using System.IO;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlCommand_ExecuteXmlReader_ : ADONetTesterClass
+	{
+		public static void Main()
+		{
+			SqlCommand_ExecuteXmlReader_ tc = new SqlCommand_ExecuteXmlReader_();
+			Exception exp = null;
+			try
+			{
+				// Every Test must begin with BeginTest
+				tc.BeginTest("SqlCommand_ExecuteXmlReader");
+
+				//testing only on SQLServer
+				if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer) return ; 
+
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				// Every Test must End with EndTest
+				tc.EndTest(exp);
+			}
+		}
+
+		[Test]
+		[Category("NotWorking")]
+		public void run()
+		{
+			Exception exp = null;
+
+			// Start Sub Test
+			try
+			{
+				// Every Sub Test must begin with BeginCase
+				BeginCase("ExecuteXmlReader 1");
+
+				SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+
+				con.Open();
+				string selectStr =	"SELECT * FROM Products WHERE PRODUCTID=1 FOR XML AUTO, XMLDATA;" + 
+					"SELECT * FROM Orders WHERE ORDERID=1 FOR XML AUTO, XMLDATA;" + 
+					"SELECT * FROM Customers WHERE CustomerID like 'A%' FOR XML AUTO, XMLDATA";
+			
+				SqlCommand comm = new SqlCommand(selectStr,con);
+				// ExecuteXmlReader is not supported yet
+				XmlReader xr = null; // = comm.ExecuteXmlReader();
+
+				StringBuilder sb = new StringBuilder();
+				while(xr.Read()) 
+				{
+					sb.Append(xr.ReadOuterXml());
+				}
+				// Every Sub Test must have a Compare
+				string strXml = null;
+				Compare(sb.ToString().Length,4391);
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				// Every Sub Test must end with EndCase
+				EndCase(exp);
+				exp = null;
+			}
+			// End Sub Test
+		}
+
+
+	}
+}

+ 140 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommand/SqlCommand_Parameters.cs

@@ -0,0 +1,140 @@
+using System;
+using System.Data;
+using System.Data.OleDb;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlCommand_Parameters : ADONetTesterClass
+	{
+		Exception exp;
+
+		public static void Main()
+		{
+			SqlCommand_Parameters tc = new SqlCommand_Parameters();
+			tc.exp = null;
+			try
+			{
+				tc.BeginTest("SqlCommand_Parameters");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				tc.exp = ex;
+			}
+			finally
+			{
+				tc.EndTest(tc.exp);
+			}
+		}
+
+		[Test] 
+		public void run()
+		{
+			// testing only SQLServerr
+			if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer)
+			{
+				Log("This test is relevant only for MSSQLServer!");
+				return;
+			}
+
+			CommandParameterTreatBitAsBoolean();
+			TestparametersBindByNameOnMSSQLServer();
+		
+		}
+
+		//Bug 2814 - MSSQL - Command.Parameters treat bit as Boolean ---- 
+		public void CommandParameterTreatBitAsBoolean()
+		{
+			exp=null;
+			SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+			try
+			{
+				BeginCase("Bug 2814 - MSSQL - Command.Parameters treat bit as Boolean");
+				SqlCommand cmd = new SqlCommand("SELECT * FROM Products where ProductID = @ProductID AND Discontinued = @Discontinued",con);
+				cmd.Connection = con;
+				con.Open();
+				cmd.CommandType = CommandType.Text;
+						
+				cmd.Parameters.Add( new SqlParameter("@ProductID", SqlDbType.Int, 4));
+				cmd.Parameters.Add( new SqlParameter("@Discontinued", SqlDbType.Int, 4));
+				
+				cmd.Parameters["@ProductID"].Value = 5;
+				cmd.Parameters["@Discontinued"].Value = 1;
+		
+				SqlDataReader dr = cmd.ExecuteReader();	
+				if (dr.HasRows)
+				{
+					dr.Read();
+					Compare(dr.GetValue(0).ToString(),"5");
+				}
+				else
+				{
+					Fail("HasRows is not 0.");
+				}					
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				if (con.State == ConnectionState.Open) 
+				{
+					con.Close();
+				}
+				EndCase(exp);
+				exp = null;
+			}
+		}
+		/// <summary>
+		/// Binding parameters in MSSQLServer should be done by parameter name, regardless of their order.
+		/// </summary>
+		public void TestparametersBindByNameOnMSSQLServer()
+		{
+			SqlConnection conn = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+			SqlDataReader rdr;
+			try
+			{
+				BeginCase("Insert parameters of the same types in different order.");
+				SqlCommand cmd = new SqlCommand();
+				conn.Open();
+				cmd.Connection = conn;
+
+				cmd.CommandText = "SalesByCategory";
+				cmd.CommandType = CommandType.StoredProcedure;
+				
+				//Stored procedure is declared as "SalesByCategory @CategoryName nvarchar(15), @OrdYear nvarchar(4) = '1998'"
+				//The test declares them in reverse order.
+				cmd.Parameters.Add("@OrdYear", "1996");
+				cmd.Parameters.Add("@CategoryName", "Beverages");
+
+				rdr = cmd.ExecuteReader();
+				int actualAffectedRows = 0;
+				while (rdr.Read())
+				{
+					actualAffectedRows++;
+				}
+				Compare(actualAffectedRows, 12);
+			}
+			catch (Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				exp = null;
+				if (conn.State != ConnectionState.Closed)
+				{
+					conn.Close();
+				}
+			}
+		}
+	}
+}

+ 122 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlCommandBuilder/SqlCommandBuilder_DeriveParameters_S.cs

@@ -0,0 +1,122 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlCommandBuilder_DeriveParameters_S : GHTBase
+	{
+		SqlConnection con;
+		SqlCommand cmd;
+		public static void Main()
+		{
+			SqlCommandBuilder_DeriveParameters_S tc = new SqlCommandBuilder_DeriveParameters_S();
+			Exception exp = null;
+			try
+			{
+				// Every Test must begin with BeginTest
+				tc.BeginTest("DeriveParameters");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				exp=ex;
+			}
+			finally
+			{
+				// Every Test must End with EndTest
+				tc.EndTest(exp);
+			}
+			
+			
+		}
+
+		[SetUp]
+		public void setUp()
+		{
+			if (con == null)
+			{
+				con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+				con.Open();
+			}
+		}
+
+		[TearDown]
+		public void tearDown()
+		{
+			if (con.State == ConnectionState.Open)
+			{
+				con.Close();
+			}
+
+		}
+
+		public void run()
+		{
+			if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer)
+			{
+				//All tests in this class are only for MSSQLServer.
+				Log(string.Format("All tests in this class are only for MSSQLServer and cannot be tested on {0}", ConnectedDataProvider.GetDbType()));
+				return;
+			}
+
+			setUp();
+			test();
+			tearDown();
+
+			
+		}
+
+		[Test]
+		public void test()
+		{
+			if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer)
+			{
+				//All tests in this class are only for MSSQLServer.
+				Log(string.Format("All tests in this class are only for MSSQLServer and cannot be tested on {0}", ConnectedDataProvider.GetDbType()));
+				return;
+			}
+
+			Exception exp = null;
+			BeginCase("Checking with sp that doesn't exsits ");
+			try
+			{
+				cmd = new SqlCommand("NotExists",con);
+				cmd.CommandType = CommandType.StoredProcedure;
+				SqlCommandBuilder.DeriveParameters(cmd);
+			} 
+			catch(InvalidOperationException ex)
+			{
+				ExpectedExceptionCaught(ex);
+				exp = ex;
+			}
+			finally
+			{
+				if (exp == null)
+				{
+					ExpectedExceptionNotCaught("InvalidOperationException");
+				}
+				EndCase(null);
+				exp = null;
+			}
+
+		}
+
+		//Activate This Construntor to log All To Standard output
+		//public TestClass():base(true){}
+
+		//Activate this constructor to log Failures to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, false){}
+
+		//Activate this constructor to log All to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, true){}
+
+		//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES
+
+	}
+}

+ 104 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlConnection/SqlConnection_BeginTransaction_S.cs

@@ -0,0 +1,104 @@
+using System;
+using System.Data;
+using System.Data.OleDb;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlConnection_BeginTransaction_S : ADONetTesterClass
+	{
+		SqlConnection con;
+
+		[SetUp]
+		public void SetUp()
+		{
+			Exception exp = null;
+			BeginCase("Setup");
+			try
+			{
+				con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+				con.Open();
+				Compare("Setup", "Setup");
+			}
+			catch(Exception ex)	{exp = ex;}
+			finally	{EndCase(exp); exp = null;}
+		}
+
+		[TearDown]
+		public void TearDown()
+		{
+			if (con != null)
+			{
+				if (con.State == ConnectionState.Open) con.Close();
+			}
+		}
+
+		public static void Main()
+		{
+			SqlConnection_BeginTransaction_S tc = new SqlConnection_BeginTransaction_S();
+			Exception exp = null;
+			try
+			{
+				tc.BeginTest("SqlConnection_BeginTransaction_S");
+
+				//testing only on SQLServer
+				if (ConnectedDataProvider.GetDbType(ConnectedDataProvider.ConnectionStringSQLClient) != DataBaseServer.SQLServer) return ; 
+
+				tc.SetUp();
+				tc.run();
+				tc.TearDown();
+			}
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				tc.EndTest(exp);
+			}
+		}
+
+		[Test] 
+		public void run()
+		{
+			Exception exp = null;
+
+			#region		---- Bug 2716 - MSSQL - SqlCommand.Transaction ---- 
+			// testing only SQLServerr
+			if (ConnectedDataProvider.GetDbType(con.ConnectionString) != DataBaseServer.SQLServer)
+			{
+				try
+				{
+					BeginCase("Bug 2716 - MSSQL - SqlCommand.Transaction");
+					SqlCommand comm = new SqlCommand("SELECT * FROM Customers",con);
+
+					SqlTransaction trans = con.BeginTransaction("transaction");
+					comm.Transaction = trans;
+
+					con.Close();
+					Compare(con.State,ConnectionState.Closed);
+				} 
+				catch(Exception ex)
+				{
+					exp = ex;
+				}
+				finally
+				{
+					if (con != null)
+					{if (con.State == ConnectionState.Open) con.Close();}
+
+					EndCase(exp);
+					exp = null;
+				}
+
+			}
+			#endregion
+
+		}
+	}
+}

+ 110 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlConnection/SqlConnection_InfoMessage.cs

@@ -0,0 +1,110 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using System.Threading;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlConnection_InfoMessage : GHTBase
+	{
+		private int errorCounter=0;
+
+		public static void Main()
+		{
+			SqlConnection_InfoMessage tc = new SqlConnection_InfoMessage();
+			Exception exp = null;
+			try
+			{
+				// Every Test must begin with BeginTest
+				tc.BeginTest("NoName");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				// Every Test must End with EndTest
+				tc.EndTest(exp);
+			}
+			// After test is ready, remove this line
+		
+		}
+
+		[Test] 
+		[Category("NotWorking")]
+		public void run()
+		{
+			Exception exp = null;
+
+			// Start Sub Test
+			try
+			{
+				BeginCase("InfoMessage testing");
+				SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+				con.Open();
+				con.InfoMessage+=new SqlInfoMessageEventHandler(con_InfoMessage);
+				generateError(con);
+				con.Close();
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				// Every Sub Test must end with EndCase
+				EndCase(exp);
+				exp = null;
+			}
+			// End Sub Test
+		}
+
+
+		private void generateError(SqlConnection con)
+		{
+			string errorString = string.Empty;
+			SqlCommand cmd = new SqlCommand (string.Empty,con); 
+			cmd.CommandText  = "Raiserror ('A sample SQL informational message',10,1)";
+
+			
+			cmd.ExecuteNonQuery();
+		
+		
+		
+			//				cmd.CommandText = "TestInfoMessage";
+			//				cmd.CommandType = CommandType.StoredProcedure;
+
+			
+			if (errorCounter == 0)
+			{
+				Thread.Sleep(5000);	
+			}
+			Compare(errorCounter,1);
+		}
+
+
+
+		//Activate This Construntor to log All To Standard output
+		//public TestClass():base(true){}
+
+		//Activate this constructor to log Failures to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, false){}
+
+		//Activate this constructor to log All to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, true){}
+
+		//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES
+
+		private void con_InfoMessage(object sender, SqlInfoMessageEventArgs e)
+		{
+			errorCounter++;
+		}
+	}
+}

+ 128 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlConnection/SqlConnection_StateChange.cs

@@ -0,0 +1,128 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlConnection_StateChange : GHTBase
+	{
+
+		public static void Main()
+		{
+			SqlConnection_StateChange tc = new SqlConnection_StateChange();
+			Exception exp = null;
+			try
+			{
+				tc.BeginTest("SqlConnection_StateChange");
+				tc.run();
+			}
+			catch(Exception ex){exp = ex;}
+			finally	{tc.EndTest(exp);}
+		}
+
+
+		bool blnEventRaised = false;
+		ConnectionState OriginalState,CurrentState;
+
+		[Test] 
+		public void run()
+		{
+			
+			Exception exp = null;
+
+			SqlConnection  con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+	        
+			// ----------- reserved for future versions of the product ---------------
+			//Broken	The connection to the data source is broken. This can occur only after the connection has been opened. A connection in this state may be closed and then re-opened. (This value is reserved for future versions of the product).
+			//Connecting  The connection object is connecting to the data source. (This value is reserved for future versions of the product.) 2 
+			//Executing The connection object is executing a command. (This value is reserved for future versions of the product.) 4 
+			//Fetching  The connection object is retrieving data. (This value is reserved for future versions of the product.) 8 
+
+			//-------------- checking only the following: ----------------
+			//Closed  The connection is closed.  
+			//Open  The connection is open. 
+
+
+			//add event handler
+			con.StateChange +=new StateChangeEventHandler(con_StateChange);
+
+			con.Open();
+			try
+			{
+				BeginCase("ConnectionState Closed");
+				Compare(blnEventRaised,true);
+			} 
+			catch(Exception ex){exp = ex;}
+			finally{EndCase(exp); exp = null;}
+
+			try
+			{
+				BeginCase("OriginalState Closed");
+				Compare(OriginalState,ConnectionState.Closed );
+			} 
+			catch(Exception ex){exp = ex;}
+			finally{EndCase(exp); exp = null;}
+
+			try
+			{
+				BeginCase("CurrentState Open");
+				Compare(CurrentState,ConnectionState.Open );
+			} 
+			catch(Exception ex){exp = ex;}
+			finally{EndCase(exp); exp = null;}
+
+			blnEventRaised = false;
+			con.Close();
+			try
+			{
+				BeginCase("ConnectionState Open");
+				Compare(blnEventRaised,true);
+			} 
+			catch(Exception ex){exp = ex;}
+			finally{EndCase(exp); exp = null;}
+
+			try
+			{
+				BeginCase("OriginalState Open");
+				Compare(OriginalState,ConnectionState.Open );
+			} 
+			catch(Exception ex){exp = ex;}
+			finally{EndCase(exp); exp = null;}
+
+			try
+			{
+				BeginCase("CurrentState Close");
+				Compare(CurrentState,ConnectionState.Closed  );
+			} 
+			catch(Exception ex){exp = ex;}
+			finally{EndCase(exp); exp = null;}
+
+			if (con.State == ConnectionState.Open) con.Close();
+		}
+
+		void con_StateChange(Object sender, StateChangeEventArgs e)
+		{
+			CurrentState = e.CurrentState ;
+			OriginalState = e.OriginalState ;
+			blnEventRaised = true;
+
+
+		}
+
+		//public TestClass():base(true){}
+
+		//Activate this constructor to log Failures to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, false){}
+
+		//Activate this constructor to log All to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, true){}
+
+		//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES
+
+	}
+}

+ 132 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlDataAdapter/SqlDataAdapter_RowUpdated.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlDataAdapter_RowUpdated : ADONetTesterClass
+	{
+		public static void Main()
+		{
+			SqlDataAdapter_RowUpdated tc = new SqlDataAdapter_RowUpdated();
+			Exception exp = null;
+			try
+			{
+				tc.BeginTest("SqlDataAdapter_RowUpdated");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				tc.EndTest(exp);
+			}
+		}
+
+		int EventCounter = 0;
+		DataRow drInsert,drDelete,drUpdate;
+
+		[Test] 
+		public void run()
+		{
+			if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer)
+			{
+				Log("Test \"SqlDataAdapter_RowUpdated\" skipped: [Test applies only to sql server]");
+				return;
+			}
+			Exception exp = null;
+
+			SqlDataAdapter  sqlDa = new SqlDataAdapter();
+			SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient); 
+			
+
+			sqlDa.SelectCommand = new SqlCommand("",con);
+
+			base.SqlDataAdapter_BuildUpdateCommands(ref sqlDa);		
+			// --------- get data from DB -----------------
+
+			DataSet ds = base.PrepareDBData_Update((DbDataAdapter)sqlDa,true);
+
+
+			// add event handler
+			sqlDa.RowUpdated+=new SqlRowUpdatedEventHandler(sqlDa_RowUpdated);
+			
+		
+				
+			//insert ,delete, update
+			drInsert = ds.Tables[0].NewRow();
+			drInsert.ItemArray = new object[] {9991,"Ofer","Borshtein","Insert"};
+			drDelete = ds.Tables[0].Rows.Find(9992);
+			drUpdate = ds.Tables[0].Rows.Find(9993);
+			
+			ds.Tables[0].Rows.Add(drInsert);
+			drDelete.Delete();
+			drUpdate["Title"] = "Jack the ripper"; 
+
+			//execute update to db, will raise events
+			sqlDa.Update(ds);
+
+			try
+			{
+				BeginCase("EventCounter ");
+				Compare(EventCounter ,3);
+			}
+			catch(Exception ex)	{exp = ex;}
+			finally	{EndCase(exp); exp = null;}
+			
+			sqlDa.RowUpdated-= new SqlRowUpdatedEventHandler(sqlDa_RowUpdated);
+			
+			//close connection
+			if (  ((IDbDataAdapter)sqlDa).SelectCommand.Connection.State != ConnectionState.Closed )
+				((IDbDataAdapter)sqlDa).SelectCommand.Connection.Close();
+		}
+
+
+		private void sqlDa_RowUpdated(object sender, SqlRowUpdatedEventArgs e)
+		{
+			Exception exp = null;
+			switch (e.StatementType)
+			{
+				case StatementType.Insert: 
+					try
+					{
+						BeginCase("RowInsert");
+						Compare(drInsert ,e.Row );
+					}
+					catch(Exception ex)	{exp = ex;}
+					finally	{EndCase(exp); exp = null;}
+					EventCounter++;
+					break;
+				case StatementType.Delete:
+					try
+					{
+						BeginCase("RowDelete");
+						Compare(drDelete ,e.Row );
+					}
+					catch(Exception ex)	{exp = ex;}
+					finally	{EndCase(exp); exp = null;}
+					EventCounter++;
+					break;
+				case StatementType.Update:
+					try
+					{
+						BeginCase("RowUpdate");
+						Compare(drUpdate ,e.Row );
+					}
+					catch(Exception ex)	{exp = ex;}
+					finally	{EndCase(exp); exp = null;}
+					EventCounter++;
+					break;
+			}
+
+		}
+	}
+}

+ 145 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlDataAdapter/SqlDataAdapter_RowUpdating.cs

@@ -0,0 +1,145 @@
+using System;
+using System.Data;
+using System.Data.Common;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlDataAdapter_RowUpdating : ADONetTesterClass
+	{
+		public static void Main()
+		{
+			SqlDataAdapter_RowUpdating tc = new SqlDataAdapter_RowUpdating();
+			Exception exp = null;
+			try
+			{
+				tc.BeginTest("SqlDataAdapter_RowUpdating");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				tc.EndTest(exp);
+			}
+		}
+
+
+		//public TestClass():base(true){}
+
+		//Activate this constructor to log Failures to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, false){}
+
+
+		//Activate this constructor to log All to a log file
+		//public TestClass(System.IO.TextWriter tw):base(tw, true){}
+
+		//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES
+
+		int EventCounter = 0;
+		DataRow drInsert,drDelete,drUpdate;
+		[Test] 
+		public void run()
+		{
+			if (ConnectedDataProvider.GetDbType() != DataBaseServer.SQLServer)
+			{
+				Log("Test \"SqlDataAdapter_RowUpdated\" skipped: [Test applies only to sql server]");
+				return;
+			}
+
+			Exception exp = null;
+
+			SqlDataAdapter  sqlDa = new SqlDataAdapter();
+			SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient); 
+
+			sqlDa.SelectCommand = new SqlCommand("",con);
+
+			base.SqlDataAdapter_BuildUpdateCommands(ref sqlDa);		
+			// --------- get data from DB -----------------
+
+			DataSet ds = base.PrepareDBData_Update((DbDataAdapter)sqlDa,true);
+
+
+			// add event handler
+			sqlDa.RowUpdating+=new SqlRowUpdatingEventHandler(sqlDa_RowUpdating);
+			
+			
+			
+		
+				
+			//insert ,delete, update
+			drInsert = ds.Tables[0].NewRow();
+			drInsert.ItemArray = new object[] {9991,"Ofer","Borshtein","Insert"};
+			drDelete = ds.Tables[0].Rows.Find(9992);
+			drUpdate = ds.Tables[0].Rows.Find(9993);
+			
+			ds.Tables[0].Rows.Add(drInsert);
+			drDelete.Delete();
+			drUpdate["Title"] = "Jack the ripper"; 
+
+			//execute update to db, will raise events
+			sqlDa.Update(ds);
+
+			try
+			{
+				BeginCase("EventCounter ");
+				Compare(EventCounter ,3);
+			}
+			catch(Exception ex)	{exp = ex;}
+			finally	{EndCase(exp); exp = null;}
+			
+			sqlDa.RowUpdating-= new SqlRowUpdatingEventHandler(sqlDa_RowUpdating);
+			
+			//close connection
+			if (  ((IDbDataAdapter)sqlDa).SelectCommand.Connection.State != ConnectionState.Closed )
+				((IDbDataAdapter)sqlDa).SelectCommand.Connection.Close();
+		}
+
+
+		private void sqlDa_RowUpdating(object sender, SqlRowUpdatingEventArgs e)
+		{
+			Exception exp = null;
+			switch (e.StatementType)
+			{
+				case StatementType.Insert: 
+					try
+					{
+						BeginCase("RowInsert");
+						Compare(drInsert ,e.Row );
+					}
+					catch(Exception ex)	{exp = ex;}
+					finally	{EndCase(exp); exp = null;}
+					EventCounter++;
+					break;
+				case StatementType.Delete:
+					try
+					{
+						BeginCase("RowDelete");
+						Compare(drDelete ,e.Row );
+					}
+					catch(Exception ex)	{exp = ex;}
+					finally	{EndCase(exp); exp = null;}
+					EventCounter++;
+					break;
+				case StatementType.Update:
+					try
+					{
+						BeginCase("RowUpdate");
+						Compare(drUpdate ,e.Row );
+					}
+					catch(Exception ex)	{exp = ex;}
+					finally	{EndCase(exp); exp = null;}
+					EventCounter++;
+					break;
+			}
+
+		}
+	}
+}

+ 145 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlParameter/SqlParameter_Direction.cs

@@ -0,0 +1,145 @@
+using System;
+using System.Text;
+using System.Data;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlParameter_Direction : GHTBase
+	{
+		private Exception exp;
+		public static void Main()
+		{
+			SqlParameter_Direction tc = new SqlParameter_Direction();
+			tc.exp = null;
+			tc.TestSetup();
+			try
+			{
+				// Every Test must begin with BeginTest
+				tc.BeginTest("SqlParameter_Direction");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				tc.exp = ex;
+			}
+			finally
+			{
+				tc.EndTest(tc.exp);
+				tc.TestTearDown();
+			}
+		}
+ 
+		public void run()
+		{
+			TestBug4703();
+		}
+
+		[TestFixtureSetUp]
+		public void TestSetup()
+		{
+			BeginCase("Test Setup");
+			SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+			StringBuilder createTestSpBuilder = new StringBuilder();
+			createTestSpBuilder.Append("CREATE PROCEDURE dbo.GHSP_DateTimeOutputTest");
+			createTestSpBuilder.Append("(");
+			createTestSpBuilder.Append("	@LastRefresh datetime OUTPUT");
+			createTestSpBuilder.Append(")");
+			createTestSpBuilder.Append("AS ");
+			createTestSpBuilder.Append("SET @LastRefresh = GETDATE() ");
+			createTestSpBuilder.Append("RETURN");
+			SqlCommand createTestSpCmd = null;
+			try
+			{
+				createTestSpCmd = new SqlCommand(createTestSpBuilder.ToString(), con);
+				con.Open();
+				createTestSpCmd.ExecuteNonQuery();
+				Pass("Test setup completed successfuly.");
+			}
+			catch (Exception ex)
+			{
+				Fail("Test setup failed");
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				if (con != null && con.State != ConnectionState.Closed)
+				{
+					con.Close();
+				}
+			}
+		}
+
+		[TestFixtureTearDown()]
+		public void TestTearDown()
+		{
+			BeginCase("Test Teardown");
+			SqlConnection con = new SqlConnection(ConnectedDataProvider.ConnectionStringSQLClient);
+			StringBuilder createTestSpBuilder = new StringBuilder();
+			string dropTestSpSql = "DROP PROCEDURE dbo.GHSP_DateTimeOutputTest";
+			SqlCommand dropTestSpCmd = null;
+			try
+			{
+				dropTestSpCmd = new SqlCommand(dropTestSpSql, con);
+				con.Open();
+				dropTestSpCmd.ExecuteNonQuery();
+				Pass("Test teardown completed successfuly.");
+			}
+			catch (Exception ex)
+			{
+				Fail("Test teardown failed");
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				if (con != null && con.State != ConnectionState.Closed)
+				{
+					con.Close();
+				}
+			}
+		}
+		
+		[Test]
+		public void TestBug4703()
+		{
+			try
+			{
+				BeginCase("Test Bug 4703 - DateTime output parameter of stored procedure contains incorrect time ( always 12:00 AM )");
+				string strConnection = ConnectedDataProvider.ConnectionStringSQLClient;
+				SqlConnection conn = new SqlConnection(strConnection);
+				conn.Open();
+				SqlCommand command = conn.CreateCommand();
+				SqlParameter param = null;
+
+				command.CommandType = CommandType.StoredProcedure;
+				command.CommandText = "GHSP_DateTimeOutputTest";
+
+				param = command.CreateParameter();
+				param.ParameterName="@LastRefresh";
+				param.DbType = DbType.DateTime;
+				param.Direction = ParameterDirection.InputOutput;
+				DateTime testValue = DateTime.Now;
+				param.Value = testValue;
+
+				command.Parameters.Add( param );
+				Compare(param.Value, testValue);
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				exp = null;
+			}
+		}
+	}
+}

+ 89 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlParameter/SqlParameter_ctor_SO.cs

@@ -0,0 +1,89 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlParameter_ctor_SO : GHTBase
+	{
+		private Exception exp = null;
+
+		public static void Main()
+		{
+			SqlParameter_ctor_SO tc = new SqlParameter_ctor_SO();
+			try
+			{
+				tc.BeginTest("SqlParameter_ctor_SO");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				tc.exp = ex;
+			}
+			finally
+			{
+				// Every Test must End with EndTest
+				tc.EndTest(tc.exp);
+			}
+		}
+
+		public void run()
+		{
+			CreateParamWithTypeBoolTrue();
+			CreateParamWithTypeBoolFalse();
+		}
+
+		[Test(Description="Create an SqlParameter with value of type bool (true)")]
+		public void CreateParamWithTypeBoolTrue()
+		{
+			exp = null;
+
+			try
+			{
+				BeginCase("Create an SqlParameter with value of type bool (true)");
+				SqlParameter p = new SqlParameter("name", true);
+				Compare(p.Value.GetType(), typeof(bool));
+				Compare(p.DbType, DbType.Boolean);
+				Compare(p.SqlDbType, SqlDbType.Bit);
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				exp = null;
+			}
+		}
+
+		[Test(Description="Create an SqlParameter with value of type bool (false)")]
+		public void CreateParamWithTypeBoolFalse()
+		{
+			exp = null;
+
+			try
+			{
+				BeginCase("Create an SqlParameter with value of type bool (false)");
+				SqlParameter p = new SqlParameter("name", false);
+				Compare(p.Value.GetType(), typeof(bool));
+				Compare(p.DbType, DbType.Boolean);
+				Compare(p.SqlDbType, SqlDbType.Bit);
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				EndCase(exp);
+				exp = null;
+			}
+		}
+	}
+}

+ 69 - 0
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient.jvm/SqlParameter/SqlParameter_set_DbType_D.cs

@@ -0,0 +1,69 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+
+using MonoTests.System.Data.Utils;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Data.SqlClient
+{
+	[TestFixture]
+	public class SqlParameter_set_DbType_D : GHTBase
+	{
+		private Exception exp;
+		public static void Main()
+		{
+			SqlParameter_set_DbType_D tc = new SqlParameter_set_DbType_D();
+			tc.exp = null;
+			try
+			{
+				// Every Test must begin with BeginTest
+				tc.BeginTest("SqlParameter_set_DbType_D");
+				tc.run();
+			}
+			catch(Exception ex)
+			{
+				tc.exp = ex;
+			}
+			finally
+			{
+				// Every Test must End with EndTest
+				tc.EndTest(tc.exp);
+			}
+		}
+ 
+		public void run()
+		{
+			TestBug4689();
+		}
+
+		[Test]
+		public void TestBug4689()
+		{
+			try
+			{
+				// Every Sub Test must begin with BeginCase
+				BeginCase("Test Bug 4689 - Exception when adding System.Data.DbType.Date parameter");
+				SqlCommand command = new SqlCommand();
+				SqlParameter param = command.CreateParameter();
+				param.ParameterName = "@EffectiveDate";
+				param.DbType = DbType.Date;
+				param.Value = DateTime.Now.Date;
+				command.Parameters.Add(param);
+				Pass("Addition of parameter didn't throw exception.");
+			} 
+			catch(Exception ex)
+			{
+				exp = ex;
+			}
+			finally
+			{
+				// Every Sub Test must end with EndCase
+				EndCase(exp);
+				exp = null;
+			}
+		}
+
+	}
+}

+ 0 - 2
mcs/class/System.Data/run-tests.test.connected.bat

@@ -130,8 +130,6 @@ REM ********************************************************
 xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML%
 @echo off
 
-@echo
-
 :FINALLY
 GOTO END