public void IMemory_cache_empty_remove() { //Arrange var cache = new DefaultMemoryStore(); //Act cache.Remove(string.Empty); //Assert Assert.NotNull(cache); }
public void Default_caching_option_with_constructor_store() { //Arrange var store = new DefaultMemoryStore(); //Act var cachingOption = new CachingOption(store); //Assert Assert.StrictEqual(store, cachingOption.Store); }
public void Default_caching_option_with_constructor_key_and_store() { //Arrange var key = new DefaultKeyGenerator(); var store = new DefaultMemoryStore(); //Act var cachingOption = new CachingOption(key, store); //Assert Assert.StrictEqual(key, cachingOption.Key); Assert.StrictEqual(store, cachingOption.Store); }
public void IMemory_cache_empty_get() { //Arrange var cache = new DefaultMemoryStore(); //Act bool found = cache.TryGetValue(string.Empty, out var response); //Assert Assert.NotNull(cache); Assert.False(found); Assert.Null(response); }
public void IMemory_cache_empty_key() { //Arrange var cache = new DefaultMemoryStore(); var expiration = new TimeSpan(0, 1, 0); var response = A.Fake <FakeCachedResponse>(); //Act cache.Set(string.Empty, response, expiration); //Assert Assert.NotNull(cache); Assert.NotNull(response); }
public void IMemory_cache_empty_set() { //Arrange var cache = new DefaultMemoryStore(); var expiration = new TimeSpan(0, 1, 0); const string key = "-Random-Key-1"; var response = A.Fake <FakeCachedResponse>(); //Act cache.Set(key, response, expiration); //Assert Assert.NotNull(cache); Assert.NotNull(response); }
public void IMemory_cache_with_value_set_get_with_size_limit() { //Arrange var cache = new DefaultMemoryStore(1); var expiration = new TimeSpan(0, 1, 0); const string key = "-Random-Key-3"; var response = A.Fake <FakeCachedResponse>(); //Act cache.Set(key, response, expiration); bool found = cache.TryGetValue(key, out var getResponse); //Assert Assert.Equal(response, getResponse); Assert.True(found); }
public void IMemory_cache_with_value_set_remove_get() { //Arrange var cache = new DefaultMemoryStore(); var expiration = new TimeSpan(0, 1, 0); const string key = "-Random-Key-7"; var response = A.Fake <FakeCachedResponse>(); //Act cache.Set(key, response, expiration); cache.Remove(key); bool found = cache.TryGetValue(key, out var getResponse); //Assert Assert.Null(getResponse); Assert.False(found); }