Esempio n. 1
0
        public void HandleEnqueuingStartSessionLog()
        {
            _sessionTracker.Pause();
            var sessionLog = new StartSessionLog();
            var eventArgs  = new EnqueuingLogEventArgs(sessionLog);

            _mockChannelGroup.Raise(group => group.EnqueuingLog += null, null, eventArgs);

            _mockChannel.Verify(channel => channel.EnqueueAsync(It.IsAny <StartSessionLog>()), Times.Never());
        }
Esempio n. 2
0
        public void TestInstanceConstruction()
        {
            var mockDevice = new Mock <Device>();

            StartSessionLog emptyLog = new StartSessionLog();
            StartSessionLog log      = new StartSessionLog(mockDevice.Object, Timestamp);

            Assert.IsNotNull(emptyLog);
            Assert.IsNotNull(log);
        }
Esempio n. 3
0
        private void SendStartSessionIfNeeded()
        {
            var now = TimeHelper.CurrentTimeInMilliseconds();

            if (SessionContext.SessionId != null && !HasSessionTimedOut(now))
            {
                return;
            }

            SessionContext.SessionId = Guid.NewGuid();
            _lastQueuedLogTime       = TimeHelper.CurrentTimeInMilliseconds();
            var startSessionLog = new StartSessionLog {
                Sid = SessionContext.SessionId
            };

            _channel.EnqueueAsync(startSessionLog).ConfigureAwait(false);
        }
        private void SendStartSessionIfNeeded()
        {
            var now = TimeHelper.CurrentTimeInMilliseconds();

            if (_sid != Guid.Empty && !HasSessionTimedOut(now))
            {
                return;
            }
            _sid = Guid.NewGuid();
#pragma warning disable CS0612 // Type or member is obsolete
            AppCenter.TestAndSetCorrelationId(Guid.Empty, ref _sid);
#pragma warning restore CS0612 // Type or member is obsolete
            _lastQueuedLogTime = TimeHelper.CurrentTimeInMilliseconds();
            var startSessionLog = new StartSessionLog {
                Sid = _sid
            };
            _channel.EnqueueAsync(startSessionLog);
        }
Esempio n. 5
0
        private void SendStartSessionIfNeeded()
        {
            var now = TimeHelper.CurrentTimeInMilliseconds();

            if (_sid != null && !HasSessionTimedOut(now))
            {
                return;
            }

            if (_sessions.Count == StorageMaxSessions)
            {
                _sessions.Remove(_sessions.Keys.Min());
            }
            _sid = Guid.NewGuid();
            _sessions.Add(now, _sid.Value);
            _applicationSettings[StorageKey] = SessionsAsString();
            var startSessionLog = new StartSessionLog {
                Sid = _sid
            };

            _channel.Enqueue(startSessionLog);
        }
        private void SendStartSessionIfNeeded()
        {
            var now = TimeHelper.CurrentTimeInMilliseconds();

            if (_sid != Guid.Empty && !HasSessionTimedOut(now))
            {
                return;
            }
            if (_sessions.Count == StorageMaxSessions)
            {
                _sessions.Remove(_sessions.Keys.Min());
            }
            _sid = Guid.NewGuid();
#pragma warning disable CS0612 // Type or member is obsolete
            MobileCenter.TestAndSetCorrelationId(Guid.Empty, ref _sid);
#pragma warning restore CS0612 // Type or member is obsolete
            _sessions.Add(now, _sid);
            _applicationSettings.SetValue(StorageKey, SessionsAsString());
            _lastQueuedLogTime = TimeHelper.CurrentTimeInMilliseconds();
            var startSessionLog = new StartSessionLog {
                Sid = _sid
            };
            _channel.EnqueueAsync(startSessionLog);
        }