Пример #1
0
        public void SendSessionStartEventAsync_FirstSession_MessageHasSessionId()
        {
            RaygunRUMMessage sessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            Assert.AreEqual(1, sessionStartMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionStartMessage.EventData[0];

            Assert.IsNotNull(eventInfo.SessionId);
        }
Пример #2
0
        public void SendSessionTimingEventAsync_NoActiveSession_MessageHasNewSessionId()
        {
            RaygunRUMMessage sessionTimingMessage = _rumService.SendSessionTimingEventAsync(RaygunRUMEventTimingType.ViewLoaded, "page", 1000).Result;

            Assert.AreEqual(1, sessionTimingMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionTimingMessage.EventData[0];

            Assert.IsNotNull(eventInfo.SessionId);
        }
Пример #3
0
        public void SendSessionStartEventAsync_CustomUserInfo_MessageHasSpecifiedUserInfo()
        {
            _rumService.UserInfo = _customUserInfo;

            RaygunRUMMessage sessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            Assert.AreEqual(1, sessionStartMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionStartMessage.EventData[0];

            Assert.AreEqual(_customUserInfo, eventInfo.User);
        }
Пример #4
0
        public void SendSessionTimingEventAsync_CustomUserInfo_MessageHasSpecifiedUserInfo()
        {
            _rumService.UserInfo = _customUserInfo;

            RaygunRUMMessage sessionTimingMessage = _rumService.SendSessionTimingEventAsync(RaygunRUMEventTimingType.ViewLoaded, "page", 1000).Result;

            Assert.AreEqual(1, sessionTimingMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionTimingMessage.EventData[0];

            Assert.AreEqual(_customUserInfo, eventInfo.User);
        }
Пример #5
0
        public void SendSessionStartEventAsync_FirstSession_MessageHasCorrectState()
        {
            RaygunRUMMessage sessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            Assert.AreEqual(1, sessionStartMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionStartMessage.EventData[0];

            Assert.AreEqual(RaygunRUMEventType.SessionStart, eventInfo.Type);
            Assert.AreEqual(DefaultUserService.DefaultUser, eventInfo.User);
            Assert.AreEqual(EnvironmentService.PackageVersion, eventInfo.Version);
            Assert.IsNull(eventInfo.Data);
        }
Пример #6
0
        public void SendSessionTimingEventAsync_NoActiveSession_MessageHasCorrectState()
        {
            RaygunRUMMessage sessionTimingMessage = _rumService.SendSessionTimingEventAsync(RaygunRUMEventTimingType.ViewLoaded, "page", 1000).Result;

            Assert.AreEqual(1, sessionTimingMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionTimingMessage.EventData[0];

            Assert.AreEqual(RaygunRUMEventType.Timing, eventInfo.Type);
            Assert.AreEqual(DefaultUserService.DefaultUser, eventInfo.User);
            Assert.AreEqual(EnvironmentService.PackageVersion, eventInfo.Version);
            Assert.IsNotNull(eventInfo.Data);
        }
Пример #7
0
        public void SendSessionStartEventAsync_CustomApplicationVersion_MessageHasSpecifiedApplicationVersion()
        {
            string applicationVersion = "custom-version";

            _rumService.ApplicationVersion = applicationVersion;

            RaygunRUMMessage sessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            Assert.AreEqual(1, sessionStartMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionStartMessage.EventData[0];

            Assert.AreEqual(applicationVersion, eventInfo.Version);
        }
Пример #8
0
        public void SendSessionTimingEventAsync_CustomApplicationVersion_MessageHasSpecifiedApplicationVersion()
        {
            string applicationVersion = "custom-version";

            _rumService.ApplicationVersion = applicationVersion;

            RaygunRUMMessage sessionTimingMessage = _rumService.SendSessionTimingEventAsync(RaygunRUMEventTimingType.ViewLoaded, "page", 1000).Result;

            Assert.AreEqual(1, sessionTimingMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionTimingMessage.EventData[0];

            Assert.AreEqual(applicationVersion, eventInfo.Version);
        }
Пример #9
0
        public void SendSessionStartEventAsync_SecondSession_MessageHasDifferentSessionId()
        {
            RaygunRUMMessage firstSessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            RaygunRUMEventInfo eventInfo = firstSessionStartMessage.EventData[0];
            string             sessionId = eventInfo.SessionId;

            RaygunRUMMessage secondSessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            Assert.AreEqual(1, secondSessionStartMessage.EventData.Length);
            eventInfo = secondSessionStartMessage.EventData[0];
            Assert.IsNotNull(eventInfo.SessionId);
            Assert.AreNotEqual(sessionId, eventInfo.SessionId);
        }
Пример #10
0
        public void SendSessionEndEventAsync_ActiveSession_MessageHasSameSessionId()
        {
            RaygunRUMMessage sessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            RaygunRUMEventInfo eventInfo = sessionStartMessage.EventData[0];
            string             sessionId = eventInfo.SessionId;

            RaygunRUMMessage sessionEndMessage = _rumService.SendSessionEndEventAsync().Result;

            Assert.AreEqual(1, sessionEndMessage.EventData.Length);
            eventInfo = sessionEndMessage.EventData[0];
            Assert.IsNotNull(eventInfo.SessionId);
            Assert.AreEqual(sessionId, eventInfo.SessionId);
        }
Пример #11
0
        public void SendSessionTimingEventAsync_UserInfoChangedFromNullToCustomUserInfo_MessageHasSameSessionId()
        {
            RaygunRUMMessage sessionStartMessage = _rumService.SendSessionStartEventAsync().Result;

            RaygunRUMEventInfo eventInfo = sessionStartMessage.EventData[0];
            string             sessionId = eventInfo.SessionId;

            _rumService.UserInfo = _customUserInfo;

            RaygunRUMMessage sessionTimingMessage = _rumService.SendSessionTimingEventAsync(RaygunRUMEventTimingType.ViewLoaded, "page", 1000).Result;

            Assert.AreEqual(1, sessionTimingMessage.EventData.Length);
            eventInfo = sessionTimingMessage.EventData[0];
            Assert.AreEqual(sessionId, eventInfo.SessionId);
        }
Пример #12
0
        public void SendSessionTimingEventAsync_NoActiveSession_MessageDataHasGivenTypeAndNameAndDuration()
        {
            RaygunRUMEventTimingType type = RaygunRUMEventTimingType.ViewLoaded;
            string name     = "page";
            long   duration = 1000;

            RaygunRUMMessage sessionTimingMessage = _rumService.SendSessionTimingEventAsync(type, name, duration).Result;

            Assert.AreEqual(1, sessionTimingMessage.EventData.Length);
            RaygunRUMEventInfo eventInfo = sessionTimingMessage.EventData[0];

            RaygunRUMTimingData[] timingData = JsonConvert.DeserializeObject <RaygunRUMTimingData[]>(eventInfo.Data, HttpService.SERIALIZATION_SETTINGS);
            Assert.AreEqual(1, timingData.Length);
            Assert.AreEqual(type, timingData[0].Timing.Type);
            Assert.AreEqual(name, timingData[0].Name);
            Assert.AreEqual(duration, timingData[0].Timing.Duration);
        }