public void SendAndReceiveGameEventTest() { SendGameInvitationEvent(); List <PlayerMessage> messages = _quoridorService.GetMessages(); Assert.That(messages.Count, Is.EqualTo(1)); GameEvent ge = GameEventParser.Deserialize(messages[0].Message); Assert.That(ge.GetGameEventType(), Is.EqualTo(GameEventType.GameInvitation)); }
private List <PlayerMessage> FilterGameEvents(List <PlayerMessage> messages) { List <PlayerMessage> textMessages = new List <PlayerMessage>(); if (messages.Count > 0) { foreach (var playerMessage in messages) { if (IsJSON(playerMessage.Message)) { var gameEvent = GameEventParser.Deserialize(playerMessage.Message); _gameEvents.Enqueue(gameEvent); } else { textMessages.Add(playerMessage); } } } return(textMessages); }