Author: anagappan
Date: 2007-03-30 07:44:22 -0500 (Fri, 30 Mar 2007)
New Revision: 75190

Modified:
   
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/ChangeLog
   
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
   
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
   
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
   
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
   
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterTest.cs
Log:
2007-03-23  Nidhi Rawal <[EMAIL PROTECTED]>

        * SqlCommandTest.cs (BeginExecuteXmlReaderTest): Written test case for 
the method
        BeginExecuteXmlReader.
        (BeginExecuteXmlReaderExceptionTest): Written test case for the method 
BeginExecuteXmlReader
        to check for InvalidOperationException.
        (CloneObjTest): Written test case for the method Clone.
        
        * SqlConnectionTest.cs (ChangePasswordNullConnStringTest): Written test 
case for the method
        ChangePassword to check for null connection string.
        (ChangePasswordNullPasswordTest): Written test case for the method 
ChangePassword to check for
        null new password.
        (ChangePasswordEmptyPasswordTest): Written test case for the method 
ChangePassword to check for
        password as empty string.
        (ChangePasswordExceedPasswordTest): Written test case for the method 
ChangePassword to check
        if the password exceeds its permitted size.
        
        * SqlClientFactory.cs: Created the class.
        (CreatePermissionTest): Added a test case for the method 
CreatePermission.

2007-03-20  Nidhi Rawal <[EMAIL PROTECTED]>

        * SqlConnectionStringBuilderTest.cs: Fixed the bug by including the 
        category sqlserver, in the absence of which none of the test-cases
        were executing.
        (TrustServerCertificateTest): Written test-case for the property 
TrustServerCertificate.
        (TypeSystemVersionTest): Written test-case for the property 
TypeSystemVersion.
        (UserInstanceTest): Written test-case for the property UserInstance.
        (SettingUserInstanceTest): Written test-case for checking the 
connection string after
        assigning the value for keyword User Instance.
        (ContextConnectionTest): Written test-case for the property 
ContextConnection.
        (SettingContextConnectionTest): Written test-case for checking the 
connection string after
        assigning the value for keyword Context Connection.

        * SqlCommandTest.cs (NotificationTest): Written test-case for property 
Notification.
        (NotificationAutoEnlistTest): Written the test-case for property 
NotificationAutoEnlist.

        * SqlConnectionTest.cs (FireInfoMessageEventOnUserErrorsTest): Written
        test-case for the property FireInfoMessageEventOnUserErrors.
        (StatisticsEnabledTest): Written test-case for the property 
StatisticsEnabled.

        * SqlDataAdapterTest.cs (UpdateBatchSizeTest): Written test-case for the
        property UpdateBatchSize.
        (UpdateBatchSizeArgumentOutOfRangeTest): Written test-case for the 
ArgumentOutOfRange
        exception for UpdateBatchSize property.

2007-03-19  Nidhi Rawal <[EMAIL PROTECTED]>

        * SqlParameterTest.cs (CompareInfoTest): Written the test case
        for property CompareInfo.
        (LocaleIdTest): Written the test case for property LocaleId.
        (SqlValueTest): Written test case for property SqlValue.



Modified: 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/ChangeLog
===================================================================
--- 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/ChangeLog  
    2007-03-30 12:43:28 UTC (rev 75189)
+++ 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/ChangeLog  
    2007-03-30 12:44:22 UTC (rev 75190)
