From 21b1436b1c66a64ca6906165ff3b4f022bbfa6ed Mon Sep 17 00:00:00 2001 From: Alastair Crabtree Date: Sat, 19 Sep 2020 20:16:20 +0100 Subject: [PATCH] tests: refactor tests RegisterPostEvictionCallback --- LazyCache.UnitTests/CachingServiceMemoryCacheProviderTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LazyCache.UnitTests/CachingServiceMemoryCacheProviderTests.cs b/LazyCache.UnitTests/CachingServiceMemoryCacheProviderTests.cs index 33c8302..5ce5090 100644 --- a/LazyCache.UnitTests/CachingServiceMemoryCacheProviderTests.cs +++ b/LazyCache.UnitTests/CachingServiceMemoryCacheProviderTests.cs @@ -834,7 +834,7 @@ public void GetOrAddWithImmediateExpirationAndCallbackInTheDelegateDoesExpireIte [Test] public async Task GetOrAddAsyncWithImmediateExpirationAndCallbackInTheDelegateDoesExpireItemsAndFireTheCallback() { - var millisecondsCacheDuration = 100; + var millisecondsCacheDuration = 1000; var callbackHasFired = false; var validResult = await sut.GetOrAddAsync( TestKey, @@ -845,7 +845,7 @@ public async Task GetOrAddAsyncWithImmediateExpirationAndCallbackInTheDelegateDo .WithImmediateAbsoluteExpiration(TimeSpan.FromMilliseconds(millisecondsCacheDuration)) .RegisterPostEvictionCallback((key, value, reason, state) => callbackHasFired = true)); // trigger expiry - Thread.Sleep(TimeSpan.FromMilliseconds(millisecondsCacheDuration + 50)); + Thread.Sleep(TimeSpan.FromMilliseconds(millisecondsCacheDuration + 1000)); Assert.That(validResult, Is.Not.Null); Assert.That(callbackHasFired, Is.True);