public void UpdateGameRoomPotSizeTest_good() { proxy.InsertNewGameRoom(gameRoom); gameRoom.SetPotSize(777); bool ans = proxy.UpdateGameRoom(gameRoom); IGame g = proxy.GetGameRoombyId(gameRoom.Id); Assert.IsTrue(ans); Assert.IsTrue(g.IsPotSizeEqual(777)); proxy.DeleteGameRoomPref(gameRoom.Id); proxy.DeleteGameRoom(gameRoom.Id, gameRoom.GetGameNum()); }
public Tuple <bool, string> GetGameReplayForUserSearch(int gameRoomID, int userId) { IGame game = proxy.GetGameRoombyId(gameRoomID); string toRet = proxy.GetGameRoomReplyById(gameRoomID); bool flag = false; foreach (var user in game.GetPlayersInRoom()) { if (user.user.Id() == userId) { flag = true; } } foreach (var user in game.GetSpectetorInRoom()) { if (user.user.Id() == userId) { flag = true; } } if (toRet == null) { toRet = ""; } return(new Tuple <bool, string>(flag, toRet)); }
public void InsertGameRoomTest() { GameRoomXML gamexml = new GameRoomXML(gameRoom); Database.LinqToSql.GameRoom toIns = new Database.LinqToSql.GameRoom(); toIns.GameId = gameRoom.GetGameNum(); toIns.isActive = gameRoom.IsGameActive(); toIns.RoomId = gameRoom.Id; toIns.GameXML = proxy.GameRoomToXElement(gamexml); toIns.Replay = gameRoom.GetGameReplay(); bool ans = controller.InsertGameRoom(toIns); IGame g = proxy.GetGameRoombyId(gameRoom.Id); Assert.IsTrue(ans); Assert.IsNotNull(g); proxy.DeleteGameRoomPref(gameRoom.Id); proxy.DeleteGameRoom(gameRoom.Id, gameRoom.GetGameNum()); }
//return room by room if - suncronized due to for //return null if room Id smaller than 0 or not found public IGame GetRoomById(int roomId) { return(proxyDB.GetGameRoombyId(roomId)); }