22using System . Linq . Dynamic . Core . Util ;
33using System . Linq . Dynamic . Core . Util . Cache ;
44using System . Linq . Expressions ;
5+ using System . Threading ;
56using FluentAssertions ;
67using Xunit ;
78
@@ -114,7 +115,7 @@ public void SlidingCache_TestAutoExpire()
114115
115116 // Since the cache cleanup is triggered by a Task and not on the same thread,
116117 // give it a moment for the cleanup to happen
117- Threading . Thread . Sleep ( 10 ) ;
118+ Sleep ( ) ;
118119
119120 // Ensure one item is in the cache
120121 cache . Count . Should ( ) . Be ( 0 , $ "Expected 0 items in the cache, had { cache . Count } ") ;
@@ -158,7 +159,7 @@ public void SlidingCache_TestMinNumberBeforeTests()
158159
159160 // Since the cache cleanup is triggered by a Task and not on the same thread,
160161 // give it a moment for the cleanup to happen
161- Threading . Thread . Sleep ( 10 ) ;
162+ Sleep ( ) ;
162163
163164 // Ensure one item is in the cache
164165 cache . Count . Should ( ) . Be ( 1 , $ "Expected 1 items in the cache, only had { cache . Count } ") ;
@@ -168,9 +169,14 @@ public void SlidingCache_TestMinNumberBeforeTests()
168169
169170 // Since the cache cleanup is triggered by a Task and not on the same thread,
170171 // give it a moment for the cleanup to happen
171- Threading . Thread . Sleep ( 10 ) ;
172+ Sleep ( ) ;
172173
173174 // Ensure one item is in the cache
174175 cache . Count . Should ( ) . Be ( 1 , $ "Expected 1 items in the cache, had { cache . Count } ") ;
175176 }
177+
178+ private static void Sleep ( )
179+ {
180+ Thread . Sleep ( 1000 ) ;
181+ }
176182}
0 commit comments