Browse Source

2005-01-27 Atsushi Enomoto <[email protected]>

	* DataViewTest.cs : added test for ListChanged.
	* DataRowViewTest.cs : (ItemException) fixed test. It is now working.



svn path=/trunk/mcs/; revision=39629
Atsushi Eno 21 years ago
parent
commit
7f3d289e14

+ 5 - 0
mcs/class/System.Data/Test/System.Data/ChangeLog

@@ -1,3 +1,8 @@
+2005-01-27  Atsushi Enomoto  <[email protected]>
+
+	* DataViewTest.cs : added test for ListChanged.
+	* DataRowViewTest.cs : (ItemException) fixed test. It is now working.
+
 2005-01-25  Atsushi Enomoto  <[email protected]>
 
 	* DataTableTest.cs : finally run-test-ondotnet passes (i.e.

+ 2 - 2
mcs/class/System.Data/Test/System.Data/DataRowViewTest.cs

@@ -132,7 +132,7 @@ namespace MonoTests.System.Data
 
 		[Test]
 		[ExpectedException (typeof (RowNotInTableException))]
-		[NUnit.Framework.Category ("NotWorking")]
+//		[NUnit.Framework.Category ("NotWorking")]
 		public void ItemException ()
 		{
 			DataTable dt = new DataTable ("table");
@@ -142,7 +142,7 @@ namespace MonoTests.System.Data
 			DataRowView drv = dv.AddNew ();
 			drv.Row ["col"] = "test";
 			drv.Row.CancelEdit ();
-			AssertEquals ("AddNew", false, drv ["col"]);
+			object o = drv ["col"];
 		}
 	}
 }

+ 23 - 1
mcs/class/System.Data/Test/System.Data/DataViewTest.cs

@@ -204,7 +204,6 @@ namespace MonoTests.System.Data
 		}
 
 		[Test]
-//		[NUnit.Framework.Category ("NotDotNet")]
 		public void AddNew_2 ()
 		{
 			dataView.AllowNew = true;
@@ -370,5 +369,28 @@ namespace MonoTests.System.Data
 			TestView.Dispose (); // Close the table
 			TestView.Delete (0);
 		}
+
+		[Test]
+		public void ListChangeOnSetItem ()
+		{
+			DataTable dt = new DataTable ("table");
+			dt.Columns.Add ("col1");
+			dt.Columns.Add ("col2");
+			dt.Columns.Add ("col3");
+			dt.Rows.Add (new object [] {1, 2, 3});
+			dt.AcceptChanges ();
+			DataView dv = new DataView (dt);
+			dv.ListChanged += new ListChangedEventHandler (OnChange);
+			dv [0] ["col1"] = 4;
+		}
+
+		ListChangedEventArgs ListChangeArgOnSetItem;
+
+		public void OnChange (object o, ListChangedEventArgs e)
+		{
+			if (ListChangeArgOnSetItem != null)
+				throw new Exception ("The event is already fired.");
+			ListChangeArgOnSetItem = e;
+		}
 	}
 }