public void CanBeParentedToTest() { ControlDesigner rootPanel = (ControlDesigner)_helper.IDesignerHost.GetDesigner(_helper.CreateControl(typeof(TestPanel), null)); ControlDesigner childPanel = (ControlDesigner)_helper.IDesignerHost.GetDesigner(_helper.CreateControl(typeof(TestPanel), rootPanel.Control)); ControlDesigner rootButton = (ControlDesigner)_helper.IDesignerHost.GetDesigner(_helper.CreateControl(typeof(TestButton), null)); ControlDesigner childPanelButton = (ControlDesigner)_helper.IDesignerHost.GetDesigner(_helper.CreateControl(typeof(TestButton), childPanel.Control)); ControlDesigner rootPanelButton = (ControlDesigner)_helper.IDesignerHost.GetDesigner(_helper.CreateControl(typeof(TestButton), rootPanel.Control)); Assert.IsFalse(rootButton.CanBeParentedTo(childPanelButton), "#1"); Assert.IsFalse(((ControlDesigner)_helper.IDesignerHost.GetDesigner(_helper.IDesignerHost.RootComponent)).CanBeParentedTo(rootButton), "#2"); Assert.IsTrue(childPanelButton.CanBeParentedTo(childPanel), "#3"); Assert.IsTrue(childPanel.CanBeParentedTo(childPanel), "#4"); Assert.IsFalse(childPanel.CanBeParentedTo(childPanelButton), "#5"); Assert.IsTrue(rootPanelButton.CanBeParentedTo(childPanel), "#6"); Assert.IsTrue(childPanel.CanBeParentedTo(rootPanel), "#7"); Assert.IsFalse(rootPanel.CanBeParentedTo(childPanel), "#8"); }