Exemple #1
0
        public IEnumerator <ActionResultInfo> AddSpectatorToRoom(IUser user, int roomId)
        {
            IEnumerator <ActionResultInfo> inumerator = new List <ActionResultInfo>().GetEnumerator();
            IGame gameRoom = GetRoomById(roomId);

            if (gameRoom != null)
            {
                inumerator = gameRoom.AddSpectetorToRoom(user);
                proxyDB.UpdateGameRoom((GameRoom)gameRoom);
                proxyDB.UpdateGameRoomPotSize(gameRoom.GetPotSize(), gameRoom.Id);
            }
            return(inumerator);
        }
        public void UpdateGameRoomPotSizeTest_good_boolReturn()
        {
            int      roomId  = new Random().Next();
            int      gameId  = new Random().Next();
            int      userId1 = 1;
            int      userId2 = 2;
            int      userId3 = 3;
            GameRoom toAdd   = CreateRoomWithId(gameId, roomId, userId1, userId2, userId3);

            proxy.InsertNewGameRoom(toAdd);
            bool ans = proxy.UpdateGameRoomPotSize(777, roomId);

            Assert.IsTrue(ans);
            Cleanup(gameId, roomId, userId1, userId2, userId3);
        }
Exemple #3
0
        public IEnumerator <ActionResultInfo> AddSpectatorToRoom(int userId, int roomId)
        {
            //IEnumerator<ActionResultInfo> inumerator = new List<ActionResultInfo>().GetEnumerator();

            //IUser user = _systemControl.GetUserWithId(userId);
            //if ( user != null)
            //{
            //    inumerator = _gameCenter.AddSpectatorToRoom(user, roomId);
            //}
            //return inumerator;
            //todo - new call below remove above

            IEnumerator <ActionResultInfo> inumerator = new List <ActionResultInfo>().GetEnumerator();
            IGame gameRoom = _gameCenter.GetRoomById(roomId);
            IUser user     = _systemControl.GetUserWithId(userId);

            if (gameRoom != null && user != null)
            {
                inumerator = gameRoom.AddSpectetorToRoom(user);
                _proxyDb.UpdateGameRoom((GameRoom)gameRoom);
                _proxyDb.UpdateGameRoomPotSize(gameRoom.GetPotSize(), gameRoom.Id);
            }
            return(inumerator);
        }