* BindingTest.cs: Add DataSourceNullTest test - for #324286.
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Sat, 26 Jan 2008 20:38:44 +0000 (20:38 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Sat, 26 Jan 2008 20:38:44 +0000 (20:38 -0000)
2008-01-26  Carlos Alberto Cortez <calberto.cortez@gmail.com>

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

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

index 26c2b4b8ef22ce73405474e5f1c6fde1b50e539c..80b858d6890f8c6143d1f14628180626846ee9e8 100644 (file)
@@ -217,6 +217,46 @@ namespace MonoTests.System.Windows.Forms.DataBinding {
                        Assert.AreEqual ("Text", b.PropertyName, "6");
                        Assert.AreEqual ("Name", b.BindingMemberInfo.BindingField, "7");
                }
+
+               [Test]
+               public void DataSourceNullTest ()
+               {
+                       ChildMockItem item = new ChildMockItem ();
+                       Control c = new Control ();
+                       c.Tag = null;
+                       item.ObjectValue = null;
+
+                       c.DataBindings.Add ("Tag", item, "ObjectValue");
+
+                       Form f = new Form ();
+                       f.Controls.Add (c);
+
+                       f.Show (); // Need this to init data binding
+
+                       Assert.AreEqual (DBNull.Value, c.Tag, "1");
+               }
+       }
+
+       class ChildMockItem : MockItem
+       {
+               object value;
+
+               public ChildMockItem ()
+                       : base (null, 0)
+               {
+               }
+
+               public object ObjectValue
+               {
+                       get
+                       {
+                               return value;
+                       }
+                       set
+                       {
+                               this.value = value;
+                       }
+               }
        }
 
 }
index 658ff6447a4294f585f6ec89b7e2d14b405c39c4..15fe8f1aa82dddfa8afb3e4474c0d76e672703fe 100644 (file)
@@ -1,3 +1,7 @@
+2008-01-26  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * BindingTest.cs: Add DataSourceNullTest test - for #324286.
+
 2008-01-26  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * ListControlTest.cs: Add SelectedValue2 test - for #324286.