public void ExpiredCacheItemIsRemoved() { // --- Arrange LocalizedResourceManager.Reset(TimeSpan.FromMilliseconds(100)); // --- Act var cacheHit1 = LocalizedResourceManager.IsCached("hu-hu", "Cat1"); LocalizedResourceManager.GetResourceByLocale("hu-hu", "Cat1", "1"); var cacheHit2 = LocalizedResourceManager.IsCached("hu-hu", "Cat1"); Thread.Sleep(200); var cacheHit3 = LocalizedResourceManager.IsCached("hu-hu", "Cat1"); var resource = LocalizedResourceManager.GetResourceByLocale("hu-hu", "Cat1", "1"); // --- Assert resource.ShouldEqual("Cat1Value1-hu-hu"); cacheHit1.ShouldBeFalse(); cacheHit2.ShouldBeTrue(); cacheHit3.ShouldBeFalse(); }
public void Initialize() { LocalizedResourceManager.Reset(TimeSpan.FromSeconds(5)); }