public void ConvertAckCommandTest() { long version = 1; long messageId = 123123; long ackMessageId = 3242; AckCommand command = new AckCommand(ackMessageId); Message message = new Message(version, messageId, command); //Converting to xml DynamicXmlMessageConverter converter = new DynamicXmlMessageConverter(); XElement xml = converter.ConvertToXml(message); // And back again Message message2 = converter.ConvertFromXml(xml); AckCommand command2 = (AckCommand) message2.Command; Assert.That(command2.MessageId, Is.EqualTo(command.MessageId)); }
private void HandleLoginMessage(long incomingMessageId, LoginCommand command, IPEndPoint endPoint) { using (usersSync.UseWriteLock()) { // Finding existing user or creating new one var currentUser = users.SingleOrDefault(ui => ui.UserInfo.Name == command.UserInfo.Name); if (currentUser == null) { currentUser = new FullUserInfo(command.UserInfo); users.Add(currentUser); } // Changing user state currentUser.OnConnect(endPoint); // Sending Ack message var ackCommand = new AckCommand(incomingMessageId); var message = CreateMessage(ackCommand); SendMessage(endPoint, message); // Sending updated state SendUpdatedUserState(currentUser); } }