public void Get_gets_from_wrapped_using_combined_cache_key(IGetsRegionBasedCacheKeys keyProvider, string originalKey, string originalRegion, string newKey, object value) { Mock.Get(keyProvider).Setup(x => x.GetCacheKey(originalKey, originalRegion)).Returns(newKey); var memoryCache = new MemoryCache("Test"); var sut = new NamespacedRegionCacheDecorator(memoryCache, keyProvider); memoryCache[newKey] = value; Assert.That(() => sut.Get(originalKey, originalRegion), Is.SameAs(value)); }
public void Set_stores_in_wrapped_using_combined_cache_key(IGetsRegionBasedCacheKeys keyProvider, string originalKey, string originalRegion, string newKey, object value) { Mock.Get(keyProvider).Setup(x => x.GetCacheKey(originalKey, originalRegion)).Returns(newKey); var memoryCache = new MemoryCache("Test"); var sut = new NamespacedRegionCacheDecorator(memoryCache, keyProvider); sut.Set(originalKey, value, new CacheItemPolicy(), originalRegion); Assert.That(() => memoryCache[newKey], Is.SameAs(value)); }