@@ -1,3 +1,56 @@
+2007-03-23  Nidhi Rawal <[EMAIL PROTECTED]>
+
+       * SqlCommandTest.cs (BeginExecuteXmlReaderTest): Written test case for 
the method
+       BeginExecuteXmlReader.
+       (BeginExecuteXmlReaderExceptionTest): Written test case for the method 
BeginExecuteXmlReader
+       to check for InvalidOperationException.
+       (CloneObjTest): Written test case for the method Clone.
+       
+       * SqlConnectionTest.cs (ChangePasswordNullConnStringTest): Written test 
case for the method
+       ChangePassword to check for null connection string.
+       (ChangePasswordNullPasswordTest): Written test case for the method 
ChangePassword to check for
+       null new password.
+       (ChangePasswordEmptyPasswordTest): Written test case for the method 
ChangePassword to check for
+       password as empty string.
+       (ChangePasswordExceedPasswordTest): Written test case for the method 
ChangePassword to check
+       if the password exceeds its permitted size.
+       
+       * SqlClientFactory.cs: Created the class.
+       (CreatePermissionTest): Added a test case for the method 
CreatePermission.
+
+2007-03-20  Nidhi Rawal <[EMAIL PROTECTED]>
+
+       * SqlConnectionStringBuilderTest.cs: Fixed the bug by including the 
+       category sqlserver, in the absence of which none of the test-cases
+       were executing.
+       (TrustServerCertificateTest): Written test-case for the property 
TrustServerCertificate.
+       (TypeSystemVersionTest): Written test-case for the property 
TypeSystemVersion.
+       (UserInstanceTest): Written test-case for the property UserInstance.
+       (SettingUserInstanceTest): Written test-case for checking the 
connection string after
+       assigning the value for keyword User Instance.
+       (ContextConnectionTest): Written test-case for the property 
ContextConnection.
+       (SettingContextConnectionTest): Written test-case for checking the 
connection string after
+       assigning the value for keyword Context Connection.
+
+       * SqlCommandTest.cs (NotificationTest): Written test-case for property 
Notification.
+       (NotificationAutoEnlistTest): Written the test-case for property 
NotificationAutoEnlist.
+
+       * SqlConnectionTest.cs (FireInfoMessageEventOnUserErrorsTest): Written
+       test-case for the property FireInfoMessageEventOnUserErrors.
+       (StatisticsEnabledTest): Written test-case for the property 
StatisticsEnabled.
+
+       * SqlDataAdapterTest.cs (UpdateBatchSizeTest): Written test-case for the
+       property UpdateBatchSize.
+       (UpdateBatchSizeArgumentOutOfRangeTest): Written test-case for the 
ArgumentOutOfRange
+       exception for UpdateBatchSize property.
+
+2007-03-19  Nidhi Rawal <[EMAIL PROTECTED]>
+
+       * SqlParameterTest.cs (CompareInfoTest): Written the test case
+       for property CompareInfo.
+       (LocaleIdTest): Written the test case for property LocaleId.
+       (SqlValueTest): Written test case for property SqlValue.
+
 2007-03-16  Andreia Gaita  <[EMAIL PROTECTED]>
 
        * SqlCommandTest.cs: Add OutputParamSizeTest1-4 to test size/value

Modified: 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
===================================================================
--- 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
      2007-03-30 12:43:28 UTC (rev 75189)
+++ 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlCommandTest.cs
      2007-03-30 12:44:22 UTC (rev 75190)
@@ -33,6 +33,10 @@
 using System.Data;
 using System.Data.Common;
 using System.Data.SqlClient;
+#if NET_2_0
+using System.Data.Sql;
+using System.Xml;
+#endif
 
 using NUnit.Framework;
 
@@ -1007,6 +1011,96 @@
                        cmd.ExecuteNonQuery ();
                }
 
