//delete all users and all games // protected void ////RestartSystem() // { // //delete all users: // List<int> allUsers = UserBridge.GetAllUsers(); // Users.ForEach(u => // { // if (!allUsers.Contains(u)) // { // CleanUserAndHisGames(u); // } // }); // allUsers.ForEach(user => // { // List<int> usersGames = UserBridge.GetUsersGameRooms(user); // usersGames.ForEach(usersRoom => // { // UserBridge.RemoveUserFromRoom(user, usersRoom); // }); // UserBridge.DeleteUser(user); // }); // //delete all rooms // List<int> allGames = GameBridge.GetAllGamesId(); // if (allGames == null) // { // allGames = new List<int>(); // } // else // { // foreach (int id in allGames) // { // GameBridge.RemoveRoom(id); // } // } // allGames = GameBridge.GetAllGamesId(); //// Assert.True(allGames.Count == 0); // Assert.False(GameBridge.DoesRoomExist(RoomId)); // RoomId = -1; // } //create a new game with user2 as only player, return user2's Id protected void CreateGameWithUser1() { //delete room1 if exists if (GameBridge.DoesRoomExist(RoomId)) { GameBridge.GetPlayersInRoom(RoomId).ForEach(p => { UserBridge.RemoveUserFromRoom(p.user.Id(), RoomId); }); } Assert.True(!GameBridge.DoesRoomExist(RoomId)); RoomId = GameBridge.CreateGameRoom(UserId, 100); //make sure the room is deleted Assert.True(RoomId != -1); }