public void TestUpdate_Failure_ServerIsNotRunning() { m_mockServerInfoMgr.AddServerInfo(TEST_SERVER_TYPE, TEST_SERVER_NAME, TEST_SERVER_EXE_PATH, WORLD_ID, SERVER_ID); ServerInfo refServerInfo = m_mockServerInfoMgr.Find(TEST_SERVER_NAME); Assert.AreEqual(PROCESS_STATE.TERMINATED, refServerInfo.ProcessState); Assert.AreEqual(SERVABLE_STATE.INACTIVE, refServerInfo.ServableState); m_servableStateUpdater.Update(ServableStateUpdater.TIME_CHECK_DELAY); Assert.AreEqual(SERVABLE_STATE.INACTIVE, refServerInfo.ServableState); }
public void TestTerminateServer() { ServerInfo refServerInfo = m_mockServerInfoMgr.Find(TEST_SERVER_NAME); Assert.AreEqual(true, m_ServerController.StartServer(TEST_SERVER_NAME)); Assert.AreEqual(true, m_mockProcessSystem.CallStartProcess); Assert.AreEqual(false, m_mockProcessSystem.CallTerminateProcess); refServerInfo.SetProcessRunning(); Assert.AreEqual(true, m_ServerController.TerminateServer(TEST_SERVER_NAME)); Assert.AreEqual(PROCESS_STATE.TERMINATING, refServerInfo.ProcessState); Assert.AreEqual(true, m_mockProcessSystem.CallTerminateProcess); Assert.AreEqual(LogID.TERMINATING_SERVER, m_mockMonitoringLoggerMgr.m_nLatestLogID); }
public void SetUpTestProcessStateChecker() { m_mockServerInfoMgr = new MockServerInfoMgr(); m_mockServerInfoMgr.Init(new List <ServerInfo>()); m_testProcessSystem = new TestProcessSystem(); m_mockMonitoringLoggerMgr = new MockMonitoringLoggerMgr(); m_processStateChecker = new ProcessStateChecker(m_mockServerInfoMgr, m_testProcessSystem, m_mockMonitoringLoggerMgr); m_mockServerInfoMgr.AddServerInfo(TEST_SERVER_TYPE, TEST_SERVER_NAME, TEST_SERVER_EXE_PATH, WORLD_ID, SERVER_ID); m_refServerInfo = m_mockServerInfoMgr.Find(TEST_SERVER_NAME); }
public void TestRebuildServerListView_ModifyItem() { m_mockServerInfoMgr.AddServerInfo(TEST_SERVER_TYPE, TEST_SERVER_NAME, TEST_EXE_PATH, WORLD_ID1, SERVER_ID1); ServerInfo refServerInfo = m_mockServerInfoMgr.Find(TEST_SERVER_NAME); m_serverListViewUpdater.BuildServerListView(); Assert.AreEqual(1, m_lviewServerList.Items.Count); Assert.AreEqual(PROCESS_STATE.TERMINATED, refServerInfo.ProcessState); Assert.AreEqual(PROCESS_STATE.TERMINATED.ToString(), m_lviewServerList.Items[0].SubItems[1].Text); refServerInfo.SetProcessStarting(TEST_PROCESS_ID); refServerInfo.SetProcessRunning(); m_serverListViewUpdater.BuildServerListView(); Assert.AreEqual(PROCESS_STATE.RUNNING, refServerInfo.ProcessState); Assert.AreEqual(PROCESS_STATE.RUNNING.ToString(), m_lviewServerList.Items[0].SubItems[1].Text); Assert.AreEqual(false, m_lviewServerList.Items[0].Checked); refServerInfo.SetProcessRevivable(true); m_serverListViewUpdater.BuildServerListView(); Assert.AreEqual(true, m_lviewServerList.Items[0].Checked); }
public void TestReviveAllRevivableServer() { ServerInfo refServerInfo = m_mockServerInfoMgr.Find(TEST_SERVER_NAME); refServerInfo.SetProcessDied(); refServerInfo.SetProcessRevivable(true); Assert.AreEqual(false, m_mockProcessSystem.CallStartProcess); m_serverReviver.ReviveAllRevivableServer(); Assert.AreEqual(PROCESS_STATE.STARTING, refServerInfo.ProcessState); Assert.AreEqual(true, m_mockProcessSystem.CallStartProcess); }