public void TestSecondObtainAfterRecyclingGetsRecycledEvent() { SettableCacheEvent firstEvent = SettableCacheEvent.Obtain(); firstEvent.Recycle(); SettableCacheEvent secondEvent = SettableCacheEvent.Obtain(); Assert.AreEqual(secondEvent.GetHashCode(), firstEvent.GetHashCode()); }
public void TestRecycleClearsAllFields() { SettableCacheEvent cacheEvent = SettableCacheEvent.Obtain(); cacheEvent.SetCacheKey(default(ICacheKey)); cacheEvent.SetCacheLimit(21); cacheEvent.SetCacheSize(12332445); cacheEvent.SetEvictionReason(EvictionReason.CACHE_MANAGER_TRIMMED); cacheEvent.SetException(new IOException()); cacheEvent.SetItemSize(1435); cacheEvent.SetResourceId("sddqrtyjf"); cacheEvent.Recycle(); Assert.IsNull(cacheEvent.CacheKey); Assert.AreEqual(cacheEvent.CacheLimit, 0); Assert.AreEqual(cacheEvent.CacheSize, 0); Assert.AreEqual(cacheEvent.EvictionReason, EvictionReason.NONE); Assert.IsNull(cacheEvent.Exception); Assert.AreEqual(cacheEvent.ItemSize, 0); Assert.IsNull(cacheEvent.ResourceId); }