예제 #1
0
        public async Task ExpireAsync_AfterSettingExpireAndWaiting_ItemDoesntExistInCache()
        {
            // Arrange
            var cacheValue = "Test";
            var expireIn   = new TimeSpan(0, 0, 2);

            await stringCache.SetAsync(new CacheItem <string>(CacheKey, cacheValue, TimeSpan.FromSeconds(5)));

            // Act
            await stringCache.KeyExpireAsync(CacheKey, expireIn);

            await Task.Delay(expireIn.Add(TimeSpan.FromSeconds(1)));


            // Assert
            Assert.False(await stringCache.ExistsAsync(CacheKey));
        }