static TheOPCUAClient ConnectOPCClient(string opcAddress) { var client = TheOPCUAClient.CreateAndInitAsync(myContentService, opcAddress, new OPCUAParameters { AcceptInvalidCertificate = true, AcceptUntrustedCertificate = true, DisableDomainCheck = true, DisableSecurity = true, }).Result; Assert.IsNotNull(client); var result = client.ConnectAsync().Result; Assert.IsTrue(String.IsNullOrEmpty(result), $"Error sending connect message to OPC UA Client plug-in: {result}"); Assert.IsTrue(client.IsConnected, "OPC UA Client not connected after sending connect message"); return(client); }
public void InitTests() { //if (System.Threading.Interlocked.Increment(ref activeHosts) != 1) //{ // return; //} if (myOPCServer != null) { return; // Workaround: cdEngine host and server shutdown not supported } StartHost(); myOPCServer = StartOPCServer(true); Assert.IsNotNull(myOPCServer); // TODO Remove dependency on L49 VM in the Lab //myOPCClient = await ConnectOPCClientAsync("opc.tcp://10.1.10.135:4840"); var opcServerAddress = "opc.tcp://localhost:4840/c-labs/DataAccessServer"; myOPCClient = ConnectOPCClient(opcServerAddress); Assert.IsNotNull(myOPCClient, $"Unable to connect to OPC UA Server {opcServerAddress}"); }