[System*] Throw a PlatformNotSupported exception when using the managed networking...
[mono.git] / mcs / class / System.Data / Test / System.Data.SqlClient / SqlConnectionTest.cs
index 78e096d30f33dae5a2bd18af6181380d0e8a3fc9..9511be24f7535375f8298d0c559a174d70452296 100644 (file)
@@ -39,6 +39,9 @@ namespace MonoTests.System.Data.SqlClient
        public class SqlConnectionTest\r
        {\r
                [Test] // SqlConnection ()\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Constructor1 ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -48,21 +51,18 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.IsNull (cn.Container, "#3");\r
                        Assert.AreEqual (string.Empty, cn.Database, "#4");\r
                        Assert.AreEqual (string.Empty, cn.DataSource, "#5");\r
-#if NET_2_0\r
                        Assert.IsFalse (cn.FireInfoMessageEventOnUserErrors, "#6");\r
                        Assert.AreEqual (8000, cn.PacketSize, "#7");\r
-#else\r
-                       Assert.AreEqual (8192, cn.PacketSize, "#7");\r
-#endif\r
                        Assert.IsNull (cn.Site, "#8");\r
                        Assert.AreEqual (ConnectionState.Closed, cn.State, "#9");\r
-#if NET_2_0\r
                        Assert.IsFalse (cn.StatisticsEnabled, "#10");\r
-#endif\r
                        Assert.IsTrue (string.Compare (Environment.MachineName, cn.WorkstationId, true) == 0, "#11");\r
                }\r
 \r
                [Test] // SqlConnection (string)\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Constructor2 ()\r
                {\r
                        string connectionString = "server=SQLSRV; database=Mono;";\r
@@ -73,17 +73,11 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.IsNull (cn.Container, "#A3");\r
                        Assert.AreEqual ("Mono", cn.Database, "#A4");\r
                        Assert.AreEqual ("SQLSRV", cn.DataSource, "#A5");\r
-#if NET_2_0\r
                        Assert.IsFalse (cn.FireInfoMessageEventOnUserErrors, "#A6");\r
                        Assert.AreEqual (8000, cn.PacketSize, "#A7");\r
-#else\r
-                       Assert.AreEqual (8192, cn.PacketSize, "#A7");\r
-#endif\r
                        Assert.IsNull (cn.Site, "#A8");\r
                        Assert.AreEqual (ConnectionState.Closed, cn.State, "#A9");\r
-#if NET_2_0\r
                        Assert.IsFalse (cn.StatisticsEnabled, "#A10");\r
-#endif\r
                        Assert.IsTrue (string.Compare (Environment.MachineName, cn.WorkstationId, true) == 0, "#A11");\r
 \r
                        cn = new SqlConnection ((string) null);\r
@@ -92,22 +86,18 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.IsNull (cn.Container, "#B3");\r
                        Assert.AreEqual (string.Empty, cn.Database, "#B4");\r
                        Assert.AreEqual (string.Empty, cn.DataSource, "#B5");\r
-#if NET_2_0\r
                        Assert.IsFalse (cn.FireInfoMessageEventOnUserErrors, "#B6");\r
                        Assert.AreEqual (8000, cn.PacketSize, "#B7");\r
-#else\r
-                       Assert.AreEqual (8192, cn.PacketSize, "#B7");\r
-#endif\r
                        Assert.IsNull (cn.Site, "#B8");\r
                        Assert.AreEqual (ConnectionState.Closed, cn.State, "#B9");\r
-#if NET_2_0\r
                        Assert.IsFalse (cn.StatisticsEnabled, "#B10");\r
-#endif\r
                        Assert.IsTrue (string.Compare (Environment.MachineName, cn.WorkstationId, true) == 0, "#B11");\r
                }\r
 \r
                [Test]\r
-               [Category ("NotWorking")]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Constructor2_ConnectionString_Invalid ()\r
                {\r
                        try {\r
@@ -200,6 +190,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void BeginTransaction_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -266,6 +259,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangeDatabase_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -282,8 +278,10 @@ namespace MonoTests.System.Data.SqlClient
                        }\r
                }\r
 \r
