static LiveLinkTestConnection.Message AssertNextMessage(Guid msgType, int forPlayer) { Assert.Greater(s_Connection.IncomingMessages.Count, 0, $"Expected another message of type {LiveLinkDebugHelper.GetMessageName(msgType) ?? msgType.ToString()} but there are no more messages."); var msg = s_Connection.IncomingMessages.Peek(); Assert.IsTrue(forPlayer == msg.Player || msg.Player == 0, $"Expected a message for player {forPlayer} but received a message for player {msg.Player}, message type: {LiveLinkDebugHelper.GetMessageName(msg.Id)}"); Assert.AreEqual(msgType, msg.Id, $"Expected a message of type {LiveLinkDebugHelper.GetMessageName(msgType)}, but found {LiveLinkDebugHelper.GetMessageName(msg.Id)}. Messages:\n{s_Connection.GetMessageString()}"); s_Connection.IncomingMessages.Dequeue(); return msg; }
public void EditorListensForMessages() { Assert.AreEqual(1, s_Connection.ConnectHandler.Count); Assert.AreEqual(1, s_Connection.DisconnectHandler.Count); foreach (var msg in LiveLinkDebugHelper.PlayerMessages) { Assert.Greater(s_Connection.GetNumMessageHandlers(msg), 0, $"Editor does not listen for player message {LiveLinkDebugHelper.GetMessageName(msg)}."); } }
public override string ToString() => $"{LiveLinkDebugHelper.GetMessageName(Id) ?? Id.ToString()} for {Player}, {Data.Length} bytes";