public void SetItemsCore_Value_Null () { MockListBox l = new MockListBox (); try { l.InvokeSetItemsCore ((IList) null); Assert.Fail ("#1"); } catch (ArgumentNullException ex) { Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2"); Assert.IsNull (ex.InnerException, "#3"); Assert.IsNotNull (ex.Message, "#4"); Assert.AreEqual ("items", ex.ParamName, "#5"); } }
public void SetItemsCore () { MockListBox l = new MockListBox (); l.InvokeSetItemsCore (new object [] { "A", "B", "C" }); Assert.AreEqual (3, l.Items.Count, "#1"); Assert.AreEqual ("A", l.Items [0], "#2"); Assert.AreEqual ("B", l.Items [1], "#3"); Assert.AreEqual ("C", l.Items [2], "#4"); }
public void SetItemsCore_Item_Null () { MockListBox l = new MockListBox (); try { l.InvokeSetItemsCore (new object [] { "A", null, "B" }); Assert.Fail ("#1"); } catch (ArgumentNullException ex) { Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2"); Assert.IsNull (ex.InnerException, "#3"); Assert.IsNotNull (ex.Message, "#4"); Assert.AreEqual ("item", ex.ParamName, "#5"); } #if NET_2_0 Assert.AreEqual (1, l.Items.Count, "#6"); Assert.AreEqual ("A", l.Items [0], "#7"); #else Assert.AreEqual (0, l.Items.Count, "#6"); #endif }
public void AllowSelection () { MockListBox lb = new MockListBox (); lb.SelectionMode = SelectionMode.None; Assert.IsFalse (lb.allow_selection, "#1"); lb.SelectionMode = SelectionMode.One; Assert.IsTrue (lb.allow_selection, "#2"); }