Example #1
0
        public void EventDataPlayerSessionCollection_GetSessionIndexById_NullCase()
        {
            EventDataPlayerSessionCollection edpsc = new EventDataPlayerSessionCollection((DiagnosticEvent x) => true);

            edpsc.AddSession("Test session", 0);
            edpsc.AddSession("Test session 2", 1);

            Assert.AreEqual(-1, edpsc.GetSessionIndexById(10000000), "Incorrect value returned, GetSessionIndexById should return -1 when the queried id does not exist.");
        }
Example #2
0
        public void EventDataPlayerSessionCollection_GetSessionIndexById_SimpleCase()
        {
            EventDataPlayerSessionCollection edpsc = new EventDataPlayerSessionCollection((DiagnosticEvent x) => true);

            edpsc.AddSession("Test session", 0);
            edpsc.AddSession("Test session 2", 1);

            Assert.AreEqual(1, edpsc.GetSessionIndexById(1), "Session index not properly returned. ");
        }
Example #3
0
        void OnPlayerConnection(int id)
        {
            if (m_EventData == null)
            {
                m_EventData = new EventDataPlayerSessionCollection(OnRecordEvent);
            }
            m_EventData.GetPlayerSession(id, true).IsActive = true;
            int connectedSessionIndex = m_EventData.GetSessionIndexById(id);

            m_PlayerSessionIndex = connectedSessionIndex != -1 ? connectedSessionIndex : 0;
        }
Example #4
0
        public void EventDataPlayerSessionCollection_TestPlayerConnection()
        {
            EventDataPlayerSessionCollection edpsc = new EventDataPlayerSessionCollection((DiagnosticEvent x) => true);

            edpsc.AddSession("Default", 0);
            edpsc.GetPlayerSession(1000, true).IsActive = true;
            Assert.AreEqual(2, edpsc.GetSessionCount(), "Session not properly added. ");

            int connectedSessionIndex = edpsc.GetSessionIndexById(1000);

            Assert.AreEqual(1, connectedSessionIndex, "Session index not properly set. ");
        }