public static void TestUpdateCache() { CacheKey cacheKey = new CacheKey("a key").Subkey("a subkey").Subkey("another subkey"); int count = 0; ItemCache cache = new ItemCache(); object o = new object(); object item = cache.GetItem(cacheKey, () => { ++count; return(o); }); Assert.That(count, Is.EqualTo(1)); Assert.That(item, Is.EqualTo(o)); cache.UpdateItem(() => { }, cacheKey); item = cache.GetItem(cacheKey, () => { ++count; return(new object()); }); Assert.That(count, Is.EqualTo(2)); Assert.That(item, Is.Not.EqualTo(o)); }