public void GetNextControlFromTabControl2 () { Form form = new Form (); form.ShowInTaskbar = false; TabControl tab = new TabControl (); TabPage page1 = new TabPage ("page one"); page1.Controls.AddRange (flat_controls); TabPage page2 = new TabPage ("page two"); tab.TabPages.Add (page1); tab.TabPages.Add (page2); form.Controls.Add (tab); form.Show (); Assert.AreEqual (form.GetNextControl (null, true), tab, "form-1"); Assert.AreEqual (form.GetNextControl (null, false), page2, "form-2"); Assert.AreEqual (form.GetNextControl (tab, true), page1, "tab-1"); Assert.AreEqual (form.GetNextControl (tab, false), null, "tab-2"); Assert.AreEqual (form.GetNextControl (page1, true), flat_controls [0], "page-one-1"); Assert.AreEqual (form.GetNextControl (page1, false), tab, "page-one-2"); Assert.AreEqual (form.GetNextControl (page2, true), null, "page-two-1"); Assert.AreEqual (form.GetNextControl (page2, false), flat_controls [2], "page-two-2"); Assert.AreEqual (form.GetNextControl (flat_controls [0], false), page1, "form-ctrls-0-backward"); Assert.AreEqual (form.GetNextControl (flat_controls [2], true), page2, "form-ctrls-2-forward"); Assert.AreEqual (tab.GetNextControl (null, true), page1, "tab-null-forward"); Assert.AreEqual (tab.GetNextControl (page1, false), null, "tab-page1-backward"); Assert.AreEqual (tab.GetNextControl (flat_controls [0], false), page1, "tab-ctrls-0-backward"); Assert.AreEqual (tab.GetNextControl (flat_controls [2], true), page2, "tab-ctrls-2-forward"); Assert.AreEqual (page1.GetNextControl (flat_controls [0], true), flat_controls [1], "page1-ctrls-0-forward"); Assert.AreEqual (page1.GetNextControl (flat_controls [0], false), null, "page1-ctrls-0-backward"); Assert.AreEqual (page1.GetNextControl (flat_controls [1], true), flat_controls [2], "page1-ctrls-1-forward"); Assert.AreEqual (page1.GetNextControl (flat_controls [1], false), flat_controls [0], "page1-ctrls-1-backward"); Assert.AreEqual (page1.GetNextControl (flat_controls [2], true), null, "page1-ctrls-2-forward"); Assert.AreEqual (page1.GetNextControl (flat_controls [2], false), flat_controls [1],"page1-ctrls-2-backward"); form.Dispose (); }