public void Should_remove_if_invalidated()
        {
            var anotherPubsub = new InMemoryPubSub();
            var anotherSut    = new InvalidatingMemoryCache(new MemoryCache(new MyOptions <MemoryCacheOptions>(new MemoryCacheOptions())), anotherPubsub);

            anotherSut.Set("a-key", 123);

            Assert.Equal(123, anotherSut.Get <int>("a-key"));

            anotherPubsub.Publish("CacheInvalidations", "a-key", true);

            Assert.Equal(0, anotherSut.Get <int>("a-key"));
        }
 public InvalidatingMemoryCacheTest()
 {
     sut = new InvalidatingMemoryCache(cache, pubsub);
 }
Beispiel #3
0
 public InvalidatingMemoryCacheTest()
 {
     sut = new InvalidatingMemoryCache(cache.Object, pubsub.Object);
 }