public void DontContainsSqueezedOutTest() { LUCache <string, object> cache = new LUCache <string, object>(1); cache.Add("1", new object()); cache.Add("2", new object()); Assert.False(cache.Contains("1"), "Must not contain a discarded element"); Assert.True(cache.Contains("2"), "Must contain last added element"); }
public void ClearTest() { LUCache <string, object> cache = new LUCache <string, object>(1); cache.Add("1", new object()); Assert.True(cache.Contains("1"), "Must contain last added element"); cache.Clear(); Assert.False(cache.Contains("1"), "Cleared cache must not contains elements"); }
public async Task ParsePriceWithCacheNotEmptyTest() { MusikProduktiv musikProduktiv = new MusikProduktiv(); var cache = new LUCache <string, IDocument>(); decimal price = await musikProduktiv.ParsePrice(testItem, cache); Assert.True(cache.Contains(testItem.Url), "Must contain document"); price = await musikProduktiv.ParsePrice(testItem2, cache); Assert.True(price > 0, "Price can't be below zero."); }
public void LUCacheDefaultTest() { LUCache <string, object> cache = new LUCache <string, object>(); Assert.False(cache.Contains("Some key"), "Cache must be empty"); }