+2004-04-09 Atsushi Enomoto <atsushi@ximian.com>
+
+ * DataColumnTest.cs,
+ DataRowTest.cs,
+ DataTableTest.cs : build fix: csc does not allow
+ System.Type inside namespace MonoTests.System.Data.
+ * DataSetTest.cs : path fix.
+ * DataRelationTest.cs : path fix. Don't test error message: It should
+ vary by message translations. Split tests and use ExpectedException.
+
2004-03-31 Juraj Skripsky <juraj@hotfeet.ch>
* DataColumnTest.cs : fixes here and there,
public void AdditionToConstraintCollectionTest()
{
DataTable myTable = new DataTable("myTable");
- DataColumn idCol = new DataColumn("id",System.Type.GetType("System.Int32")); //set the unique property and add them to the table
+ DataColumn idCol = new DataColumn("id",Type.GetType("System.Int32")); //set the unique property and add them to the table
idCol.Unique=true;
myTable.Columns.Add(idCol);
ConstraintCollection cc = myTable.Constraints;
}\r
\r
[Test]\r
+ [ExpectedException (typeof(InvalidConstraintException))]\r
public void InvalidConstraintException ()\r
{\r
- \r
- DataRelation Relation = null;\r
- try {\r
- Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [1], true);\r
- Fail ("test#01");\r
- } catch (Exception e) {\r
- AssertEquals ("test#02", typeof (InvalidConstraintException), e.GetType ());\r
- AssertEquals ("test#03", "Parent Columns and Child Columns don't have type-matching columns.", e.Message);\r
- }\r
- \r
+ // Parent Columns and Child Columns don't have type-matching columns.\r
+ DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [1], true);\r
+ }\r
+\r
+ [Test]\r
+ [ExpectedException (typeof(InvalidConstraintException))]\r
+ public void InvalidConstraintException2 ()\r
+ {\r
+ // Parent Columns and Child Columns don't have type-matching columns.\r
Child.Columns [1].DataType = Mom.Columns [1].DataType;\r
\r
- Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [1], true);\r
+ DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [1], true);\r
Set.Relations.Add (Relation);\r
\r
- try {\r
- Child.Columns [1].DataType = Type.GetType ("System.Double");\r
- Fail ("test#04");\r
- } catch (Exception e) {\r
- AssertEquals ("test#05", typeof (InvalidConstraintException), e.GetType ());\r
- AssertEquals ("test#06", "Parent Columns and Child Columns don't have type-matching columns.", e.Message);\r
- } \r
+ Child.Columns [1].DataType = Type.GetType ("System.Double");\r
}\r
\r
[Test]\r
public void RelationFromSchema ()\r
{\r
DataSet Set = new DataSet ();\r
- Set.ReadXmlSchema ("System.Data/store.xsd");\r
+ Set.ReadXmlSchema ("Test/System.Data/store.xsd");\r
DataTable Table = Set.Tables [0];\r
\r
AssertEquals ("test#01", false, Table.CaseSensitive);\r
DataColumn idColumn = new DataColumn ();
- idColumn.DataType = System.Type.GetType ("System.Int32");
+ idColumn.DataType = Type.GetType ("System.Int32");
idColumn.ColumnName = "Id";
idColumn.AutoIncrement = true;
namesTable.Columns.Add (idColumn);
DataColumn fNameColumn = new DataColumn ();
- fNameColumn.DataType = System.Type.GetType ("System.String");
+ fNameColumn.DataType = Type.GetType ("System.String");
fNameColumn.ColumnName = "Fname";
fNameColumn.DefaultValue = "Fname";
namesTable.Columns.Add (fNameColumn);
DataColumn lNameColumn = new DataColumn ();
- lNameColumn.DataType = System.Type.GetType ("System.String");
+ lNameColumn.DataType = Type.GetType ("System.String");
lNameColumn.ColumnName = "LName";
lNameColumn.DefaultValue="LName";
namesTable.Columns.Add (lNameColumn);
DataRow rowC;
colC = new DataColumn ();
- colC.DataType = System.Type.GetType ("System.Int32");
+ colC.DataType = Type.GetType ("System.Int32");
colC.ColumnName = "Id";
colC.AutoIncrement=true;
tableC.Columns.Add (colC);
colC = new DataColumn ();
- colC.DataType = System.Type.GetType ("System.String");
+ colC.DataType = Type.GetType ("System.String");
colC.ColumnName = "Name";
tableC.Columns.Add (colC);
public void ReadXmlSchema ()\r
{\r
DataSet ds = new DataSet ();\r
- ds.ReadXmlSchema ("System.Data/own_schema.xsd");\r
+ ds.ReadXmlSchema ("Test/System.Data/own_schema.xsd");\r
\r
AssertEquals ("test#01", 2, ds.Tables.Count);\r
DataTable Table = ds.Tables [0];\r
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
table.Constraints.Add (uc);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table1.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table1.Columns.Add (col);
DataRelation dr = new DataRelation ("DR", table.Columns[0], table1.Columns[0]);
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
DataRow row = table.NewRow ();
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
table.Constraints.Add (uc);
col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table1.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table1.Columns.Add (col);
DataRow row = table.NewRow ();
row ["Id"] = 147;
DataTable table = new DataTable ();
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
col.DefaultValue = 47;
table.Columns.Add (col);
UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
col.DefaultValue = "Hello";
table.Columns.Add (col);
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
table.Constraints.Add (uc);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
DataRow row = table.NewRow ();
DataTable table = new DataTable ();
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
DataRow row = table.NewRow ();
DataColumn col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
UniqueConstraint uc = new UniqueConstraint ("UK1", table.Columns[0] );
table.Constraints.Add (uc);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Id";
- col.DataType = System.Type.GetType ("System.Int32");
+ col.DataType = Type.GetType ("System.Int32");
table1.Columns.Add (col);
col = new DataColumn ();
col.ColumnName = "Name";
- col.DataType = System.Type.GetType ("System.String");
+ col.DataType = Type.GetType ("System.String");
table1.Columns.Add (col);
DataRelation dr = new DataRelation ("DR", table.Columns[0], table1.Columns[0]);