2002-05-08 Rodrigo Moya <rodrigo@ximian.com>
authorRodrigo Moya <rodrigo@mono-cvs.ximian.com>
Wed, 8 May 2002 11:17:45 +0000 (11:17 -0000)
committerRodrigo Moya <rodrigo@mono-cvs.ximian.com>
Wed, 8 May 2002 11:17:45 +0000 (11:17 -0000)
* Test/TestDataColumn.cs: added basic test for DataColumn.cs.

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

mcs/class/System.Data/ChangeLog
mcs/class/System.Data/Test/TestDataColumn.cs [new file with mode: 0644]

index 15e86b1fe2c8b55f46022e5626a2a36542785c0e..ac4c5314e95a395ced53ce9ea430f42907ecb761 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-08  Rodrigo Moya <rodrigo@ximian.com>
+
+       * Test/TestDataColumn.cs: added basic test for DataColumn.cs.
+
 2002-05-07  Tim Coleman <tim@timcoleman.com>
        * SqlBinary.cs:
        * SqlBoolean.cs:
diff --git a/mcs/class/System.Data/Test/TestDataColumn.cs b/mcs/class/System.Data/Test/TestDataColumn.cs
new file mode 100644 (file)
index 0000000..93ea102
--- /dev/null
@@ -0,0 +1,46 @@
+//
+// TestDataColumn.cs
+//
+// Tests for System.Data.DataColumn
+//
+// Authors:
+//   Rodrigo Moya <rodrigo@ximian.com>
+//
+// (C) Ximian, Inc 2002
+//
+
+using System;
+using System.Data;
+
+namespace TestSystemData
+{
+       class TestDataColumn
+       {
+               static void Main (string[] args) {
+                       DataColumn colName = new DataColumn ("name");
+                       DataColumn colAge = new DataColumn ("age");
+
+                       // set properties
+                       colName.DataType = Type.GetType ("System.String");
+                       colName.RadOnly = true;
+                       colName.Caption = "Full name";
+
+                       colAge.DataType = Type.GetType ("System.Int");
+                       colAge.ReadOnly = false;
+                       colAge.Caption = "Age";
+
+                       // display properties
+                       _displayColumn (colAge);
+                       _displayColumn (colName);
+               }
+
+               static void _displayColumn (DataColumn col) {
+                       string msg = "Column name: " + col.ColumnName + "\n" +
+                               "Column Type: " + col.DataType + "\n" +
+                               "Read Only?: " + col.ReadOnly + "\n" +
+                               "Caption: " + col.Caption + "\n" +
+                               "Allow Nulls?: " + col.AllowDBNull;
+                       System.Console.WriteLine (msg);
+               }
+       }
+}