public void AddSystemLogTest_good_id() { int roomid = new Random().Next(); int gameNum = new Random().Next(); int userId = new Random().Next(); int logId = new Random().Next(); Logic.Game.GameRoom toAddg = CreateRoomWithId(gameNum, roomid, userId); proxy.InsertNewGameRoom(toAddg); Database.LinqToSql.SystemLog toAdd = new Database.LinqToSql.SystemLog(); Database.LinqToSql.Log logs = new Database.LinqToSql.Log { LogId = logId, LogPriority = 1 }; toAdd.Log = logs; toAdd.logId = logId; toAdd.msg = "test AddSystemLogTest_good_id()"; toAdd.roomId = roomid; toAdd.game_Id = gameNum; _logDataControler.AddSystemLog(toAdd); Assert.AreEqual(_logsOnlyForTest.GetSystemLogById(logId).logId, logId); _logsOnlyForTest.DeleteSystemLog(logId); _logsOnlyForTest.DeleteLog(logId); Cleanup(gameNum, roomid, userId); }
private void DeleteSysLog(int roomid) { List <int> toDelete = logsOnlyForTest.GetSysLogIdsByRoomId(roomid); foreach (var id in toDelete) { logsOnlyForTest.DeleteSystemLog(id); logsOnlyForTest.DeleteSystemLog(id); } }
public void AddSysLogTest_good_id_match() { int roomid = new Random().Next(); int gameNum = new Random().Next(); int userId = new Random().Next(); GameRoom toAdd = CreateRoomWithId(gameNum, roomid, userId); proxy.InsertNewGameRoom(toAdd); var systemLog = new SystemLog(roomid, "AddSysLogTest_good_id_match", gameNum); _logDataProxy.AddSysLog(systemLog); var logId = systemLog.LogId; Assert.AreEqual(_logsOnlyForTest.GetSystemLogById(logId).logId, logId); _logsOnlyForTest.DeleteSystemLog(logId); _logsOnlyForTest.DeleteLog(logId); Cleanup(gameNum, roomid, userId); }
public bool RemoveRoom(int roomId) { var logIds = _logDbHandler.GetSysLogIdsByRoomId(roomId); logIds.ForEach(id => _logDbHandler.DeleteSystemLog(id)); bool ans = _gameCenter.RemoveRoom(roomId); return(ans); }
public void Cleanup() { sysControl.RemoveUserById(8585000); sysControl.RemoveUserById(8585001); sysControl.RemoveUserById(8585002); //user1 = null; //user2 = null; //players = null; //player1 = null; //gameRoom = null; replayManager.DeleteGameReplay(roomID, 0); replayManager.DeleteGameReplay(roomID, 1); var logIds = _logDbHandler.GetSysLogIdsByRoomId(555888556); logIds.ForEach(id => _logDbHandler.DeleteSystemLog(id)); bool ans = gameCenter.RemoveRoom(555888556); }