예제 #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);
        }
예제 #2
0
파일: User.cs 프로젝트: shoferb/OYAOB
 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);
         }
     }
 }