Пример #1
0
        public void UpdateUser()
        {
            var user  = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true);
            var user2 = new UserInfo("Nickname2", "Phonetic2", "Username2", 2, 3, false);

            var manager = new ClientUserManager();

            manager.Join(user);

            user  = new UserInfo("NicknameU", "PhoneticU", "Username2", 1, 2, false);
            user2 = new UserInfo("Nickname2U", "Phonetic2U", "Username2", 2, 3, false);

            manager.Update(user);

            Assert.IsTrue(manager.GetIsJoined(user));
            Assert.AreEqual(user, manager[user.UserId]);
            Assert.AreEqual(user.Nickname, manager[user.UserId].Nickname);
            Assert.AreEqual(user.Phonetic, manager[user.UserId].Phonetic);
            Assert.AreEqual(user.Username, manager[user.UserId].Username);
            Assert.AreEqual(user.UserId, manager[user.UserId].UserId);
            Assert.AreEqual(user.CurrentChannelId, manager[user.UserId].CurrentChannelId);
            Assert.AreEqual(user.IsMuted, manager[user.UserId].IsMuted);

            manager.Update(user2);

            Assert.IsTrue(manager.GetIsJoined(user2));
            Assert.AreEqual(user2, manager[user2.UserId]);
            Assert.AreEqual(user2.Nickname, manager[user2.UserId].Nickname);
            Assert.AreEqual(user2.Phonetic, manager[user2.UserId].Phonetic);
            Assert.AreEqual(user2.Username, manager[user2.UserId].Username);
            Assert.AreEqual(user2.UserId, manager[user2.UserId].UserId);
            Assert.AreEqual(user2.CurrentChannelId, manager[user2.UserId].CurrentChannelId);
            Assert.AreEqual(user2.IsMuted, manager[user2.UserId].IsMuted);
        }
Пример #2
0
        public void UpdateEmpty()
        {
            var user  = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true);
            var user2 = new UserInfo("Nickname2", "Phonetic2", "Username2", 2, 3, false);

            var manager = new ClientUserManager();

            manager.Update(new [] { user, user2 });

            Assert.IsTrue(manager.GetIsJoined(user));
            Assert.IsTrue(manager.GetIsJoined(user2));
        }
Пример #3
0
        public void UpdateNullUser()
        {
            var manager = new ClientUserManager();

            Assert.Throws <ArgumentNullException> (() => manager.Update((IUserInfo)null));
        }