public void TestStoreSamplesDataInMemory()
        {
            var mockList = LoadMockSampleData();

            _store.Store(mockList);

            Assert.AreEqual(_store.GetStoredSamplesCache().Count, 2);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// intialize timer fires every one second to collect samples data and store it in
        /// memory cache then discard all samples data older than 60 seconds.
        /// </summary>
        internal void InitTimer()
        {
            TimerCallback tmCallback = state =>
            {
                var samples = _unitOfWork.ReadSampleData();
                _samplesStore.Store(samples);
                _samplesStore.DiscardOldSamples();
            };

            _timer = new Timer(tmCallback, "ServerWorker", 0, 1000);
        }