+#if NET_2_0 
+               [Test]
+               public void NotificationTest () 
+               {
+                       cmd = new SqlCommand ();
+                       SqlNotificationRequest notification = new 
SqlNotificationRequest("MyNotification","MyService",15);
+                       Assert.AreEqual (null, cmd.Notification, "#1 The 
default value for this property should be null");
+                       cmd.Notification = notification;
+                       Assert.AreEqual ("MyService", cmd.Notification.Options, 
"#2 The value should be MyService as the constructor is initiated with this 
value");
+                       Assert.AreEqual (15, cmd.Notification.Timeout, "#2 The 
value should be 15 as the constructor is initiated with this value");
+               }
+
+               [Test]
+               public void NotificationAutoEnlistTest () 
+               {
+                       cmd = new SqlCommand ();
+                       Assert.AreEqual (true, cmd.NotificationAutoEnlist, "#1 
Default value of the property should be true");
+                       cmd.NotificationAutoEnlist = false;
+                       Assert.AreEqual (false, cmd.NotificationAutoEnlist, "#2 
The value of the property should be false after setting it to false");
+               }
+
+               [Test]          
+               public void BeginExecuteXmlReaderTest ()
+               {
+                       cmd = new SqlCommand ();
+                       string connectionString1 = null;
+                       connectionString1 = 
ConnectionManager.Singleton.ConnectionString + "Asynchronous Processing=true";
+                       try {
+                               SqlConnection conn1 = new SqlConnection 
(connectionString1); 
+                               conn1.Open ();
+                               cmd.CommandText = "Select lname from employee 
where id<2 FOR XML AUTO, XMLDATA" ;
+                               cmd.Connection = conn1;
+                       
+                               IAsyncResult result = cmd.BeginExecuteXmlReader 
();
+                               XmlReader reader = cmd.EndExecuteXmlReader 
(result);
+                               while (reader.Read ())
+                               {
+                                       if (reader.LocalName.ToString () == 
"employee")
+                                       {
+                                               Assert.AreEqual ("kumar", 
reader["lname"], "#1 ");
+                                       }
+                               }
+                       } finally {
+                               ConnectionManager.Singleton.CloseConnection ();
+                       }
+               }
+               
+               [Test]
+               public void BeginExecuteXmlReaderExceptionTest ()
+               {
+                       cmd = new SqlCommand ();
+                       try {
+                               SqlConnection conn = new SqlConnection 
(connectionString); 
+                               conn.Open ();
+                               cmd.CommandText = "Select lname from employee 
where id<2 FOR XML AUTO, XMLDATA" ;
+                               cmd.Connection = conn;
+                               
+                               try {
+                                       IAsyncResult result = 
cmd.BeginExecuteXmlReader ();
+                               } catch (InvalidOperationException) {
+                                       Assert.AreEqual 
(ConnectionManager.Singleton.ConnectionString, connectionString, "#1 Connection 
string has changed");
+                                       return;
+                               }
+                               Assert.Fail ("Expected Exception 
InvalidOperationException not thrown");
+                       } finally {
+                               ConnectionManager.Singleton.CloseConnection ();
+                       }               
+               }
+               
+               [Test]
+               public void CloneObjTest ()
+               {
+                       SqlCommand cmd = new SqlCommand();
+                       cmd.CommandText = "sp_insert";
+                       cmd.CommandType = CommandType.StoredProcedure;
+                       Object TestPar = DBNull.Value;
+                       cmd.Parameters.Add ("@TestPar1", SqlDbType.Int);
+                       cmd.Parameters ["@TestPar1"].Value = TestPar;
+                       cmd.Parameters.Add ("@BirthDate", DateTime.Now);
+                       cmd.DesignTimeVisible = true;
+                       cmd.CommandTimeout = 100;
+                       SqlCommand cmd1 = cmd.Clone ();
+                       Assert.AreEqual (2, cmd1.Parameters.Count);
+                       Assert.AreEqual (100, cmd1.CommandTimeout);
+                       cmd1.Parameters.Add ("@test", DateTime.Now);
+                       Assert.AreEqual (3, cmd1.Parameters.Count);
+                       Assert.AreEqual (2, cmd.Parameters.Count);
+               }
+#endif
+
                private enum Status { 
                        OK = 0,
                        Error = 3

Modified: 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
===================================================================
--- 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
      2007-03-30 12:43:28 UTC (rev 75189)
+++ 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionStringBuilderTest.cs
      2007-03-30 12:44:22 UTC (rev 75190)
@@ -45,9 +45,10 @@
 namespace MonoTests.System.Data.Common
 {
 
-        [TestFixture]
-        public class SqlConnectionStringBuilderTest
-        {
+       [TestFixture]
+       [Category ("sqlserver")]
+       public class SqlConnectionStringBuilderTest
+       {
                private SqlConnectionStringBuilder builder = null;
                
                [Test]
@@ -122,7 +123,62 @@
                        Assert.AreEqual ("Data Source=localhost", 
builder.ConnectionString,
                                         "#RT3 should have removed the key");
                }
+
+               [Test]
+               public void TrustServerCertificateTest ()
+               {
+                       builder = new SqlConnectionStringBuilder ();
+                       Assert.AreEqual (false, builder.TrustServerCertificate, 
"#1 The default value should be false");
+                       builder.TrustServerCertificate = true;
+                       Assert.AreEqual (true, builder.TrustServerCertificate, 
"#2 The value returned should be true after setting the value of 
TrustServerCertificate to true");
+                       Assert.AreEqual ("Trust Server Certificate=True", 
builder.ConnectionString, "#3 The value of the key TrustServerCertificate 
should be added to the connection string");
+               }
                
+               [Test]
+               public void TypeSystemVersionTest ()
+               {
+                       builder = new SqlConnectionStringBuilder ();
+                       Assert.AreEqual ("Latest", builder.TypeSystemVersion, 
"#1 The default value for the property should be Latest");
+                       builder.TypeSystemVersion = "SQL Server 2005";
+                       Assert.AreEqual ("SQL Server 2005", 
builder.TypeSystemVersion, "#2 The value for the property should be SQL Server 
2005 after setting this value");
+                       Assert.AreEqual ("Type System Version=SQL Server 2005", 
builder.ConnectionString, "#3 The value of the key Type System Version should 
be added to the connection string");
+               }
+
+               [Test]
+               public void UserInstanceTest ()
+               {
+                       builder = new SqlConnectionStringBuilder ();
+                       Assert.AreEqual (false, builder.UserInstance, "#1 The 
default value for the property should be false");
+                       builder.UserInstance = true;
+                       Assert.AreEqual (true, builder.UserInstance, "#2 The 
value for the property should be true after setting its value to true");
+                       Assert.AreEqual ("User Instance=True", 
builder.ConnectionString, "#3 The value of the key User Instance should be 
added to the connection string");
+               }
+
+               [Test]
+               public void SettingUserInstanceTest ()
+               {
+                       builder = new SqlConnectionStringBuilder ();
+                       builder["User Instance"] = true;
+                       Assert.AreEqual ("User Instance=True", 
builder.ConnectionString, "#1 The value of the key User Instance should be 
added to the connection string");                     
+               }
+
+               [Test]
+               public void ContextConnectionTest ()
+               {
+                       builder = new SqlConnectionStringBuilder ();
+                       Assert.AreEqual (false, builder.ContextConnection, "#1 
The default value for the property should be false");
+                       builder.ContextConnection = true;
+                       Assert.AreEqual (true, builder.ContextConnection, "#2 
The value for the property should be true after setting its value to true");    
                  
+                       Assert.AreEqual ("Context Connection=True", 
builder.ConnectionString, "#3 The value of the key Context Connection should be 
added to the connection string");
+               }
+
+               [Test]
+               public void SettingContextConnectionTest ()
+               {
+                       builder = new SqlConnectionStringBuilder ();
+                       builder["Context Connection"] = true;
+                       Assert.AreEqual ("Context Connection=True", 
builder.ConnectionString, "#1 The value of the key Context Connection should be 
added to the connection string");                   
+               }
        }
 }
 

Modified: 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
===================================================================
--- 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
   2007-03-30 12:43:28 UTC (rev 75189)
+++ 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs
   2007-03-30 12:44:22 UTC (rev 75190)
@@ -570,6 +570,69 @@
                {
                        disposedEventCount++; 
                }
+               
+#if NET_2_0
+               [Test]
+               public void FireInfoMessageEventOnUserErrorsTest ()
+               {
+                       conn = new SqlConnection (); 
+                       Assert.AreEqual(false, 
conn.FireInfoMessageEventOnUserErrors, "#1 The default value should be false");
+                       conn.FireInfoMessageEventOnUserErrors = true;
+                       Assert.AreEqual(true, 
conn.FireInfoMessageEventOnUserErrors, "#1 The value should be true after 
setting the property to true");
+               }
+
+               [Test]
+               public void StatisticsEnabledTest ()
+               {
+                       conn = new SqlConnection (); 
+                       Assert.AreEqual(false, conn.StatisticsEnabled, "#1 The 
default value should be false");
+                       conn.StatisticsEnabled = true;
+                       Assert.AreEqual(true, conn.StatisticsEnabled, "#1 The 
value should be true after setting the property to true");
+               }
+
+               [Test]
+               public void ChangePasswordTest ()
+               {
+                       string tmpPassword = "modifiedbymonosqlclient";
+                       SqlConnection.ChangePassword (connectionString, 
tmpPassword);
+                       SqlConnectionStringBuilder connBuilder = new 
SqlConnectionStringBuilder (connectionString);
+                       string oldPassword = connBuilder.Password;
+                       connBuilder.Password = tmpPassword;
+                       SqlConnection.ChangePassword 
(connBuilder.ConnectionString, oldPassword); // Modify to the original password
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ChangePasswordNullConnStringTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       SqlConnection.ChangePassword (null, "mono");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ChangePasswordNullPasswordTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       SqlConnection.ChangePassword (connectionString, null);
+               }
+
+               [Test]
+               [ExpectedException (typeof (ArgumentNullException))]
+               public void ChangePasswordEmptyPasswordTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       SqlConnection.ChangePassword (connectionString, "");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (ArgumentException))]
+               public void ChangePasswordExceedPasswordTest ()
+               {
+                       conn = new SqlConnection (connectionString);
+                       SqlConnection.ChangePassword 
(connectionString,"ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd");
+               }
+#endif         
        }
 #if NET_2_0
        [TestFixture]

Modified: 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
===================================================================
--- 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
  2007-03-30 12:43:28 UTC (rev 75189)
+++ 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlDataAdapterTest.cs
  2007-03-30 12:44:22 UTC (rev 75190)
@@ -879,6 +879,25 @@
                                Assert.AreEqual (2, table2.Rows.Count, "#2");
                        }
                }
+
+#if NET_2_0
+               [Test]
+               public void UpdateBatchSizeTest ()
+               {
+                       adapter = new SqlDataAdapter();
+                       Assert.AreEqual (1, adapter.UpdateBatchSize, "#1 The 
default value should be 1");
+                       adapter.UpdateBatchSize = 3;
+                       Assert.AreEqual (3, adapter.UpdateBatchSize, "#2 The 
value should be 3 after setting the property UpdateBatchSize to 3");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (ArgumentOutOfRangeException))]
+               public void UpdateBatchSizeArgumentOutOfRangeTest ()
+               {
+                       adapter = new SqlDataAdapter();
+                       adapter.UpdateBatchSize = -2;   
+               }
+#endif
        }
 
 #if NET_2_0

Modified: 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterTest.cs
===================================================================
--- 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterTest.cs
    2007-03-30 12:43:28 UTC (rev 75189)
+++ 
trunk/mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlParameterTest.cs
    2007-03-30 12:44:22 UTC (rev 75190)
@@ -31,6 +31,7 @@
 using System.Data;
 using System.Data.Common;
 using System.Data.SqlClient;
+using System.Data.SqlTypes;
 
 using NUnit.Framework;
 
@@ -87,5 +88,38 @@
                        param2.Value = 1;
                        Assert.AreEqual (SqlDbType.NVarChar, param2.SqlDbType, 
"#8");
                }
+
+#if NET_2_0
+               [Test]
+               public void CompareInfoTest ()
+               {
+                       SqlParameter parameter = new SqlParameter ();
+                       Assert.AreEqual (SqlCompareOptions.None, 
parameter.CompareInfo, "#1 Default value should be 
System.Data.SqlTypes.SqlCompareOptions.None");
+
+                       parameter.CompareInfo = 
SqlCompareOptions.IgnoreNonSpace;
+                       Assert.AreEqual (SqlCompareOptions.IgnoreNonSpace, 
parameter.CompareInfo, "#2 It should return CompareOptions.IgnoreSpace after 
setting this value for the property");
+               }
+       
+               [Test]
+               public void LocaleIdTest ()
+               {
+                       SqlParameter parameter = new SqlParameter ();
+                       Assert.AreEqual (0, parameter.LocaleId, "#1 Default 
value for the property should be 0");
+
+                       parameter.LocaleId = 15;
+                       Assert.AreEqual(15, parameter.LocaleId, "#2");
+               }
+
+               [Test]
+               public void SqlValue ()
+               {
+                       SqlParameter parameter = new SqlParameter ();
+                       Assert.AreEqual (null, parameter.SqlValue, "#1 Default 
value for the property should be Null");
+
+                       parameter.SqlValue = SqlDbType.Char.ToString ();
+                       Assert.AreEqual ("Char", parameter.SqlValue, "#1 The 
value for the property should be Char after setting SqlDbType to Char");
+               }
+#endif
+
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to