In Test/System.Windows.Forms:
authorChris Toshok <toshok@novell.com>
Wed, 29 Nov 2006 22:46:53 +0000 (22:46 -0000)
committerChris Toshok <toshok@novell.com>
Wed, 29 Nov 2006 22:46:53 +0000 (22:46 -0000)
2006-11-29  Chris Toshok  <toshok@ximian.com>

* BindingTest.cs: add two new tests.

In System.Windows.Forms:
2006-11-29  Chris Toshok  <toshok@ximian.com>

* Binding.cs (SetControl): fix unit test.

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/Binding.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/BindingTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog

index b90aa77f202f72af14cfc3430b41219956fb8e9d..1f60521c0f823da231c0631cc26d7138283b7584 100644 (file)
@@ -135,7 +135,6 @@ namespace System.Windows.Forms {
                        control.Validating += new CancelEventHandler (ControlValidatingHandler);
 
                        this.control = control;
-                       control.DataBindings.Add (this);
                }
 
                internal void Check (BindingContext binding_context)
index db7e600179860f68514408b46a6975953c18ccc5..ab0a587719a1d07c70a7352c0d05470fbf6190ae 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-29  Chris Toshok  <toshok@ximian.com>
+
+       * Binding.cs (SetControl): fix unit test.
+
 2006-11-29  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * PageSetupDialog.cs: Validate the margins and set them in
index 1abce0ce91bffab6592328fd8ed2b59ba4e9febc..aa4ec190492cb804c602c9f5434b49b2712f58ee 100644 (file)
@@ -126,6 +126,38 @@ namespace MonoTests.System.Windows.Forms {
                        Console.WriteLine (Environment.StackTrace);
                        eventcount++;
                }
+
+               [Test]
+               public void DataBindingCountTest1 ()
+               {
+                       Control c = new Control ();
+                       Assert.AreEqual (0, c.DataBindings.Count, "1");
+                       c.DataBindings.Add (new Binding ("Text", c, "Name"));
+                       Assert.AreEqual (1, c.DataBindings.Count, "2");
+
+                       Binding b = c.DataBindings[0];
+                       Assert.AreEqual (c, b.Control, "3");
+                       Assert.AreEqual (c, b.DataSource, "4");
+                       Assert.AreEqual ("Text", b.PropertyName, "5");
+                       Assert.AreEqual ("Name", b.BindingMemberInfo.BindingField, "6");
+               }
+
+               [Test]
+               public void DataBindingCountTest2 ()
+               {
+                       Control c = new Control ();
+                       Control c2 = new Control ();
+                       Assert.AreEqual (0, c.DataBindings.Count, "1");
+                       c.DataBindings.Add (new Binding ("Text", c2, "Name"));
+                       Assert.AreEqual (1, c.DataBindings.Count, "2");
+                       Assert.AreEqual (0, c2.DataBindings.Count, "3");
+
+                       Binding b = c.DataBindings[0];
+                       Assert.AreEqual (c, b.Control, "4");
+                       Assert.AreEqual (c2, b.DataSource, "5");
+                       Assert.AreEqual ("Text", b.PropertyName, "6");
+                       Assert.AreEqual ("Name", b.BindingMemberInfo.BindingField, "7");
+               }
        }
 
 }
index ea1a5fc3dde5561beba5f9f3886073b26c680aac..acc14d05a9a2cba822e32de294c32bd73590dbcf 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-29  Chris Toshok  <toshok@ximian.com>
+
+       * BindingTest.cs: add two new tests.
+
 2006-11-28  Rolf Bjarne Kvinge  <RKvinge@novell.com>
 
        * TrackBar.cs: Changed SizeTest and OrientationTest