public void TestCreateGame() { object objUser = db.getUserByName("test0"); Assert.IsInstanceOfType(objUser, typeof(SystemUser)); SystemUser user = (SystemUser)objUser; object game = sl.createGame(user.id, "Limit", 1000, 100, 15000, 120, 4, 8, true, false); Assert.IsInstanceOfType(game, typeof(TexasHoldemGame)); }
public void SetUp() { db = new PeLImpl(); for (int i = 0; i < 4; i++) { db.RegisterUser("test" + i, "" + i, "email" + i, null); } db.EditUserById(db.getUserByName("test0").id, null, null, null, null, 1000, 10, false); db.EditUserById(db.getUserByName("test1").id, null, null, null, null, 0, 15, false); db.EditUserById(db.getUserByName("test2").id, null, null, null, null, 700, 20, false); db.EditUserById(db.getUserByName("test3").id, null, null, null, null, 1500, 25, false); var userList = new List <SystemUser> { db.getUserByName("test0"), db.getUserByName("test1"), db.getUserByName("test2"), db.getUserByName("test3") }; center = GameCenter.getGameCenter(); sl = new SLImpl(); center = GameCenter.getGameCenter(); game = (TexasHoldemGame)sl.createGame(0, "No_limit", 1000, 30, 50, 10, 2, 10, true, false); game.gameId = 1; game.players[1] = new Player(userList[1].id, userList[1].name, 50, userList[1].rank, new byte[0]); game.players[2] = new Player(userList[2].id, userList[2].name, 50, userList[2].rank, new byte[0]); for (int i = 0; i < 3; i++) { game.players[i].playerState = Player.PlayerState.in_round; } game.currentBlindBet = 20; }
private static void CreateGame(ClientInfo clientInfo, JObject jsonObject) { var gameCreatorIdToken = jsonObject["gameCreatorId"]; var gamePolicyToken = jsonObject["gamePolicy"]; var gamePolicyLimitToken = jsonObject["gamePolicyLimit"]; var buyInPolicyToken = jsonObject["buyInPolicy"]; var startingChipsToken = jsonObject["startingChips"]; var minimalBetToken = jsonObject["minimalBet"]; var minimalPlayersToken = jsonObject["minimalPlayers"]; var maximalPlayersToken = jsonObject["maximalPlayers"]; var spectateAllowedToken = jsonObject["spectateAllowed"]; var isLeagueToken = jsonObject["isLeague"]; if ((gameCreatorIdToken == null) || (gameCreatorIdToken.Type != JTokenType.Integer) /*|| * (gamePolicyToken == null) || (gamePolicyToken.Type != JTokenType.String) || * String.IsNullOrWhiteSpace((string)(gamePolicyToken))*/) { throw new ArgumentException("Error: Parameters Mismatch at Create Game."); } var createGameResponse = sl.createGame( (int)gameCreatorIdToken, (string)gamePolicyToken, (int?)gamePolicyLimitToken, (int?)buyInPolicyToken, (int?)startingChipsToken, (int?)minimalBetToken, (int?)minimalPlayersToken, (int?)maximalPlayersToken, (bool?)spectateAllowedToken, (bool?)isLeagueToken); SendMessage(clientInfo, createGameResponse); return; }
public object creatGame(int gameCreator, string gamePolicy, int?gamePolicyLimit, int?buyInPolicy, int?startingChipsAmount, int?MinimalBet, int?minPlayers, int?maxPlayers, bool?isSpectatingAllowed, bool?isLeague) { return(sl.createGame(gameCreator, gamePolicy, gamePolicyLimit, buyInPolicy, startingChipsAmount, MinimalBet, minPlayers, maxPlayers, isSpectatingAllowed, isLeague)); }
public void TestCreateGameWithNonExistantUser() { object game = sl.createGame(40, "Limit", 100, 100, 15000, 120, 4, 8, true, false); Assert.IsNotInstanceOfType(game, typeof(TexasHoldemGame)); }