public void ShouldNotThrowExceptionWhenRemovingNonExistentKey() { CacheBuilder <string> cache_builder = new CacheBuilder <string>(); LoadingCacheMock <string> ref_cache = new LoadingCacheMock <string>(cache_builder); ref_cache.Remove("missing-key"); }
public void ShouldThrowExceptionWhenKeyIsNull() { CacheBuilder <string> cache_builder = new CacheBuilder <string>(); LoadingCacheMock <string> cache = new LoadingCacheMock <string>(cache_builder); CacheLoader <string> loader = new StringCacheLoader(); Assert.Throws <ArgumentNullException>( delegate() { cache.Get(null, loader); }); Assert.Throws <ArgumentNullException>( delegate() { cache.GetIfPresent(null); }); Assert.Throws <ArgumentNullException>( delegate() { cache.Put(null, string.Empty); }); Assert.Throws <ArgumentNullException>(delegate() { cache.Remove(null); }); }