2 new tests for ctors
authorOleg Petrov <ch5oh@qip.ru>
Fri, 2 Dec 2011 18:36:53 +0000 (22:36 +0400)
committerOleg Petrov <ch5oh@qip.ru>
Sat, 3 Dec 2011 12:17:58 +0000 (16:17 +0400)
mcs/class/System.Data/Test/System.Data.SqlClient/SqlBulkCopyTest.cs

index 7dacfa0ae5847011236f19692a47a904ad796903..b65ba7abab6fdd5c63cd9118676cf9393fc4f524 100644 (file)
@@ -36,6 +36,8 @@ using NUnit.Framework;
 namespace MonoTests.System.Data.SqlClient {
        [TestFixture]
        public class SqlBulkCopyTest {
+               private const string testFailParamNameMessage = "We have to provide the same parameter name as in original .NET";
+               
                [Test] // .ctor(SqlConnection connection)
                [ExpectedException (typeof(ArgumentNullException))]
                public void ConstructorNotNull1 ()
@@ -57,7 +59,7 @@ namespace MonoTests.System.Data.SqlClient {
                        try {
                                new SqlBulkCopy ((SqlConnection)null);
                        } catch (ArgumentNullException ane) {
-                               Assert.AreEqual ("connection", ane.ParamName, "#001 - We have to provide the same parameter name as in original .NET");
+                               Assert.AreEqual ("connection", ane.ParamName, "#001 - " + testFailParamNameMessage);
                                throw;
                        }
                }
@@ -69,7 +71,31 @@ namespace MonoTests.System.Data.SqlClient {
                        try {
                                new SqlBulkCopy ((string)null);
                        } catch (ArgumentNullException ane) {
-                               Assert.AreEqual ("connectionString", ane.ParamName, "#002 - We have to provide the same parameter name as in original .NET");
+                               Assert.AreEqual ("connectionString", ane.ParamName, "#002 - " + testFailParamNameMessage);
+                               throw;
+                       }
+               }
+               
+               [Test] // .ctor(string connectionString)
+               [ExpectedException (typeof(ArgumentNullException))]
+               public void ConstructorNotNull5 ()
+               {
+                       try {
+                               new SqlBulkCopy ((string)null, SqlBulkCopyOptions.Default);
+                       } catch (ArgumentNullException ane) {
+                               Assert.AreEqual ("connectionString", ane.ParamName, "#003 - " + testFailParamNameMessage);
+                               throw;
+                       }
+               }
+               
+               [Test] // .ctor(string connectionString)
+               [ExpectedException (typeof(ArgumentNullException))]
+               public void ConstructorNotNull6 ()
+               {
+                       try {
+                               new SqlBulkCopy ((SqlConnection)null, SqlBulkCopyOptions.Default, null);
+                       } catch (ArgumentNullException ane) {
+                               Assert.AreEqual ("connection", ane.ParamName, "#004 - " + testFailParamNameMessage);
                                throw;
                        }
                }