Beispiel #1
0
 private void ClearResumeData()
 {
     CacheStorage.Remove(_keyDestination);
     CacheStorage.Remove(_keyPartiallyLoadedFilename);
     CacheStorage.Remove(_keyFootprint);
     CacheStorage.Remove(_keyLastWriteDate);
 }
Beispiel #2
0
            public void RemovesExistingValue()
            {
                var cache = new CacheStorage <string, int>();

                cache.Add("1", 1);

                Assert.IsTrue(cache.Contains("1"));

                cache.Remove("1");

                Assert.IsFalse(cache.Contains("1"));
            }
Beispiel #3
0
            public void DoesNotDisposeItemOnRemoveWhenDisposingNotEnabled()
            {
                var disposable = new CustomDisposable();
                var cache      = new CacheStorage <string, CustomDisposable>();

                cache.ExpirationTimerInterval = TimeSpan.FromMilliseconds(250);

                cache.Add("disposable", disposable, expiration: TimeSpan.FromMilliseconds(250));

                Assert.IsFalse(disposable.IsDiposed);

                cache.Remove("disposable");

                Assert.IsFalse(disposable.IsDiposed);
            }
 /// <summary>
 /// Handles the <see cref="E:SerializationManagerCacheInvalidated" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="CacheInvalidatedEventArgs"/> instance containing the event data.</param>
 private void OnSerializationManagerCacheInvalidated(object sender, CacheInvalidatedEventArgs e)
 {
     _serializationModelCache.Remove(e.Type);
 }
Beispiel #5
0
            public void RemovesNonExistingValue()
            {
                var cache = new CacheStorage <string, int>();

                cache.Remove("1");
            }
Beispiel #6
0
            public void ThrowsArgumentNullExceptionForNullKey()
            {
                var cache = new CacheStorage <string, int>();

                ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => cache.Remove(null));
            }
Beispiel #7
0
            public void DoesNotDisposeItemOnRemoveWhenDisposingNotEnabled()
            {
                var disposable = new CustomDisposable();
                var cache = new CacheStorage<string, CustomDisposable>();
                cache.ExpirationTimerInterval = TimeSpan.FromMilliseconds(250);

                cache.Add("disposable", disposable, expiration: TimeSpan.FromMilliseconds(250));

                Assert.IsFalse(disposable.IsDiposed);

                cache.Remove("disposable");

                Assert.IsFalse(disposable.IsDiposed);
            }
Beispiel #8
0
 public void RemovesNonExistingValue()
 {
     var cache = new CacheStorage<string, int>();
     cache.Remove("1");
 }
Beispiel #9
0
            public void RemovesExistingValue()
            {
                var cache = new CacheStorage<string, int>();
                cache.Add("1", 1);

                Assert.IsTrue(cache.Contains("1"));

                cache.Remove("1");

                Assert.IsFalse(cache.Contains("1"));
            }
Beispiel #10
0
            public void ThrowsArgumentNullExceptionForNullKey()
            {
                var cache = new CacheStorage<string, int>();

                ExceptionTester.CallMethodAndExpectException<ArgumentNullException>(() => cache.Remove(null));
            }