public void GetIsConnected()
        {
            Assert.IsFalse(manager.GetIsConnected(server));

            manager.Connect(server);

            Assert.IsTrue(manager.GetIsConnected(server));
            Assert.IsFalse(manager.GetIsConnected(provider.GetServerConnection()));

            manager.Disconnect(server);

            Assert.IsFalse(manager.GetIsConnected(server));
        }
Example #2
0
        public static void Disconnect(this IServerUserManager self, IUserInfo user)
        {
            if (self == null)
            {
                throw new ArgumentNullException("self");
            }

            var c = self.GetConnection(user);

            if (c != null)
            {
                self.Disconnect(c);
            }
        }
Example #3
0
        /// <returns><c>true</c> if the nickname is now free, <c>false</c> otherwise.</returns>
        private bool AttemptNicknameRecovery(IUserInfo info, string nickname)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            if (nickname == null)
            {
                throw new ArgumentNullException("nickname");
            }

            nickname = nickname.ToLower().Trim();

            IUserInfo current = Manager.Where(u => u.Nickname != null).Single(u => u.Nickname.ToLower().Trim() == nickname);

            if (info.IsRegistered && info.UserId == current.UserId)
            {
                Manager.Disconnect(current);
                return(true);
            }

            return(false);
        }