Beispiel #1
0
        public async Task Method_Async_Parameters(Cache <Example> cache)
        {
            CacheStrategyAsync <double> strategy = cache.Method(c => c.CalculateSomeWorkAsync(3));

            CachedValue <double> result1 = await strategy.GetAsync();

            CachedValue <double> result2 = await strategy.GetAsync();

            Assert.AreEqual(result1.Version, result2.Version);
        }
Beispiel #2
0
        public async Task CacheFailureOnSet_Async_Handled()
        {
            ICache <CacheMe> cache = CreateHandledCache(CacheOperation.Set);

            CacheStrategyAsync <double> cacheStrategy = cache.Method(m => m.DoWorkAsync());

            ICachedValue <double> result1 = await cacheStrategy.GetAsync();

            ICachedValue <double> result2 = await cacheStrategy.GetAsync();

            Assert.AreNotEqual(result1.Value, result2.Value);
        }
Beispiel #3
0
        public async Task CacheFailureOnSet_Async_Unhandled()
        {
            ICache <CacheMe> cache = CreateUnhandledCache(CacheOperation.Set);

            CacheStrategyAsync <double> cacheStrategy = cache.Method(m => m.DoWorkAsync());

            ICachedValue <double> result = await cacheStrategy.GetAsync();
        }