public async Task SaveItems_when_state_is_null_or_empty_returns_null() { var state = default(Dictionary <string, CacheEntryState>); var result = await _sut.SaveItems(state, CancellationToken.None); Assert.IsNull(result); state = new Dictionary <string, CacheEntryState>(); result = await _sut.SaveItems(state, CancellationToken.None); Assert.IsNull(result); }
public async Task SetState(string cacheItem, CacheEntryState cacheEntryState, CancellationToken cancellationToken) { var items = await GetOrSetItems(false, cancellationToken); if (items.ContainsKey(cacheItem)) { items[cacheItem] = cacheEntryState; } else { items.Add(cacheItem, cacheEntryState); } await _cacheTrackerStore.SaveItems(items, cancellationToken); _log.LogInformation("Writing state information for '{0}'", cacheItem); _log.LogDebug("Setting {0} state for {1}", Enum.GetName(typeof(CacheEntryState), cacheEntryState), cacheItem); }