Exemple #1
0
 //return true if play in ess than 11 games.
 public bool IsUnKnow()
 {
     lock (padlock)
     {
         return(userDataProxy.GetUserById(id).GetNumberOfGamesUserPlay() <= 10);
         //      return unknowGamesPlay <= 10;
     }
 }
Exemple #2
0
        private Logic.Game.GameRoom CreateRoomWithId(int gameNum, int roomId, int userId1)
        {
            RegisterUser(userId1);
            useCommunication = false;

            List <Player> toAddPlayers = new List <Player>();
            IUser         user         = _userDataProxy.GetUserById(userId1);
            Decorator     deco         = SetDecoratoresNoLimitWithSpectatores();
            Player        player1      = new Player(user, 1000, roomId);

            toAddPlayers.Add(player1);
            Logic.Game.GameRoom gm = new Logic.Game.GameRoom(toAddPlayers, roomId, deco, _gameCenter, logControl, replayManager, ses);
            gm.GameNumber = gameNum;
            return(gm);
        }
Exemple #3
0
        public void RemoveRoomFromActiveGameListTest_good()
        {
            int      roomid  = new Random().Next();
            int      gameNum = new Random().Next();
            int      userId  = new Random().Next();
            GameRoom toAddg  = CreateRoomWithId(gameNum, roomid, userId);

            toAddg.SetIsActive(true);
            _gameDataProxy.InsertNewGameRoom(toAddg);
            IUser user = _userDataProxy.GetUserById(userId);

            user.AddRoomToActiveGameList(toAddg);
            Assert.IsTrue(user.RemoveRoomFromActiveGameList(toAddg));
            _userDataProxy.DeleteActiveGameOfUser(userId, roomid, gameNum);
            Cleanup(gameNum, roomid, userId);
        }
Exemple #4
0
        //return true - if user Id free, false otherwise
        //syncrinized - due to foreath
        public bool IsIdFree(int ID)
        {
            lock (padlock)
            {
                bool toReturn = true;

                if (!IsValidInputNotSmallerZero(ID))
                {
                    toReturn = false;
                    return(toReturn);
                }

                /* foreach (IUser u in users)
                 * {
                 *   if (u.Id() ==  ID)
                 *   {
                 *       toReturn = false;
                 *       return toReturn;
                 *   }
                 * }*/
                IUser tocheack = userProxy.GetUserById(ID);
                return(tocheack == null);
            }
        }
Exemple #5
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);
        }