public void TestUpdate_Machine2()
        {
            AddTestMachineInfo2(m_machineInfoMgr);
            Assert.AreEqual(2, m_machineInfoMgr.MachineInfoCount);

            m_refMachineInfo1.SetRequestConnect(TEST_MACHINE_SESSION_ID1);
            m_refMachineInfo1.SetConnected();

            m_refMachineInfo2.SetRequestConnect(TEST_MACHINE_SESSION_ID2);
            m_refMachineInfo2.SetConnected();

            ServerInfoMgr refServerInfoMgr = null;

            refServerInfoMgr = m_refMachineInfo1.ServerInfoMgr;
            refServerInfoMgr.AddServerInfo(ref m_ServerListNode1);
            Assert.AreEqual(1, refServerInfoMgr.ServerInfoCount);

            refServerInfoMgr = m_refMachineInfo2.ServerInfoMgr;
            refServerInfoMgr.AddServerInfo(ref m_ServerListNode2);
            Assert.AreEqual(1, refServerInfoMgr.ServerInfoCount);

            m_serverInfoRequester.Update(DELAY_TO_REQUEST);

            Assert.AreEqual(2, m_testCommandSender.m_nPostCount);
        }
예제 #2
0
        public void TestGetMachinePlayerCount_NoMasterServer()
        {
            AddTestMachineInfo();

            int nPlayerCount = m_machineInfoMgr.GetMachinePlayerCount(TEST_MACHINE_NAME1);

            Assert.AreEqual(0, nPlayerCount);

            ServerInfoMgr serverInfoMgr = m_machineInfoMgr.GetServerInfoMgr(TEST_MACHINE_NAME1);

            TRANS_SERVERLISTNODE serverListNode1 = new TRANS_SERVERLISTNODE();

            serverListNode1.strServerName = TEST_SERVER_NAME1;
            serverListNode1.nWorldID      = 5000;
            serverListNode1.nServerID     = 1;
            serverListNode1.nServerType   = (byte)SERVER_TYPE.SERVER_GAME;

            TRANS_SERVERLISTNODE serverListNode2 = new TRANS_SERVERLISTNODE();

            serverListNode2.strServerName = TEST_SERVER_NAME2;
            serverListNode2.nWorldID      = 5000;
            serverListNode2.nServerID     = 2;
            serverListNode2.nServerType   = (byte)SERVER_TYPE.SERVER_GAME;

            serverInfoMgr.AddServerInfo(ref serverListNode1);
            serverInfoMgr.AddServerInfo(ref serverListNode2);

            serverInfoMgr.SetServerCurServerPlayerCount(TEST_SERVER_NAME1, 1);
            serverInfoMgr.SetServerCurServerPlayerCount(TEST_SERVER_NAME2, 1);

            nPlayerCount = m_machineInfoMgr.GetMachinePlayerCount(TEST_MACHINE_NAME1);
            Assert.AreEqual(2, nPlayerCount);
        }
예제 #3
0
        public void TestAddServerInfo()
        {
            Assert.AreEqual(0, m_serverInfoMgr.ServerInfoCount);

            m_serverInfoMgr.AddServerInfo(ref m_ServerListNode1);

            Assert.AreEqual(1, m_serverInfoMgr.ServerInfoCount);
        }
예제 #4
0
        public void TestAddServerInfo()
        {
            m_serverInfoMgr.AddServerInfo(TEST_SERVER_TYPE, TEST_SERVER_NAME1, TEST_SERVER_EXE_PATH1, WORLD_ID1, SERVER_ID1);
            Assert.AreEqual(1, m_serverInfoMgr.ServerInfoCount);

            m_serverInfoMgr.AddServerInfo(TEST_SERVER_TYPE, TEST_SERVER_NAME2, TEST_SERVER_EXE_PATH2, WORLD_ID2, SERVER_ID2);
            Assert.AreEqual(2, m_serverInfoMgr.ServerInfoCount);
        }