public void ControllerInPanel_RemovePanel() { TECPanel panel = new TECPanel(new TECPanelType(new TECManufacturer())); TECController controller = new TECProvidedController(new TECControllerType(new TECManufacturer())); ControllerInPanel controllerInPanel = new ControllerInPanel(controller, panel); controllerInPanel.Panel = null; Assert.AreEqual(panel.Controllers.Count, 0, "Controller not removed to panel"); }
public void ControllerInPanel_AddPanel() { TECPanel panel = new TECPanel(new TECPanelType(new TECManufacturer())); TECController controller = new TECProvidedController(new TECControllerType(new TECManufacturer())); ControllerInPanel controllerInPanel = new ControllerInPanel(controller, null); controllerInPanel.Panel = panel; Assert.AreEqual(panel.Controllers.Count, 1, "Controller not added to panel"); }
private void populateControllerCollection() { ControllerCollection = new ObservableCollection <ControllerInPanel>(); controllersIndex = new Dictionary <TECController, ControllerInPanel>(); foreach (TECController controller in sourceControllers) { TECPanel panelToAdd = PanelsSource.FirstOrDefault(panel => { return(panel.Controllers.Contains(controller)); }); var controllerInPanelToAdd = new ControllerInPanel(controller, panelToAdd); if (controller is TECFBOController fbo) { controllerInPanelToAdd = new FBOControllerInPanel(fbo, panelToAdd); } ControllerCollection.Add(controllerInPanelToAdd); controllersIndex[controller] = controllerInPanelToAdd; } }