public void GetNewStoryIdsCache_Ids_ReturnsSavedIds() { var newStoryIds = new int[] { 1, 2, 3 }; _ = _storyCacheService.AddNewStoryIdsToCache(newStoryIds); var result = _storyCacheService.GetNewStoryIdsCache(); Assert.That(result, Is.EqualTo(newStoryIds)); }
public async Task <IEnumerable <int> > GetNewStoryIds() { var newStories = _cache.GetNewStoryIdsCache(); if (newStories != null) { return(newStories); } try { newStories = await _storyService.GetNewStories().ConfigureAwait(false); return(_cache.AddNewStoryIdsToCache(newStories)); } catch { return(null); } }