< Summary

Information
Class: Services.CacheServices.Cache.CacheUpdater<T>
Assembly: Services
File(s): /home/runner/work/Studio2Prod/Studio2Prod/AppRepository/CacheServices/Cache/CacheUpdater.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 17
Coverable lines: 17
Total lines: 50
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 8
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%210%
Update()0%2040%
Update()0%2040%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/AppRepository/CacheServices/Cache/CacheUpdater.cs

#LineLine coverage
 1using Services.CacheServices;
 2using Services.CacheServices.Cache;
 3using Services.CacheServices.Cache.OzonOrdersCache;
 4
 5namespace Services.CacheServices.Cache
 6{
 7    public class CacheUpdater<T> : ICacheUpdater<T>
 8    {
 9        private readonly OrderCache _orderCache;
 10        private readonly TransactionCache _transactionCache;
 11
 12
 013        public CacheUpdater(OrderCache orderCache,
 014                            TransactionCache transactionCache)
 15        {
 016            _orderCache = orderCache;
 017            _transactionCache = transactionCache;
 018        }
 19
 20        public async Task Update(IAppCache<T> cacheEntity)
 21        {
 022            await cacheEntity.Update();
 23
 024            if (typeof(OrderCache).IsAssignableFrom(cacheEntity.GetType()))
 25            {
 026                await _transactionCache.Update();
 27            }
 028            if (typeof(ProductCache).IsAssignableFrom(cacheEntity.GetType()))
 29            {
 030                await _orderCache.Update();
 31            }
 32
 033        }
 34
 35        public async Task Update(IRedisAppCache<T> cacheEntity)
 36        {
 037            await cacheEntity.Update();
 38
 039            if (typeof(OrderCache).IsAssignableFrom(cacheEntity.GetType()))
 40            {
 041                await _transactionCache.Update();
 42            }
 043            if (typeof(ProductCache).IsAssignableFrom(cacheEntity.GetType()))
 44            {
 045                await _orderCache.Update();
 46            }
 47
 048        }
 49    }
 50}