ReadPayload() public méthode

public ReadPayload ( ISerializationContext context, IValueReader reader ) : void
context ISerializationContext
reader IValueReader
Résultat void
        public void UserList()
        {
            List<IUserInfo> users = new List<IUserInfo>
            {
                UserInfoTests.GetTestUser(1),
                UserInfoTests.GetTestUser(2)
            };

            var msg = new UserInfoListMessage (users);
            Assert.AreEqual (1, msg.Users.Count (ui => ui.UserId.Equals (users[0].UserId) && ui.CurrentChannelId.Equals (users[0].CurrentChannelId) && ui.Nickname == users[0].Nickname && ui.IsMuted == users[0].IsMuted));
            Assert.AreEqual (1, msg.Users.Count (ui => ui.UserId.Equals (users[1].UserId) && ui.CurrentChannelId.Equals (users[1].CurrentChannelId) && ui.Nickname == users[1].Nickname && ui.IsMuted == users[1].IsMuted));
            msg.WritePayload (serverContext, writer);
            long length = stream.Position;
            stream.Position = 0;

            msg = new UserInfoListMessage();
            msg.ReadPayload (clientContext, reader);
            Assert.AreEqual (length, stream.Position);
            Assert.AreEqual (1, msg.Users.Count (ui => ui.UserId.Equals (users[0].UserId) && ui.CurrentChannelId.Equals (users[0].CurrentChannelId) && ui.Nickname == users[0].Nickname && ui.IsMuted == users[0].IsMuted));
            Assert.AreEqual (1, msg.Users.Count (ui => ui.UserId.Equals (users[1].UserId) && ui.CurrentChannelId.Equals (users[1].CurrentChannelId) && ui.Nickname == users[1].Nickname && ui.IsMuted == users[1].IsMuted));
        }
        public void EmptyUserList()
        {
            var msg = new UserInfoListMessage(new List<IUserInfo>());
            Assert.AreEqual (0, msg.Users.Count());
            msg.WritePayload (serverContext, writer);
            long length = stream.Position;
            stream.Position = 0;

            msg = new UserInfoListMessage();
            msg.ReadPayload (clientContext, reader);
            Assert.AreEqual (length, stream.Position);
            Assert.AreEqual (0, msg.Users.Count ());
        }