public void CanConnectTest5() { TECProtocol firstProtocol = new TECProtocol(new List <TECConnectionType>()); TECProtocol secondProtocol = new TECProtocol(new List <TECConnectionType>()); TECProtocol thirdProtocol = new TECProtocol(new List <TECConnectionType>()); TECProtocol fourthProtocol = new TECProtocol(new List <TECConnectionType>()); TECDevice compatibleDevice = new TECDevice(new List <TECConnectionType>(), new List <TECProtocol>() { fourthProtocol }, new TECManufacturer()); TECSubScope subScope = new TECSubScope(); subScope.Devices.Add(compatibleDevice); TECControllerType type = new TECControllerType(new TECManufacturer()); type.IO.Add(new TECIO(firstProtocol)); type.IO.Add(new TECIO(secondProtocol)); type.IO.Add(new TECIO(thirdProtocol)); TECProvidedController controller = new TECProvidedController(type); Assert.IsFalse(controller.CanConnect(subScope, firstProtocol)); Assert.IsFalse(controller.CanConnect(subScope, fourthProtocol)); }
public void CanConnectTest6() { TECConnectionType connectionType = new TECConnectionType(); TECDevice compatibleDevice = new TECDevice(new List <TECConnectionType> { connectionType }, new List <TECProtocol>(), new TECManufacturer()); TECSubScope subScope = new TECSubScope(); subScope.Devices.Add(compatibleDevice); TECPoint point = new TECPoint(); point.Type = IOType.AI; subScope.Points.Add(point); TECControllerType type = new TECControllerType(new TECManufacturer()); TECIOModule module = new TECIOModule(new TECManufacturer()); module.IO.Add(new TECIO(IOType.AI)); type.IOModules.Add(module); TECProvidedController controller = new TECProvidedController(type); Assert.IsTrue(controller.CanConnect(subScope, subScope.HardwiredProtocol())); }
public void RemoveInstanceWithGlobalConnectionToController() { TECBid bid = new TECBid(); bid.Catalogs = ModelCreation.TestCatalogs(rand); TECControllerType type = bid.Catalogs.ControllerTypes.RandomElement(rand); TECController controller = new TECProvidedController(type); bid.AddController(controller); TECTypical typical = new TECTypical(); TECController typicalController = new TECProvidedController(type); typical.AddController(typicalController); bid.Systems.Add(typical); TECSystem system = typical.AddInstance(); TECController instanceController = typical.GetInstancesFromTypical(typicalController).First(); Assert.IsTrue(controller.CanConnect(instanceController)); IControllerConnection connection = controller.Connect(instanceController, instanceController.AvailableProtocols.First()); Assert.IsTrue(connection is TECNetworkConnection); typical.Instances.Remove(system); Assert.IsTrue((connection as TECNetworkConnection).Children.Count == 0); }
public void CanConnectTest3() { TECDevice compatibleDevice = new TECDevice(new List <TECConnectionType>(), new List <TECProtocol>(), new TECManufacturer()); TECSubScope subScope = new TECSubScope(); subScope.Devices.Add(compatibleDevice); TECPoint point = new TECPoint(); point.Type = IOType.AI; subScope.Points.Add(point); TECControllerType type = new TECControllerType(new TECManufacturer()); type.IO.Add(new TECIO(IOType.AO)); TECProvidedController controller = new TECProvidedController(type); Assert.IsFalse(controller.CanConnect(subScope)); }