@@ -78,13 +78,13 @@ public async Task Should_execute_delegate_and_put_value_in_cache_if_cache_does_n
7878 IAsyncCacheProvider stubCacheProvider = new StubCacheProvider ( ) ;
7979 var cache = Policy . CacheAsync ( stubCacheProvider , TimeSpan . MaxValue ) ;
8080
81- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
81+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
8282 cacheHit1 . Should ( ) . BeFalse ( ) ;
8383 fromCache1 . Should ( ) . BeNull ( ) ;
8484
8585 ( await cache . ExecuteAsync ( async _ => { await TaskHelper . EmptyTask ; return valueToReturn ; } , new Context ( operationKey ) ) ) . Should ( ) . Be ( valueToReturn ) ;
8686
87- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
87+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
8888 cacheHit2 . Should ( ) . BeTrue ( ) ;
8989 fromCache2 . Should ( ) . Be ( valueToReturn ) ;
9090 }
@@ -99,7 +99,7 @@ public async Task Should_execute_delegate_and_put_value_in_cache_but_when_it_exp
9999 TimeSpan ttl = TimeSpan . FromMinutes ( 30 ) ;
100100 var cache = Policy . CacheAsync ( stubCacheProvider , ttl ) ;
101101
102- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
102+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
103103 cacheHit1 . Should ( ) . BeFalse ( ) ;
104104 fromCache1 . Should ( ) . BeNull ( ) ;
105105
@@ -117,7 +117,7 @@ public async Task Should_execute_delegate_and_put_value_in_cache_but_when_it_exp
117117 // First execution should execute delegate and put result in the cache.
118118 ( await cache . ExecuteAsync ( func , new Context ( operationKey ) ) ) . Should ( ) . Be ( valueToReturn ) ;
119119 delegateInvocations . Should ( ) . Be ( 1 ) ;
120- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
120+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
121121 cacheHit2 . Should ( ) . BeTrue ( ) ;
122122 fromCache2 . Should ( ) . Be ( valueToReturn ) ;
123123
@@ -144,13 +144,13 @@ public async Task Should_execute_delegate_but_not_put_value_in_cache_if_cache_do
144144 IAsyncCacheProvider stubCacheProvider = new StubCacheProvider ( ) ;
145145 var cache = Policy . CacheAsync ( stubCacheProvider , TimeSpan . Zero ) ;
146146
147- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
147+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
148148 cacheHit1 . Should ( ) . BeFalse ( ) ;
149149 fromCache1 . Should ( ) . BeNull ( ) ;
150150
151151 ( await cache . ExecuteAsync ( async _ => { await TaskHelper . EmptyTask ; return valueToReturn ; } , new Context ( operationKey ) ) ) . Should ( ) . Be ( valueToReturn ) ;
152152
153- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
153+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
154154 cacheHit2 . Should ( ) . BeFalse ( ) ;
155155 fromCache2 . Should ( ) . BeNull ( ) ;
156156 }
@@ -240,13 +240,13 @@ public async Task Should_execute_delegate_and_put_value_in_cache_if_cache_does_n
240240 IAsyncCacheProvider stubCacheProvider = new StubCacheProvider ( ) ;
241241 var cache = Policy . CacheAsync ( stubCacheProvider , TimeSpan . MaxValue ) ;
242242
243- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
243+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
244244 cacheHit1 . Should ( ) . BeFalse ( ) ;
245245 fromCache1 . Should ( ) . BeNull ( ) ;
246246
247247 ( await cache . ExecuteAsync ( async _ => { await TaskHelper . EmptyTask ; return valueToReturn ; } , new Context ( operationKey ) ) ) . Should ( ) . Be ( valueToReturn ) ;
248248
249- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
249+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
250250 cacheHit2 . Should ( ) . BeTrue ( ) ;
251251 fromCache2 . Should ( ) . Be ( valueToReturn ) ;
252252 }
@@ -284,13 +284,13 @@ public async Task Should_execute_delegate_and_put_value_in_cache_if_cache_does_n
284284 IAsyncCacheProvider stubCacheProvider = new StubCacheProvider ( ) ;
285285 var cache = Policy . CacheAsync ( stubCacheProvider , TimeSpan . MaxValue ) ;
286286
287- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
287+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
288288 cacheHit1 . Should ( ) . BeFalse ( ) ;
289289 fromCache1 . Should ( ) . BeNull ( ) ;
290290
291291 ( await cache . ExecuteAsync ( async _ => { await TaskHelper . EmptyTask ; return valueToReturn ; } , new Context ( operationKey ) ) ) . Should ( ) . Be ( valueToReturn ) ;
292292
293- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
293+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
294294 cacheHit2 . Should ( ) . BeTrue ( ) ;
295295 fromCache2 . Should ( ) . Be ( valueToReturn ) ;
296296 }
@@ -502,7 +502,7 @@ public async Task Should_honour_cancellation_during_delegate_execution_and_not_p
502502 await cache . Awaiting ( policy => policy . ExecuteAsync ( func , new Context ( operationKey ) , tokenSource . Token ) )
503503 . Should ( ) . ThrowAsync < OperationCanceledException > ( ) ;
504504
505- ( bool cacheHit , object fromCache ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
505+ ( bool cacheHit , object ? fromCache ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
506506 cacheHit . Should ( ) . BeFalse ( ) ;
507507 fromCache . Should ( ) . BeNull ( ) ;
508508 }
@@ -562,7 +562,7 @@ public async Task Should_call_onError_delegate_if_cache_put_errors()
562562
563563 var cache = Policy . CacheAsync ( stubCacheProvider , TimeSpan . MaxValue , onError ) ;
564564
565- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
565+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
566566 cacheHit1 . Should ( ) . BeFalse ( ) ;
567567 fromCache1 . Should ( ) . BeNull ( ) ;
568568
@@ -572,7 +572,7 @@ public async Task Should_call_onError_delegate_if_cache_put_errors()
572572 exceptionFromCacheProvider . Should ( ) . Be ( ex ) ;
573573
574574 // failed to put it in the cache
575- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
575+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
576576 cacheHit2 . Should ( ) . BeFalse ( ) ;
577577 fromCache2 . Should ( ) . BeNull ( ) ;
578578 }
@@ -632,13 +632,13 @@ public async Task Should_execute_oncachemiss_and_oncacheput_if_cache_does_not_ho
632632 IAsyncCacheProvider stubCacheProvider = new StubCacheProvider ( ) ;
633633 var cache = Policy . CacheAsync ( stubCacheProvider , new RelativeTtl ( TimeSpan . MaxValue ) , DefaultCacheKeyStrategy . Instance , emptyDelegate , onCacheMiss , onCachePut , noErrorHandling , noErrorHandling ) ;
634634
635- ( bool cacheHit1 , object fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
635+ ( bool cacheHit1 , object ? fromCache1 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
636636 cacheHit1 . Should ( ) . BeFalse ( ) ;
637637 fromCache1 . Should ( ) . BeNull ( ) ;
638638
639639 ( await cache . ExecuteAsync ( async _ => { await TaskHelper . EmptyTask ; return valueToReturn ; } , contextToExecute ) ) . Should ( ) . Be ( valueToReturn ) ;
640640
641- ( bool cacheHit2 , object fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
641+ ( bool cacheHit2 , object ? fromCache2 ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
642642 cacheHit2 . Should ( ) . BeTrue ( ) ;
643643 fromCache2 . Should ( ) . Be ( valueToReturn ) ;
644644
@@ -669,7 +669,7 @@ public async Task Should_execute_oncachemiss_but_not_oncacheput_if_cache_does_no
669669 IAsyncCacheProvider stubCacheProvider = new StubCacheProvider ( ) ;
670670 var cache = Policy . CacheAsync ( stubCacheProvider , new RelativeTtl ( TimeSpan . Zero ) , DefaultCacheKeyStrategy . Instance , emptyDelegate , onCacheMiss , onCachePut , noErrorHandling , noErrorHandling ) ;
671671
672- ( bool cacheHit , object fromCache ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
672+ ( bool cacheHit , object ? fromCache ) = await stubCacheProvider . TryGetAsync ( operationKey , CancellationToken . None , false ) ;
673673 cacheHit . Should ( ) . BeFalse ( ) ;
674674 fromCache . Should ( ) . BeNull ( ) ;
675675
0 commit comments