public void RemoveShouldRecordTime() { //given _cache.AddOrUpdate("key1", new object()); Thread.Sleep(60); //when _cache.Remove("key1"); //then DateTimeOffset expectedTime = DateTimeOffset.Now; AssertAccessTime(_cache.Statistics, CacheStatisticsKeys.LastWrite, expectedTime); }
public void RemoveShouldRecordTime() { //when DateTimeOffset expectedTime = DateTimeOffset.Now; _cache.Remove("key1"); //then Thread.Sleep(60); AssertAccessTime(_cache.Statistics, CacheStatisticsKeys.LastUse, expectedTime); }
public void Remove_ShouldNotInfluenceResult() { // given _cache.AddOrUpdate("key1", new object()); _cache.GetCacheItem <object>("key1"); _cache.GetCacheItem <object>("key2"); // when _cache.Remove("key1"); // then var ratio = _cache.Statistics.SafeGetValue <decimal?>(CacheStatisticsKeys.CacheHitRatio); Assert.That(ratio, Is.EqualTo(0.5m)); }
public void RemoveShouldRemoveItemStats() { // given _cache.AddOrUpdate("key1", new object()); Assert.IsNotEmpty( _cache.Statistics.SafeGetValue <IDictionary <string, CacheItemAccessInfo> >(CacheStatisticsKeys.ItemAccess), "checking assumptions"); // when _cache.Remove("key1"); // then var stats = _cache.Statistics.SafeGetValue <IDictionary <string, CacheItemAccessInfo> >(CacheStatisticsKeys.ItemAccess); Assert.That(stats, Is.Empty); }