public void Get_And_Add_String() { string testString = "test"; var returnString = _cache.TryGet("test", () => testString, 1); // Try to add it again with 2000 var returnString2 = _cache.TryGet("test", () => testString, 2); Assert.AreEqual(testString, returnString); Assert.AreEqual(testString, returnString2); Thread.Sleep(1500); //sleep longer than the cache expiration Assert.AreEqual(default(string), _cache.TryGet <string>("test")); }