-#if NET_2_0\r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_ConnectionString_Empty ()\r
                {\r
                        try {\r
@@ -299,6 +297,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_ConnectionString_Null ()\r
                {\r
                        try {\r
@@ -313,7 +314,10 @@ namespace MonoTests.System.Data.SqlClient
                        }\r
                }\r
 \r
-               [Test]\r
+               \r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_NewPassword_Empty ()\r
                {\r
                        try {\r
@@ -329,6 +333,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_NewPassword_ExceedMaxLength ()\r
                {\r
                        try {\r
@@ -348,6 +355,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ChangePassword_NewPassword_Null ()\r
                {\r
                        try {\r
@@ -361,9 +371,28 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.IsTrue (ex.ParamName.IndexOf ("'newPassword'") != -1, "#6");\r
                        }\r
                }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
 #endif\r
+               public void ClearPool_Connection_Null ()\r
+               {\r
+                       try {\r
+                               SqlConnection.ClearPool ((SqlConnection) null);\r
+                               Assert.Fail ("#1");\r
+                       } catch (ArgumentNullException ex) {\r
+                               Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");\r
+                               Assert.IsNull (ex.InnerException, "#3");\r
+                               Assert.IsNotNull (ex.Message, "#4");\r
+                               Assert.AreEqual ("connection", ex.ParamName, "#5");\r
+                       }\r
+               }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -378,7 +407,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
-               [Category ("NotWorking")]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_Value_Invalid ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -408,89 +439,12 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.IsTrue (ex.Message.IndexOf ("'invalidkeyword'") != -1, "#B5");\r
                                Assert.IsNull (ex.ParamName, "#B6");\r
                        }\r
-\r
-                       // invalid packet size (< minimum)\r
-                       try {\r
-                               cn.ConnectionString = "Packet Size=511";\r
-                               Assert.Fail ("#C1");\r
-                       } catch (ArgumentException ex) {\r
-                               // Invalid 'Packet Size'.  The value must be an\r
-                               // integer >= 512 and <= 32768\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");\r
-                               Assert.IsNull (ex.InnerException, "#C3");\r
-                               Assert.IsNotNull (ex.Message, "#C4");\r
-                               Assert.IsNull (ex.ParamName, "#C5");\r
-                       }\r
-\r
-                       // invalid packet size (> maximum)\r
-                       try {\r
-                               cn.ConnectionString = "Packet Size=32769";\r
-                               Assert.Fail ("#D1");\r
-                       } catch (ArgumentException ex) {\r
-                               // Invalid 'Packet Size'.  The value must be an\r
-                               // integer >= 512 and <= 32768\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#D2");\r
-                               Assert.IsNull (ex.InnerException, "#D3");\r
-                               Assert.IsNotNull (ex.Message, "#D4");\r
-                               Assert.IsNull (ex.ParamName, "#D5");\r
-                       }\r
-\r
-                       // negative connect timeout\r
-                       try {\r
-                               cn.ConnectionString = "Connect Timeout=-1";\r
-                               Assert.Fail ("#E1");\r
-                       } catch (ArgumentException ex) {\r
-                               // Invalid value for key 'connect timeout'\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#E2");\r
-                               Assert.IsNull (ex.InnerException, "#E3");\r
-                               Assert.IsNotNull (ex.Message, "#E4");\r
-                               Assert.IsNull (ex.ParamName, "#E5");\r
-                       }\r
-\r
-                       // negative max pool size\r
-                       try {\r
-                               cn.ConnectionString = "Max Pool Size=-1";\r
-                               Assert.Fail ("#F1");\r
-                       } catch (ArgumentException ex) {\r
-                               // Invalid value for key 'max pool size'\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#F2");\r
-                               Assert.IsNull (ex.InnerException, "#F3");\r
-                               Assert.IsNotNull (ex.Message, "#F4");\r
-                               Assert.IsNull (ex.ParamName, "#F5");\r
-                       }\r
-\r
-                       // negative min pool size\r
-                       try {\r
-                               cn.ConnectionString = "Min Pool Size=-1";\r
-                               Assert.Fail ("#G1");\r
-                       } catch (ArgumentException ex) {\r
-                               // Invalid value for key 'min pool size'\r
-                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#G2");\r
-                               Assert.IsNull (ex.InnerException, "#G3");\r
-                               Assert.IsNotNull (ex.Message, "#G4");\r
-                               Assert.IsNull (ex.ParamName, "#G5");\r
-                       }\r
-               }\r
-\r
-               [Test]\r
-               public void ConnectionTimeoutSynonyms()\r
-               {\r
-                       SqlConnection cn = null;\r
-\r
-                       cn = new SqlConnection ();\r
-                       cn.ConnectionString = "Connection Timeout=25";\r
-                       Assert.AreEqual (25, cn.ConnectionTimeout);\r
-\r
-                       cn = new SqlConnection ();\r
-                       cn.ConnectionString = "Connect Timeout=25";\r
-                       Assert.AreEqual (25, cn.ConnectionTimeout);\r
-\r
-                       cn = new SqlConnection ();\r
-                       cn.ConnectionString = "Timeout=25";\r
-                       Assert.AreEqual (25, cn.ConnectionTimeout);\r
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void CreateCommand ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -502,10 +456,8 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.AreSame (cn, cmd.Connection, "#5");\r
                        Assert.IsNull (cmd.Container, "#6");\r
                        Assert.IsTrue (cmd.DesignTimeVisible, "#7");\r
-#if NET_2_0\r
                        Assert.IsNull (cmd.Notification, "#8");\r
                        Assert.IsTrue (cmd.NotificationAutoEnlist, "#9");\r
-#endif\r
                        Assert.IsNotNull (cmd.Parameters, "#10");\r
                        Assert.AreEqual (0, cmd.Parameters.Count, "#11");\r
                        Assert.IsNull (cmd.Site, "#12");\r
@@ -514,6 +466,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Dispose ()\r
                {\r
                        SqlConnection cn = new SqlConnection ("Server=SQLSRV;Database=master;Timeout=25;Packet Size=512;Workstation ID=DUMMY");\r
@@ -523,11 +478,7 @@ namespace MonoTests.System.Data.SqlClient
                        Assert.AreEqual (15, cn.ConnectionTimeout, "#2");\r
                        Assert.AreEqual (string.Empty, cn.Database, "#3");\r
                        Assert.AreEqual (string.Empty, cn.DataSource, "#4");\r
-#if NET_2_0\r
                        Assert.AreEqual (8000, cn.PacketSize, "#5");\r
-#else\r
-                       Assert.AreEqual (8192, cn.PacketSize, "#5");\r
-#endif\r
                        Assert.IsTrue (string.Compare (Environment.MachineName, cn.WorkstationId, true) == 0, "#6");\r
                        Assert.AreEqual (ConnectionState.Closed, cn.State, "#7");\r
                        cn.Dispose ();\r
@@ -536,8 +487,10 @@ namespace MonoTests.System.Data.SqlClient
                        cn.Dispose ();\r
                }\r
 \r
-#if NET_2_0\r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void GetSchema_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -612,9 +565,101 @@ namespace MonoTests.System.Data.SqlClient
                                Assert.IsNotNull (ex.Message, "#G4");\r
                        }\r
                }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
 #endif\r
+               public void ConnectionString_AsynchronousProcessing ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "Asynchronous Processing=False";\r
+                       cn.ConnectionString = "Async=True";\r
+               }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_ConnectTimeout ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "Connection Timeout=45";\r
+                       Assert.AreEqual (45, cn.ConnectionTimeout, "#1");\r
+                       cn.ConnectionString = "Connect Timeout=40";\r
+                       Assert.AreEqual (40, cn.ConnectionTimeout, "#2");\r
+                       cn.ConnectionString = "Timeout=";\r
+                       Assert.AreEqual (15, cn.ConnectionTimeout, "#3");\r
+                       cn.ConnectionString = "Timeout=2147483647";\r
+                       Assert.AreEqual (int.MaxValue, cn.ConnectionTimeout, "#4");\r
+                       cn.ConnectionString = "Timeout=0";\r
+                       Assert.AreEqual (0, cn.ConnectionTimeout, "#5");\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_ConnectTimeout_Invalid ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+\r
+                       // negative number\r
+                       try {\r
+                               cn.ConnectionString = "Connection timeout=-1";\r
+                               Assert.Fail ("#A1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'connect timeout'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");\r
+                               Assert.IsNull (ex.InnerException, "#A3");\r
+                               Assert.IsNotNull (ex.Message, "#A4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'connect timeout'") != -1, "#A5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#A6");\r
+                       }\r
+\r
+                       // invalid number\r
+                       try {\r
+                               cn.ConnectionString = "connect Timeout=BB";\r
+                               Assert.Fail ("#B1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'connect timeout'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");\r
+                               Assert.IsNotNull (ex.InnerException, "#B3");\r
+                               Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#B4");\r
+                               Assert.IsNotNull (ex.Message, "#B5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'connect timeout'") != -1, "#B6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#B7");\r
+\r
+                               // Input string was not in a correct format\r
+                               FormatException fe = (FormatException) ex.InnerException;\r
+                               Assert.IsNull (fe.InnerException, "#B8");\r
+                               Assert.IsNotNull (fe.Message, "#B9");\r
+                       }\r
+\r
+                       // overflow\r
+                       try {\r
+                               cn.ConnectionString = "timeout=2147483648";\r
+                               Assert.Fail ("#C1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'connect timeout'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");\r
+                               Assert.IsNotNull (ex.InnerException, "#C3");\r
+                               Assert.AreEqual (typeof (OverflowException), ex.InnerException.GetType (), "#C4");\r
+                               Assert.IsNotNull (ex.Message, "#C5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'connect timeout'") != -1, "#C6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#C7");\r
+\r
+                               // Value was either too large or too small for an Int32\r
+                               OverflowException oe = (OverflowException) ex.InnerException;\r
+                               Assert.IsNull (oe.InnerException, "#C8");\r
+                               Assert.IsNotNull (oe.Message, "#C9");\r
+                       }\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_Database_Synonyms ()\r
                {\r
                        SqlConnection cn = null;\r
@@ -629,6 +674,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_DataSource_Synonyms ()\r
                {\r
                        SqlConnection cn = null;\r
@@ -655,6 +703,210 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_MaxPoolSize ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "Max Pool Size=2147483647";\r
+                       cn.ConnectionString = "Max Pool Size=1";\r
+                       cn.ConnectionString = "Max Pool Size=500";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_MaxPoolSize_Invalid ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+\r
+                       // negative number\r
+                       try {\r
+                               cn.ConnectionString = "Max Pool Size=-1";\r
+                               Assert.Fail ("#A1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'max pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");\r
+                               Assert.IsNull (ex.InnerException, "#A3");\r
+                               Assert.IsNotNull (ex.Message, "#A4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'max pool size'") != -1, "#A5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#A6");\r
+                       }\r
+\r
+                       // invalid number\r
+                       try {\r
+                               cn.ConnectionString = "max Pool size=BB";\r
+                               Assert.Fail ("#B1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'max pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");\r
+                               Assert.IsNotNull (ex.InnerException, "#B3");\r
+                               Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#B4");\r
+                               Assert.IsNotNull (ex.Message, "#B5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'max pool size'") != -1, "#B6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#B7");\r
+\r
+                               // Input string was not in a correct format\r
+                               FormatException fe = (FormatException) ex.InnerException;\r
+                               Assert.IsNull (fe.InnerException, "#B8");\r
+                               Assert.IsNotNull (fe.Message, "#B9");\r
+                       }\r
+\r
+                       // overflow\r
+                       try {\r
+                               cn.ConnectionString = "max pool size=2147483648";\r
+                               Assert.Fail ("#C1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'max pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");\r
+                               Assert.IsNotNull (ex.InnerException, "#C3");\r
+                               Assert.AreEqual (typeof (OverflowException), ex.InnerException.GetType (), "#C4");\r
+                               Assert.IsNotNull (ex.Message, "#C5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'max pool size'") != -1, "#C6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#C7");\r
+\r
+                               // Value was either too large or too small for an Int32\r
+                               OverflowException oe = (OverflowException) ex.InnerException;\r
+                               Assert.IsNull (oe.InnerException, "#C8");\r
+                               Assert.IsNotNull (oe.Message, "#C9");\r
+                       }\r
+\r
+                       // less than minimum (1)\r
+                       try {\r
+                               cn.ConnectionString = "Min Pool Size=0;Max Pool Size=0";\r
+                               Assert.Fail ("#D1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'max pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#D2");\r
+                               Assert.IsNull (ex.InnerException, "#D3");\r
+                               Assert.IsNotNull (ex.Message, "#D4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'max pool size'") != -1, "#D5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#D6");\r
+                       }\r
+\r
+                       // less than min pool size\r
+                       try {\r
+                               cn.ConnectionString = "Min Pool Size=5;Max Pool Size=4";\r
+                               Assert.Fail ("#E1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid min or max pool size values, min\r
+                               // pool size cannot be greater than the max\r
+                               // pool size\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#E2");\r
+                               Assert.IsNull (ex.InnerException, "#E3");\r
+                               Assert.IsNotNull (ex.Message, "#E4");\r
+                               Assert.IsNull (ex.ParamName, "#E5");\r
+                       }\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_MinPoolSize ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "min Pool size=0";\r
+                       cn.ConnectionString = "Min Pool size=100";\r
+                       cn.ConnectionString = "Min Pool Size=2147483647;Max Pool Size=2147483647";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_MinPoolSize_Invalid ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+\r
+                       // negative number\r
+                       try {\r
+                               cn.ConnectionString = "Min Pool Size=-1";\r
+                               Assert.Fail ("#A1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'min pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");\r
+                               Assert.IsNull (ex.InnerException, "#A3");\r
+                               Assert.IsNotNull (ex.Message, "#A4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'min pool size'") != -1, "#A5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#A6");\r
+                       }\r
+\r
+                       // invalid number\r
+                       try {\r
+                               cn.ConnectionString = "min Pool size=BB";\r
+                               Assert.Fail ("#B1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'min pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");\r
+                               Assert.IsNotNull (ex.InnerException, "#B3");\r
+                               Assert.AreEqual (typeof (FormatException), ex.InnerException.GetType (), "#B4");\r
+                               Assert.IsNotNull (ex.Message, "#B5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'min pool size'") != -1, "#B6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#B7");\r
+\r
+                               // Input string was not in a correct format\r
+                               FormatException fe = (FormatException) ex.InnerException;\r
+                               Assert.IsNull (fe.InnerException, "#B8");\r
+                               Assert.IsNotNull (fe.Message, "#B9");\r
+                       }\r
+\r
+                       // overflow\r
+                       try {\r
+                               cn.ConnectionString = "min pool size=2147483648";\r
+                               Assert.Fail ("#C1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'min pool size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");\r
+                               Assert.IsNotNull (ex.InnerException, "#C3");\r
+                               Assert.AreEqual (typeof (OverflowException), ex.InnerException.GetType (), "#C4");\r
+                               Assert.IsNotNull (ex.Message, "#C5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'min pool size'") != -1, "#C6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#C7");\r
+\r
+                               // Value was either too large or too small for an Int32\r
+                               OverflowException oe = (OverflowException) ex.InnerException;\r
+                               Assert.IsNull (oe.InnerException, "#C8");\r
+                               Assert.IsNotNull (oe.Message, "#C9");\r
+                       }\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_MultipleActiveResultSets ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "MultipleActiveResultSets=true";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_MultipleActiveResultSets_Invalid ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       try {\r
+                               cn.ConnectionString = "MultipleActiveResultSets=1";\r
+                               Assert.Fail ("#1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'multipleactiveresultsets'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");\r
+                               Assert.IsNull (ex.InnerException, "#3");\r
+                               Assert.IsNotNull (ex.Message, "#4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'multipleactiveresultsets'") != -1, "#5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#6");\r
+                       }\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_NetworkLibrary_Synonyms ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -664,42 +916,174 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_PacketSize ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "Packet Size=1024";\r
+                       Assert.AreEqual (1024, cn.PacketSize, "#1");\r
+                       cn.ConnectionString = "packet SizE=533";\r
+                       Assert.AreEqual (533, cn.PacketSize, "#2");\r
+                       cn.ConnectionString = "packet SizE=512";\r
+                       Assert.AreEqual (512, cn.PacketSize, "#3");\r
+                       cn.ConnectionString = "packet SizE=32768";\r
+                       Assert.AreEqual (32768, cn.PacketSize, "#4");\r
+                       cn.ConnectionString = "packet Size=";\r
+                       Assert.AreEqual (8000, cn.PacketSize, "#5");\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_PacketSize_Invalid ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+\r
+                       // invalid packet size (< minimum)\r
+                       try {\r
+                               cn.ConnectionString = "Packet Size=511";\r
+                               Assert.Fail ("#A1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid 'Packet Size'.  The value must be an\r
+                               // integer >= 512 and <= 32768\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#A2");\r
+                               Assert.IsNull (ex.InnerException, "#A3");\r
+                               Assert.IsNotNull (ex.Message, "#A4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'Packet Size'") != -1, "#A5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#A6");\r
+                       }\r
+\r
+                       // invalid packet size (> maximum)\r
+                       try {\r
+                               cn.ConnectionString = "packet SIze=32769";\r
+                               Assert.Fail ("#B1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid 'Packet Size'.  The value must be an\r
+                               // integer >= 512 and <= 32768\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");\r
+                               Assert.IsNull (ex.InnerException, "#B3");\r
+                               Assert.IsNotNull (ex.Message, "#B4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'Packet Size'") != -1, "#B5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#B6");\r
+                       }\r
+\r
+                       // overflow\r
+                       try {\r
+                               cn.ConnectionString = "packet SIze=2147483648";\r
+                               Assert.Fail ("#C1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'packet size'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#C2");\r
+                               Assert.IsNotNull (ex.InnerException, "#C3");\r
+                               Assert.AreEqual (typeof (OverflowException), ex.InnerException.GetType (), "#C4");\r
+                               Assert.IsNotNull (ex.Message, "#C5");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'packet size'") != -1, "#C6:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#C7");\r
+\r
+                               // Value was either too large or too small for an Int32\r
+                               OverflowException oe = (OverflowException) ex.InnerException;\r
+                               Assert.IsNull (oe.InnerException, "#C8");\r
+                               Assert.IsNotNull (oe.Message, "#C9");\r
+                       }\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_Password_Synonyms ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "Password=scrambled";\r
+                       cn.ConnectionString = "Pwd=scrambled";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_PersistSecurityInfo_Synonyms ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "Persist Security Info=true";\r
+                       cn.ConnectionString = "PersistSecurityInfo=true";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_UserID_Synonyms ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "User Id=test";\r
+                       cn.ConnectionString = "User=test";\r
+                       cn.ConnectionString = "Uid=test";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_UserInstance ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       cn.ConnectionString = "User Instance=true";\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
+               public void ConnectionString_UserInstance_Invalid ()\r
+               {\r
+                       SqlConnection cn = new SqlConnection ();\r
+                       try {\r
+                               cn.ConnectionString = "User Instance=1";\r
+                               Assert.Fail ("#1");\r
+                       } catch (ArgumentException ex) {\r
+                               // Invalid value for key 'user instance'\r
+                               Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#2");\r
+                               Assert.IsNull (ex.InnerException, "#3");\r
+                               Assert.IsNotNull (ex.Message, "#4");\r
+                               Assert.IsTrue (ex.Message.IndexOf ("'user instance'") != -1, "#5:" + ex.Message);\r
+                               Assert.IsNull (ex.ParamName, "#6");\r
+                       }\r
+               }\r
+\r
+               [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ConnectionString_OtherKeywords ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
                        cn.ConnectionString = "Application Name=test";\r
                        cn.ConnectionString = "App=test";\r
-                       cn.ConnectionString = "Connection LifeTime=1000";\r
                        cn.ConnectionString = "Connection Reset=true";\r
                        cn.ConnectionString = "Current Language=test";\r
                        cn.ConnectionString = "Language=test";\r
                        cn.ConnectionString = "Encrypt=false";\r
+                       //cn.ConnectionString = "Encrypt=true";\r
+                       //cn.ConnectionString = "Enlist=false";\r
                        cn.ConnectionString = "Enlist=true";\r
                        cn.ConnectionString = "Integrated Security=true";\r
                        cn.ConnectionString = "Trusted_connection=true";\r
                        cn.ConnectionString = "Max Pool Size=10";\r
                        cn.ConnectionString = "Min Pool Size=10";\r
-                       cn.ConnectionString = "Password=scrambled";\r
-                       cn.ConnectionString = "Pwd=scrambled";\r
                        cn.ConnectionString = "Pooling=true";\r
-                       cn.ConnectionString = "User Id=test";\r
-                       cn.ConnectionString = "User=test";\r
-                       cn.ConnectionString = "Uid=test";\r
-                       /*\r
-                        * NOT IMPLEMENTED YET\r
-                        */\r
-                       /*\r
-                       cn.ConnectionString = "Persist Security Info=true";\r
-                       cn.ConnectionString = "PersistSecurityInfo=true";\r
-                       cn.ConnectionString = "Encrypt=true";\r
-                       cn.ConnectionString = "Enlist=false";\r
                        cn.ConnectionString = "attachdbfilename=dunno";\r
                        cn.ConnectionString = "extended properties=dunno";\r
                        cn.ConnectionString = "initial file name=dunno";\r
-                       */\r
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Open_ConnectionString_Empty ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -718,6 +1102,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Open_ConnectionString_Null ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -736,6 +1123,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void Open_ConnectionString_Whitespace ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -754,6 +1144,9 @@ namespace MonoTests.System.Data.SqlClient
                }\r
 \r
                [Test]\r
+#if FEATURE_NO_BSD_SOCKETS\r
+               [ExpectedException (typeof (PlatformNotSupportedException))]\r
+#endif\r
                public void ServerVersion_Connection_Closed ()\r
                {\r
                        SqlConnection cn = new SqlConnection ();\r
@@ -778,3 +1171,4 @@ namespace MonoTests.System.Data.SqlClient
                }\r
        }\r
 }\r
+\r