public void OnSelectedInWindow5() { Window w = new Window(); TabControl tab_control = new TabControl(); w.Content = tab_control; w.Show(); Assert.AreEqual(tab_control.SelectedIndex, -1, "1"); OnSelectedTabItem2 i1 = new OnSelectedTabItem2(); tab_control.Items.Add(i1); Assert.AreEqual(tab_control.SelectedIndex, -1, "2"); OnSelectedTabItem2 i2 = new OnSelectedTabItem2(); 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"); }
public void OnSelectedInWindow5 () { Window w = new Window (); TabControl tab_control = new TabControl (); w.Content = tab_control; w.Show (); Assert.AreEqual (tab_control.SelectedIndex, -1, "1"); OnSelectedTabItem2 i1 = new OnSelectedTabItem2 (); tab_control.Items.Add (i1); Assert.AreEqual (tab_control.SelectedIndex, -1, "2"); OnSelectedTabItem2 i2 = new OnSelectedTabItem2 (); 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"); }