Przeglądaj źródła

2004-10-15 Umadevi S <[email protected]>
* SqlDataReaderTest.cs: Added testcase for reading emptyntextfield

svn path=/trunk/mcs/; revision=35016

Umadevi S 21 lat temu
rodzic
commit
684d11260f

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

@@ -1,3 +1,6 @@
+2004-10-15 Umadevi S <[email protected]>
+	* SqlDataReaderTest.cs: Added testcase for reading emptyntextfield
+
 2004-10-14 Umadevi S <[email protected]>
 	* SqlCommandTest.cs - added Test for clone method
 

+ 35 - 0
mcs/class/System.Data/Test/System.Data.SqlClient/SqlDataReaderTest.cs

@@ -50,6 +50,41 @@ namespace MonoTests.System.Data.SqlClient
 		CloseConnection ();
           }
 
+
+	 [Test]
+	 public void ReadEmptyNTextFieldTest () {
+		try {
+			  using (conn) {
+	 			 SqlCommand sqlCommand = conn.CreateCommand();
+			         sqlCommand.CommandText = "CREATE TABLE #MonoTest (NAME ntext)";
+			         sqlCommand.ExecuteNonQuery();
+                                                                                                    
+			         sqlCommand.CommandText = "INSERT INTO #MonoTest VALUES ('')"; //('')";
+			         sqlCommand.ExecuteNonQuery();
+                                                                                                    
+			         sqlCommand.CommandText = "SELECT * FROM #MonoTest";
+			         SqlDataReader dr = sqlCommand.ExecuteReader();
+			         while (dr.Read()) {
+			                Console.WriteLine(dr["NAME"].GetType().FullName);
+					Assert.AreEqual("System.String",dr["NAME"].GetType().FullName);
+            			 }
+        		 }
+		 }
+                catch  (Exception e) {
+                        Assert.Fail("A#01 Got an exception");
+                        //Console.WriteLine(e.StackTrace);
+                                                                                                    
+                }
+                                                                                                    
+                finally { // try/catch is necessary to gracefully close connections^M
+                                                                                                    
+                        CloseConnection ();
+                }
+   
+
+
+	 }		
+
 	 [Test]
 	  /**
 	  The below test expects a table table4 with a bigint column.