@@ -17,7 +17,7 @@ public class AsyncMemoryCacheTests
1717 public async Task FactoryIsInvoked_DoesNotBlock ( )
1818 {
1919 var configuration = CreateConfiguration ( ) ;
20- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( configuration ) ;
20+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( configuration ) ;
2121
2222 var semaphore = new SemaphoreSlim ( 0 , 1 ) ;
2323
@@ -39,7 +39,7 @@ public async Task FactoryIsInvoked_DoesNotBlock()
3939 public async Task GetOrCreateObjectIsReturnedInCacheEntity ( )
4040 {
4141 var configuration = CreateConfiguration ( ) ;
42- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( configuration ) ;
42+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( configuration ) ;
4343
4444 var objectToCache = Substitute . For < IAsyncDisposable > ( ) ;
4545 var factory = ( ) => Task . FromResult ( objectToCache ) ;
@@ -54,7 +54,7 @@ public async Task GetOrCreateObjectIsReturnedInCacheEntity()
5454 public async Task GetOrCreateObjectIsReturnedFromIndexer ( )
5555 {
5656 var configuration = CreateConfiguration ( ) ;
57- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( configuration ) ;
57+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( configuration ) ;
5858
5959 var objectToCache = Substitute . For < IAsyncDisposable > ( ) ;
6060 var factory = ( ) => Task . FromResult ( objectToCache ) ;
@@ -70,7 +70,7 @@ public async Task GetOrCreateObjectIsReturnedFromIndexer()
7070 public void GetOrCreateCalledTwice_ReturnsPreviousCacheEntity ( )
7171 {
7272 var configuration = CreateConfiguration ( ) ;
73- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( configuration ) ;
73+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( configuration ) ;
7474
7575 var factory = ( ) => Task . FromResult ( Substitute . For < IAsyncDisposable > ( ) ) ;
7676
@@ -90,7 +90,7 @@ public void EvictionBehaviorIsStarted()
9090 EvictionBehavior = evictionBehavior
9191 } ;
9292
93- _ = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
93+ _ = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
9494
9595 evictionBehavior
9696 . Received ( 1 )
@@ -103,7 +103,7 @@ public void EvictionBehaviorIsStarted()
103103 public void ContainsKey ( )
104104 {
105105 var configuration = CreateConfiguration ( ) ;
106- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( configuration ) ;
106+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( configuration ) ;
107107
108108 var factory = ( ) => Task . FromResult ( Substitute . For < IAsyncDisposable > ( ) ) ;
109109
@@ -131,7 +131,7 @@ public async Task DisposeAsync()
131131 }
132132 } ;
133133
134- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
134+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
135135
136136 await target . DisposeAsync ( ) ;
137137
@@ -153,7 +153,7 @@ public void NewCacheEntityReferenceReturnedOnEveryCall()
153153 CacheBackingStore = new Dictionary < string , CacheEntity < string , IAsyncDisposable > > ( )
154154 } ;
155155
156- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
156+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
157157
158158 const string key = "test" ;
159159 var cacheEntityReference1 = target . GetOrCreate ( key , ( ) => Task . FromResult ( cacheObject ) ) ;
@@ -183,7 +183,7 @@ public void NewCacheEntityIsCreatedIfUsesIsBelowZero()
183183 CacheBackingStore = new Dictionary < string , CacheEntity < string , IAsyncDisposable > > ( )
184184 } ;
185185
186- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
186+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
187187
188188 const string key = "test" ;
189189 var cacheEntityReference1 = target . GetOrCreate ( key , ( ) => Task . FromResult ( cacheObject ) ) ;
@@ -210,7 +210,7 @@ public void TryGetValue_ReturnsFalseIfItemDoesNotExist()
210210 CacheBackingStore = new Dictionary < string , CacheEntity < string , IAsyncDisposable > > ( )
211211 } ;
212212
213- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
213+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
214214
215215 var exists = target . TryGetValue ( "doesNotExist" , out var cacheEntityReference ) ;
216216
@@ -235,7 +235,7 @@ public void TryGetValue_ReturnsFalseWhenBeingDisposed()
235235
236236 config . CacheBackingStore [ key ] . References = - 1 ;
237237
238- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
238+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
239239
240240 var exists = target . TryGetValue ( key , out var cacheEntityReference ) ;
241241
@@ -259,7 +259,7 @@ public void TryGetValue_ReturnsTrueIfItemExistsAndIncrementsReferenceCount()
259259 }
260260 } ;
261261
262- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
262+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
263263
264264 var exists = target . TryGetValue ( key , out var cacheEntityReference ) ;
265265
@@ -287,7 +287,7 @@ public void TryGetValue_ExistingItemWithExpirationStrategy_CallsCacheEntityAcces
287287 }
288288 } ;
289289
290- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
290+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
291291
292292 _ = target . TryGetValue ( key , out var cacheEntityReference ) ;
293293
@@ -313,7 +313,7 @@ public void Indexer_ExistingItemWithExpirationStrategy_CallsCacheEntityAccessed(
313313 }
314314 } ;
315315
316- var target = new AsyncMemoryCache < string , IAsyncDisposable > ( config ) ;
316+ var target = AsyncMemoryCache < string , IAsyncDisposable > . Create ( config ) ;
317317
318318 _ = target [ key ] ;
319319
0 commit comments