File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/Polly.Caching.MemoryCache.SharedSpecs Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -131,14 +131,23 @@ public void Put_should_put_item_using_passed_nonsliding_ttl()
131131 Ttl ttl = new Ttl ( shimTimeSpan , false ) ;
132132 provider . Put ( key , value , ttl ) ;
133133
134- Thread . Sleep ( shimTimeSpan + shimTimeSpan ) ;
135-
134+ // Initially (before ttl expires), should be able to get value from cache.
136135#if PORTABLE
137136 object got ;
138137 memoryCache . TryGetValue ( key , out got ) ;
139138#else
140139 object got = memoryCache [ key ] ;
141140#endif
141+ got . Should ( ) . BeSameAs ( value ) ;
142+
143+ // Wait until the TTL on the cache item should have expired.
144+ Thread . Sleep ( shimTimeSpan + shimTimeSpan ) ;
145+
146+ #if PORTABLE
147+ memoryCache . TryGetValue ( key , out got ) ;
148+ #else
149+ got = memoryCache [ key ] ;
150+ #endif
142151
143152 got . Should ( ) . NotBeSameAs ( value ) ;
144153 got . Should ( ) . BeNull ( ) ;
You can’t perform that action at this time.
0 commit comments