예제 #1
0
 //remove user from user list byID - syncronized
 public bool RemoveUserById(int id)
 {
     lock (padlock)
     {
         bool toReturn = false;
         if (!IsValidInputNotSmallerZero(id))
         {
             return(toReturn);
         }
         IUser original = GetUserWithId(id);
         if (original == null)
         {
             return(toReturn);
         }
         try
         {
             userProxy.DeleteUserById(id);
             toReturn = true;
         }
         catch (Exception e)
         {
             ErrorLog log = new ErrorLog("Error: while truing to remove user with id: " + id);
             logControl.AddErrorLog(log);
             toReturn = false;
             return(toReturn);
         }
         return(toReturn);
     }
 }
예제 #2
0
 public void Cleanup(int gameNum, int roomId, int userId1, int userId2, int userId3)
 {
     _userDataProxy.DeleteUserById(userId1);
     _userDataProxy.DeleteUserById(userId2);
     _userDataProxy.DeleteUserById(userId3);
     replayManager.DeleteGameReplay(roomID, 0);
     replayManager.DeleteGameReplay(roomID, 1);
     proxy.DeleteGameRoomPref(roomId);
     proxy.DeleteGameRoom(roomId, gameNum);
 }
예제 #3
0
        public void IsUnKnowTestGood_on_Create()
        {
            IUser user = new User(95950052, "orelie", "orelie95950052", "123456789", 0, 500, "*****@*****.**");

            _userDataProxy.AddNewUser(user);
            Assert.IsTrue(user.IsUnKnow());
            _userDataProxy.DeleteUserById(95950052);
        }
예제 #4
0
        public void LoginTest()
        {
            UserTable ut = CreateUser(88, "oo5o");

            ut.inActive = false;

            IUser user = ConvertToIUser(ut);

            _userDataProxy.AddNewUser(user);
            _userDataProxy.Login(user);
            Console.WriteLine(user.Id() + user.Name() + user.MemberName() + user.Password() + user.Points() +
                              user.Money() + user.Email() + user.WinNum + 0 + user.HighestCashGainInGame + user.TotalProfit + user.Avatar() +
                              user.GetNumberOfGamesUserPlay() + user.IsLogin() + user.GetLeague());
            IUser t = _userDataProxy.GetUserById(88);

            Console.WriteLine("!!!!Iuserrr  in test password  " + t.Password());
            Assert.IsTrue(t.IsLogin());
            _userDataProxy.DeleteUserById(88);
        }