예제 #1
0
		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");
			}
		}
예제 #2
0
		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");
		}
예제 #3
0
		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
		}
예제 #4
0
		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");
		}