public void TestCreateEntry_ReturnValue() { var cache = new InMemoryCache(); cache.CreateEntry("key", new NewsArticle()); Assert.IsTrue(cache.TryGetValue("key", out var value)); Assert.NotNull(value); }
public void TestCreateEntry_DupKey_NoException_Override() { var cache = new InMemoryCache(); cache.CreateEntry("key", new NewsArticle() { Id = 1 }); Assert.DoesNotThrow(() => { cache.CreateEntry("key", new NewsArticle() { Id = 2 }); }); Assert.IsTrue(cache.TryGetValue("key", out var value)); Assert.AreEqual(2, value.Id); }
public void TestCreateEntry_NoException() { var cache = new InMemoryCache(); Assert.DoesNotThrow(() => { cache.CreateEntry("key", new NewsArticle()); }); }
public void TestRemove_KeyExists_ShouldRemove() { var cache = new InMemoryCache(); cache.CreateEntry("key", new NewsArticle()); Assert.DoesNotThrow(() => { cache.Remove("key"); }); Assert.IsFalse(cache.TryGetValue("key", out var value)); }