public void GetCacheItem_Miss() { // when _cache.GetCacheItem <object>("key1"); // then var ratio = _cache.Statistics.SafeGetValue <decimal?>(CacheStatisticsKeys.CacheHitRatio); Assert.That(ratio, Is.EqualTo(0m)); }
public void GetCacheItemShouldRecordTime() { //when DateTimeOffset expectedTime = DateTimeOffset.Now; _cache.GetCacheItem <object>("key1"); //then Thread.Sleep(60); AssertAccessTime(_cache.Statistics, CacheStatisticsKeys.LastUse, expectedTime); }
public void GetCacheItemShouldNotRecordTime() { //when _cache.GetCacheItem <object>("key1"); //then AssertNoAccessTime(_cache.Statistics, CacheStatisticsKeys.LastWrite); }
public void GetCacheItemShouldRecordReadTime() { // given _cache.AddOrUpdate("key1", new object()); Thread.Sleep(60); // when _cache.GetCacheItem <object>("key1"); DateTimeOffset expectedTime = DateTimeOffset.Now; // then CacheItemAccessInfo itemStats = _cache.Statistics.SafeGetValue <IDictionary <string, CacheItemAccessInfo> >(CacheStatisticsKeys.ItemAccess) ["key1"]; AssertAccessTime(itemStats.LastRead, expectedTime); }