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();
        }
예제 #2
0
        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 userDummies = new List <SystemUser>
            {
                db.getUserByName("test0"),
                db.getUserByName("test1"),
                db.getUserByName("test2"),
                db.getUserByName("test3")
            };

            Random rnd = new Random();

            foreach (SystemUser u in userDummies)
            {
                u.rank = rnd.Next(0, 999999);
            }
            center = GameCenter.getGameCenter();
            center.maintainLeagues(userDummies);
            sl = new SLImpl();
        }
예제 #3
0
        public void TestLogoutFail()
        {
            db.EditUserById(db.getUserByName("Hadas").id, null, null, null, null, 100000, null, true);
            int id = db.getUserByName("Hadas").id;

            Assert.IsNotNull(addPlayerToGame(id, game.gameId, 1));
            Assert.IsFalse(((ReturnMessage)logout(db.getUserByName("Hadas").id)).success);
        }
예제 #4
0
 public void editUserInDB()
 {
     for (int i = 0; i < 4; i++)
     {
         db.RegisterUser("test" + i, "" + i, "email" + i, null);
     }
     Assert.IsTrue(db.EditUserById(db.getUserByName("test0").id, null, null, null, null, 1000, 10, false));
     Assert.IsTrue(db.EditUserById(db.getUserByName("test1").id, null, null, null, null, 0, 15, false));
     Assert.IsTrue(db.EditUserById(db.getUserByName("test2").id, null, null, null, null, 700, 20, false));
     Assert.IsTrue(db.EditUserById(db.getUserByName("test3").id, null, null, null, null, 1500, 25, false));
 }
예제 #5
0
        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;
        }
        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();

            //set the leagues
            center.maintainLeagues(userList);

            //get the league of user 3
            League l = center.getUserLeague(userList[3]);

            //setting the games
            //pref order: mustpref(spectate,league)->game type , buy in policy, starting chips, minimal bet, minimum players, maximum players.
            var gamesList = new List <TexasHoldemGame>
            {
                //regular games
                new TexasHoldemGame(userList[0], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(9, null)))))), true),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                new TexasHoldemGame(userList[0], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(9, null)))))), false),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                new TexasHoldemGame(userList[1], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(2, null)))))), true),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                new TexasHoldemGame(userList[1], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(2, null)))))), false),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                new TexasHoldemGame(userList[2], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(2, null)))))), false),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                new TexasHoldemGame(userList[2], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(2, null)))))), false),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                //league games
                new TexasHoldemGame(userList[3], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(2, null)))))), false, l.minRank, l.maxRank),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2])),
                new TexasHoldemGame(userList[3], new MustPreferences(new GamePolicyDecPref(GameTypePolicy.No_Limit, 0,
                                                                                           new BuyInPolicyDecPref(100, new StartingAmountChipsCedPref(500,
                                                                                                                                                      new MinBetDecPref(20, new MinPlayersDecPref(2,
                                                                                                                                                                                                  new MaxPlayersDecPref(2, null)))))), false, l.minRank, l.maxRank),
                                    userIdDeltaRank => db.EditUserById(userIdDeltaRank[0], null, null, null, null, null, userIdDeltaRank[1], false),
                                    userIdLeaderB => db.EditUserLeaderBoardsById(userIdLeaderB[0], userIdLeaderB[1], userIdLeaderB[2]))
            };

            for (int i = 0; i < gamesList.Count; i++)
            {
                gamesList[i].gameId = i;
                center.TexasHoldemGames.Add(gamesList[i]);
            }

            sl = new SLImpl();
        }