Ejemplo n.º 1
0
        public void ListLimitGamesByPrefTestGood()
        {
            //delete all users and games
            //RestartSystem();
            SetupUser1();
            var limitGames     = GameBridge.GetGamesByGameMode(GameMode.Limit);
            int numLimitBefore = limitGames == null ? 0 : limitGames.Count;
            int roomId1        = GameBridge.CreateGameRoomWithPref(UserId, 10, false, GameMode.Limit,
                                                                   2, 8, 1, 1);

            Assert.True(roomId1 != -1);
            RegisterUser2();
            var noLimitGames     = GameBridge.GetGamesByGameMode(GameMode.NoLimit);
            int numNoLimitBefore = noLimitGames == null ? 0 : noLimitGames.Count;
            int roomId2          = GameBridge.CreateGameRoomWithPref(_userId2, 10, false, GameMode.NoLimit,
                                                                     2, 8, 1, 1);

            Assert.True(roomId2 != -1);
            limitGames = GameBridge.GetGamesByGameMode(GameMode.Limit);
            int numLimitAfter = limitGames == null ? 0 : limitGames.Count;

            noLimitGames = GameBridge.GetGamesByGameMode(GameMode.NoLimit);
            int numNoLimitAfter = noLimitGames == null ? 0 : noLimitGames.Count;

            Assert.AreEqual(numNoLimitAfter, numNoLimitBefore + 1);
            Assert.AreEqual(numLimitAfter, numLimitBefore + 1);
            CleanUp(roomId1);
            CleanUp(roomId2);
        }
Ejemplo n.º 2
0
        public void CreateGameWithPrefTestBad()
        {
            RoomId = -1;
            SetupUser1();
            Assert.True(RoomId == -1);
            Assert.False(UserBridge.getUserById(UserId) == null);

            RoomId = GameBridge.CreateGameRoomWithPref(UserId, 10, false, GameMode.PotLimit, 0, 0, -1, 0);
            Assert.True(RoomId == -1);
            Assert.False(GameBridge.DoesRoomExist(RoomId));
            CleanUp(RoomId);
        }
Ejemplo n.º 3
0
 public void CreateGameWithPrefTestGood()
 {
     UserId = new Random().Next();
     RegisterUserToDB(UserId);
     RoomId = -1;
     Assert.True(RoomId == -1);
     RoomId = GameBridge.CreateGameRoomWithPref(UserId, 100, true, GameMode.Limit, 2, 8, 0, 10);
     Assert.True(RoomId != -1);
     Assert.True(GameBridge.DoesRoomExist(RoomId));
     Assert.AreEqual(1, GameBridge.GetPlayersInRoom(RoomId).Count);
     Assert.AreEqual(UserId, GameBridge.GetPlayersInRoom(RoomId).First().user.Id());
     CleanUp(RoomId);
 }
Ejemplo n.º 4
0
        public void ListSpectatableGamesTestSad()
        {
            //delete all users and games, register user1
            //RestartSystem();
            int id = SetupUser1();
            var spectateableGamesBefore = GameBridge.ListSpectateableRooms();
            int numBefore = spectateableGamesBefore == null ? 0 : spectateableGamesBefore.Count;
            int roomId    = GameBridge.CreateGameRoomWithPref(id, 10, false, GameMode.Limit,
                                                              2, 8, 1, 1);

            Assert.True(roomId != -1);
            var spectateableGamesAfter = GameBridge.ListSpectateableRooms();
            int numAfter = spectateableGamesBefore == null ? 0 : spectateableGamesAfter.Count;

            Assert.AreEqual(numBefore, numAfter);
            CleanUp(roomId);
        }
Ejemplo n.º 5
0
        public void ListSpectatableGamesTestGood()
        {
            //delete all users and games, register user1
            //RestartSystem();
            SetupUser1();
            var games            = GameBridge.ListSpectateableRooms();
            int numOfGamesBefore = games == null ? 0 : games.Count;
            int roomId           = GameBridge.CreateGameRoomWithPref(UserId, 10, true, GameMode.Limit, 2, 8, 1, 1);

            Assert.True(roomId != -1);
            games = GameBridge.ListSpectateableRooms();
            int numOfGamesAfter = games == null ? 0 : games.Count;
            var spec            = GameBridge.ListSpectateableRooms();

            Assert.AreEqual(numOfGamesBefore + 1, numOfGamesAfter);
            Assert.True(spec.Exists(game => game.Id == roomId));
            CleanUp(roomId);
        }
Ejemplo n.º 6
0
        public void ListGamesByPrefTestBad()
        {
            //delete all users and games
            //RestartSystem();
            SetupUser1();
            var games            = GameBridge.GetGamesByGameMode(GameMode.PotLimit);
            int numOfGamesBefore = games == null ? 0 : games.Count;

            RoomId = GameBridge.CreateGameRoomWithPref(UserId, 10, false, GameMode.Limit, 2, 8, 1, 1);
            Assert.True(RoomId != -1);
            RegisterUser2();
            int roomId2 = GameBridge.CreateGameRoomWithPref(_userId2, 10, false, GameMode.NoLimit, 2, 8, 1, 1);

            Assert.True(roomId2 != -1);
            games = GameBridge.GetGamesByGameMode(GameMode.PotLimit);
            int numOfGamesAfter = games == null ? 0 : games.Count;

            Assert.AreEqual(numOfGamesBefore, numOfGamesAfter);
            CleanUp(RoomId);
            CleanUp(roomId2);
        }