/// <summary> /// Creates an OSC Client (sends OSC messages) given an outgoing port and address. /// </summary> /// <param name="clientId"> /// A <see cref="System.String"/> /// </param> /// <param name="destination"> /// A <see cref="IPAddress"/> /// </param> /// <param name="port"> /// A <see cref="System.Int32"/> /// </param> public void CreateSender(string clientId, IPAddress destination, int port) { if (!_senders.ContainsKey(clientId)) { SenderLog clientitem = new SenderLog(); clientitem.sender = new OSCSender(destination, port); clientitem.log = new List <LogInfo>(); clientitem.messages = new List <OSCMessage>(); _senders.Add(clientId, clientitem); // Send test message string testaddress = "/test/alive/"; OSCMessage message = new OSCMessage(testaddress, destination.ToString()); message.Append(port); message.Append("OK"); _senders[clientId].log.Add(new LogInfo { Timestamp = DateTime.UtcNow, Log = DataToString(message.Data) }); _senders[clientId].messages.Add(message); _senders[clientId].sender.Send(message); } }
protected void Assert_of_operation(int log_index, SenderMock.Operation operation, Type type, string url_part = null) { SenderLog log = _sender.Log[log_index]; //Assert.AreEqual(operation, log.Operation, " (" + log_index.ToString() + ") " + log.Request?.GetType().Name + " - " + log.Url); //Assert.AreEqual(type, log.Request?.GetType(), " (" + log_index.ToString() + ") " + log.Operation.ToString() + " - " + log.Url); Assert.AreEqual(operation + " " + type?.Name, log.Operation + " " + log.Request?.GetType()?.Name, " (" + log_index.ToString() + ") " + log.Url); if (url_part != null) { Assert.IsTrue(log.Url.Contains(url_part), " (" + log_index.ToString() + ") " + log.Request?.GetType().Name + " - " + log.Operation.ToString()); } }