public void AddOrGetExisting() { string key = "AddOrGetExisting"; string data = "data"; SqlCache cache = new SqlCache(connectionString); // Try to get data var getData = cache.Get(key); Assert.IsNull(getData); // Add new entry getData = cache.AddOrGetExisting(key, data, DateTime.Now.AddMinutes(30)); Assert.IsNull(getData); // Retrieve added entry getData = cache.AddOrGetExisting(key, data, DateTime.Now.AddMinutes(30)); Assert.IsNotNull(getData); }
public void AddOrGetExisting() { string key = "AddOrGetExisting"; string data = "data"; SqlCache cache = new SqlCache(connectionString); // Try to get data var getData = cache.Get(key); Assert.IsNull(getData); // Add new entry getData = cache.AddOrGetExisting(key, data, DateTime.Now.AddMinutes(30)); Assert.IsNull(getData); // Retrieve added entry getData = cache.AddOrGetExisting(key, data, DateTime.Now.AddMinutes(30)); Assert.IsNotNull(getData); cache.Remove(key); // Clean DB for further testing }
public void AddOrGetExisting() { var key = "AddOrGetExisting"; var data = "data"; var cache = new SqlCache(connectionString, serializer); // Try to get data var getData = cache.Get(key); Assert.IsNull(getData); // Add new entry getData = cache.AddOrGetExisting(key, data, DateTime.Now.AddMinutes(30)); Assert.IsNull(getData); // Retrieve added entry getData = cache.AddOrGetExisting(key, data, DateTime.Now.AddMinutes(30)); Assert.IsNotNull(getData); cache.Remove(key); // Clean DB for further testing }