public void GetCacheStore_should_throw_exception_if_store_type_not_found() { var provider = new DefaultCacheStoreProvider(); Assert.Throws <KeyNotFoundException>(() => provider.GetCacheStore(typeof(DefaultCacheStoreProviderTests))); Assert.IsNotNull(provider.GetCacheStore(typeof(ICacheStore))); }
public void GetCacheStore_should_return_null_if_storeId_less_than_0_or_not_found() { var provider = new DefaultCacheStoreProvider(); Assert.IsNull(provider.GetCacheStore(-1)); Assert.IsNull(provider.GetCacheStore(1)); Assert.IsNotNull(provider.GetCacheStore(0)); }
public void RegisterStore_should_register_both_type_and_id() { var store = Substitute.For <ICacheStore>(); store.StoreId.Returns(10); var provider = new DefaultCacheStoreProvider(); Assert.Throws <ArgumentNullException>(() => provider.RegisterStore(null)); provider.RegisterStore(store); Assert.IsNotNull(provider.GetCacheStore(10)); Assert.IsNotNull(provider.GetCacheStore(store.GetType())); }
public void Dispose_should_clear_all_cached_stores() { var provider = new DefaultCacheStoreProvider(); provider.Dispose(); Assert.IsNull(provider.GetCacheStore(0)); Assert.IsNull(provider.GetAsyncCacheStore(0)); }