public void Should_evict_old_object_from_cache() { _rep.Get <TestAggregate>(_aggregate.Id); var aggregate = _cache.Get(_aggregate.Id.ToString()); Assert.Equal(_aggregate, aggregate); }
public void NullKey() { var cache = new TestMemoryCache(); Assert.Throws <ArgumentNullException>(() => { var value = cache.Get(key: null); }); }
public void MissingKey() { var cache = new TestMemoryCache(); var key = GetKey(); var value = cache.Get(key); Assert.Null(value); }
public void BasicAdd() { var cache = new TestMemoryCache(); var key = GetKey(); var value = new List <uint> { 1, 2, 3 }; cache.Set(key, value); var result = cache.Get(key); Assert.Same(value, result); }
public void LastAccessIsUpdated() { var cache = new TestMemoryCache(); var key = GetKey(); var value = new List <uint>(); cache.Set(key, value); var oldAccessTime = cache.GetAccessTime(key); Thread.Sleep(millisecondsTimeout: 10); cache.Get(key); var newAccessTime = cache.GetAccessTime(key); Assert.True(newAccessTime > oldAccessTime, "New AccessTime should be greater than old"); }
public void Should_evict_old_object_from_cache() { var aggregate = _cache.Get(_aggregate.Id.ToString()); Assert.Null(aggregate); }