public void UserRemoveFromRoomSpectatorTestGood() { UserId = SetupUser1(); int roomId = new Random().Next(); CreateGame(roomId, UserId, 100, true, GameMode.NoLimit, 2, 8, 0, 10); Assert.IsTrue(UserBridge.RemoveUserFromRoom(UserId, roomId)); CleanUp(roomId); UserBridge.DeleteUser(UserId); }
private bool DeleteUser(int id) { if (id != -1) { List <int> user2Games = UserBridge.GetUsersGameRooms(id); foreach (var roomId in user2Games) { UserBridge.RemoveUserFromRoom(id, roomId); } UserBridge.DeleteUser(id); return(true); } return(false); }
public void GetReplayableGamesTestGood() { //create a game to be replayd //RestartSystem(); SetupUser1(); CreateGameWithUser1(); RegisterUser(_userId2, _user2Name, _user2Pw, _user2EmailGood); IUser user2 = UserBridge.getUserById(_userId2); user2.AddMoney(1000); Assert.True(UserBridge.AddUserToGameRoomAsPlayer(_userId2, RoomId, user2.Money())); RegisterUser(_userId3, _user3Name, _user3Pw, _user3EmailGood); IUser user3 = UserBridge.getUserById(_userId3); user3.AddMoney(1000); Assert.True(UserBridge.AddUserToGameRoomAsPlayer(_userId3, RoomId, user3.Money())); GameBridge.StartGame(UserId, RoomId); System.Threading.Thread.Sleep(5000); UserBridge.RemoveUserFromRoom(UserId, RoomId); UserBridge.RemoveUserFromRoom(_userId2, RoomId); UserBridge.RemoveUserFromRoom(_userId3, RoomId); Assert.True(ReplayBridge.GetReplayableGames(RoomId, 0, _userId3)._actions.Count >= 1); }