public void Clear() { var cache = new FileLruCache <Item>(2, x => new Item(x)); var arg1 = Path.GetTempFileName(); var arg2 = Path.GetTempFileName(); var result1 = cache.Get(arg1); var result2 = cache.Get(arg2); cache.Clear(); var result12 = cache.Get(arg1); var result22 = cache.Get(arg2); Assert.NotSame(result1, result12); Assert.NotSame(result2, result22); }
public void ClearDisposable() { var cache = new FileLruCache <DisposableItem>(2, x => new DisposableItem(x)); var arg1 = Path.GetTempFileName(); var arg2 = Path.GetTempFileName(); var result1 = cache.Get(arg1); var result2 = cache.Get(arg2); cache.Clear(); var result12 = cache.Get(arg1); var result22 = cache.Get(arg2); Assert.True(result1.Disposed); Assert.True(result2.Disposed); Assert.NotSame(result1, result12); Assert.NotSame(result2, result22); }