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); }
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)); }
public void DepartNonJoined() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var manager = new ClientUserManager(); Assert.IsFalse(manager.GetIsJoined(user)); Assert.IsFalse(manager.Depart(user)); }
public void Depart() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var manager = new ClientUserManager(); manager.Join(user); Assert.IsTrue(manager.GetIsJoined(user)); Assert.IsTrue(((IEnumerable <IUserInfo>)manager).Contains(user)); Assert.AreEqual(user, manager[user.UserId]); Assert.IsTrue(manager.Depart(user)); Assert.IsFalse(manager.GetIsJoined(user)); Assert.IsFalse(((IEnumerable <IUserInfo>)manager).Contains(user)); Assert.AreEqual(null, manager[user.UserId]); }
public void ExtensionGetIsJoinedUsername() { var user = new UserInfo("Nickname", "Phonetic", "Username", 1, 2, true); var user2 = new UserInfo("Nickname2", "Phonetic", "Username2", 2, 3, false); var manager = new ClientUserManager(); manager.Join(user); Assert.IsTrue(manager.GetIsJoined(user)); Assert.IsFalse(manager.GetIsJoined(user2)); manager.Join(user2); Assert.IsTrue(manager.GetIsJoined(user2)); manager.Depart(user); Assert.IsFalse(manager.GetIsJoined(user)); }
public void GetIsJoinedNullUser() { var manager = new ClientUserManager(); Assert.Throws <ArgumentNullException> (() => manager.GetIsJoined((IUserInfo)null)); }