상속: IClientUserManager
예제 #1
0
        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));
        }
예제 #2
0
        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]);
        }
예제 #3
0
        public void ExtensionGetIsJoinedId()
        {
            var user = new UserInfo ("Nickname", "Username", 1, 2, true);
            var user2 = new UserInfo ("Nickname2", "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));
        }
예제 #4
0
 public void DepartNullUser()
 {
     var manager = new ClientUserManager();
     Assert.Throws<ArgumentNullException> (() => manager.Depart (null));
 }
예제 #5
0
 public void UpdateNullUsers()
 {
     var manager = new ClientUserManager();
     Assert.Throws<ArgumentNullException> (() => manager.Update ((IEnumerable<IUserInfo>)null));
 }
예제 #6
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);
        }
예제 #7
0
        public void ToggleMuteNullUser()
        {
            var manager = new ClientUserManager();

            Assert.Throws<ArgumentNullException> (() => manager.ToggleMute (null));
        }
예제 #8
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));
        }
예제 #9
0
        public void IndexerPresent()
        {
            var user = new UserInfo ("Nickname", "Phonetic", "Username", 1, 2, true);

            var manager = new ClientUserManager();
            manager.Join (user);

            Assert.AreEqual (user, manager[user.UserId]);
        }
예제 #10
0
        public void IndexerNotPresent()
        {
            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);

            Assert.AreEqual (null, manager[user2.UserId]);
        }
예제 #11
0
 public void GetIsJoinedNullUser()
 {
     var manager = new ClientUserManager ();
     Assert.Throws<ArgumentNullException> (() => manager.GetIsJoined ((IUserInfo)null));
 }
예제 #12
0
 public void ManagerTearDown()
 {
     this.userProvider = null;
     this.server = null;
     this.handler = null;
     this.userManager = null;
     this.provider = null;
     this.context = null;
 }
예제 #13
0
        public void ManagerSetup()
        {
            this.provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            this.provider.Start (MessageTypes.All);

            var connections = this.provider.GetConnections (GablarskiProtocol.Instance);

            this.server = new ConnectionBuffer (connections.Item2);
            this.client = connections.Item1;

            userProvider = new MockUserProvider();
            context = new MockClientContext (client) { ServerInfo = new ServerInfo (new ServerSettings(), userProvider) };

            var channels = new ClientChannelManager (context);
            ClientChannelManagerTests.PopulateChannels (channels, this.server);

            this.userManager = new ClientUserManager();
            this.handler = new ClientUserHandler (context, userManager);
            context.Users = this.handler;
            context.Channels = channels;
        }