Exemplo n.º 1
0
        public void OnSelectedInWindow3()
        {
            Window w = new Window();
            OnSelectedTabControl tab_control = new OnSelectedTabControl();

            w.Content = tab_control;
            w.Show();
            Assert.AreEqual(tab_control.SelectedIndex, -1, "1");
            OnSelectedTabItem i1 = new OnSelectedTabItem();

            tab_control.Items.Add(i1);
            Assert.AreEqual(tab_control.SelectedIndex, -1, "2");
            OnSelectedTabItem i2 = new OnSelectedTabItem();

            tab_control.Items.Add(i2);
            Assert.AreEqual(tab_control.SelectedIndex, 0, "3");
            Assert.IsTrue(i1.IsSelected, "4");
            i1.IsSelected = true;
            Assert.AreEqual(tab_control.SelectedIndex, 0, "5");
            i2.IsSelected = true;
            Assert.AreEqual(tab_control.SelectedIndex, 0, "6");
            Assert.IsTrue(i1.IsSelected, "7");
            Assert.IsTrue(i2.IsSelected, "8");
        }
Exemplo n.º 2
0
		public void OnSelectedInWindow3 ()
		{
			Window w = new Window ();
			OnSelectedTabControl tab_control = new OnSelectedTabControl ();
			w.Content = tab_control;
			w.Show ();
			Assert.AreEqual (tab_control.SelectedIndex, -1, "1");
			OnSelectedTabItem i1 = new OnSelectedTabItem ();
			tab_control.Items.Add (i1);
			Assert.AreEqual (tab_control.SelectedIndex, -1, "2");
			OnSelectedTabItem i2 = new OnSelectedTabItem ();
			tab_control.Items.Add (i2);
			Assert.AreEqual (tab_control.SelectedIndex, 0, "3");
			Assert.IsTrue (i1.IsSelected, "4");
			i1.IsSelected = true;
			Assert.AreEqual (tab_control.SelectedIndex, 0, "5");
			i2.IsSelected = true;
			Assert.AreEqual (tab_control.SelectedIndex, 0, "6");
			Assert.IsTrue (i1.IsSelected, "7");
			Assert.IsTrue (i2.IsSelected, "8");
		}