public void UserLoggedIn() { var msg = new UserJoinedMessage (UserInfoTests.GetTestUser()); msg.WritePayload (serverContext, writer); long length = stream.Position; stream.Position = 0; msg = new UserJoinedMessage(); msg.ReadPayload (clientContext, reader); Assert.AreEqual (length, stream.Position); UserInfoTests.AssertUserInfosMatch (UserInfoTests.GetTestUser(), msg.UserInfo); }
public void UserJoined() { var user = new UserInfo ("Nickname", "Username", 1, 2, true); var msg = new UserJoinedMessage (user); Assert.AreEqual (user.UserId, msg.UserInfo.UserId); Assert.AreEqual (user.CurrentChannelId, msg.UserInfo.CurrentChannelId); Assert.AreEqual (user.Nickname, msg.UserInfo.Nickname); Assert.AreEqual (user.Username, msg.UserInfo.Username); Assert.AreEqual (user.IsMuted, msg.UserInfo.IsMuted); msg.WritePayload (serverContext, writer); long length = stream.Position; stream.Position = 0; msg = new UserJoinedMessage(); msg.ReadPayload (clientContext, reader); Assert.AreEqual (length, stream.Position); Assert.AreEqual (user.UserId, msg.UserInfo.UserId); Assert.AreEqual (user.CurrentChannelId, msg.UserInfo.CurrentChannelId); Assert.AreEqual (user.Nickname, msg.UserInfo.Nickname); Assert.AreEqual (user.Username, msg.UserInfo.Username); Assert.AreEqual (user.IsMuted, msg.UserInfo.IsMuted); }