public void CacheUpdateWithPerformanceCountersEnabledDoesUpdateCounters()
        {
            CachingInstrumentationListener listener
                = new CachingInstrumentationListener(instanceName, true, false, false, formatter);

            CacheUpdatedEventArgs args = new CacheUpdatedEventArgs(10, 20);

            listener.CacheUpdated(null, args);

            Assert.AreEqual(20L, cacheTotalEntriesCounter.RawValue);
            Assert.AreEqual(10L, cacheUpdatedEntriesCounter.RawValue);
        }
        public void MultipleCacheUpdatesWithPerformanceCountersEnabledDoesUpdateCounters()
        {
            CachingInstrumentationListener listener
                = new CachingInstrumentationListener(instanceName, true, false, false, formatter);

            for (int i = 1; i <= 10; i++)
            {
                CacheUpdatedEventArgs args = new CacheUpdatedEventArgs(i, 10 + i);

                listener.CacheUpdated(null, args);
            }

            Assert.AreEqual(20L, cacheTotalEntriesCounter.RawValue);
            Assert.AreEqual(55L, cacheUpdatedEntriesCounter.RawValue);                  // 55 = 10 * (10+1) / 2
        }
 public void CacheUpdated(object sender, CacheUpdatedEventArgs args)
 {
     SaveEventArgs(args);
 }
Example #4
0
        public void OnCachedUpdated(object sender, CacheUpdatedEventArgs <List <KeyValuePair <string, SecurityQuotationViewModel> > > eventArgs)
        {
            List <SecurityQuotationViewModel> results = eventArgs.Entity.Select(x => x.Value).ToList();

            OnQuotesUpdated(new QuotesUpdatedEventArgs(results));
        }
        public void MultipleCacheUpdatesWithPerformanceCountersEnabledDoesUpdateCounters()
        {
            CachingInstrumentationListener listener
                = new CachingInstrumentationListener(instanceName, true, false, false, formatter);

            for (int i = 1; i <= 10; i++)
            {
                CacheUpdatedEventArgs args = new CacheUpdatedEventArgs(i, 10 + i);

                listener.CacheUpdated(null, args);
            }

            Assert.AreEqual(20L, cacheTotalEntriesCounter.RawValue);
            Assert.AreEqual(55L, cacheUpdatedEntriesCounter.RawValue);	// 55 = 10 * (10+1) / 2
        }
        public void CacheUpdateWithPerformanceCountersEnabledDoesUpdateCounters()
        {
            CachingInstrumentationListener listener
                = new CachingInstrumentationListener(instanceName, true, false, false, formatter);

            CacheUpdatedEventArgs args = new CacheUpdatedEventArgs(10, 20);

            listener.CacheUpdated(null, args);

            Assert.AreEqual(20L, cacheTotalEntriesCounter.RawValue);
            Assert.AreEqual(10L, cacheUpdatedEntriesCounter.RawValue);
        }