Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public bool RemoveRoomFromActiveGameList(IGame game)
 {
     lock (padlock)
     {
         try
         {
             if (game != null)
             {
                 bool exist = HasThisActiveGame(game);
                 if (exist)
                 {
                     userDataProxy.DeleteActiveGameOfUser(this.id, game.Id, game.GameNumber);
                     return(true);
                 }
             }
             return(false);
         }
         catch
         {
             return(false);
         }
     }
 }