public async Task Clear_PersistsImageQueueAfterClearing() { await _sut.Clear(); A.CallTo(() => _innerQueue.Clear()) .MustHaveHappened(Repeated.Exactly.Once) .Then(A.CallTo(() => _persistence.SaveSettings(ImageQueuePersistenceKey, EnqueuedImageIdsJson)).MustHaveHappened()); }
public async Task Rehydrade(Func <SourceQualifiedImageId, ISavedImage> fetchSavedImages) { _logger.Information("Attempting to load queue"); Option <string> persistedQueue = await _persistence.LoadSettings(SettingsKey); await persistedQueue.Match(async s => { _logger.Information("Loaded queue json"); IEnumerable <SourceQualifiedImageId> deserializedQueue = _imageQueueSerializer.Deserialize(s); _logger.Information("Queue deserialized"); await _queue.Clear(); await _queue.Enqueue(deserializedQueue.Select(fetchSavedImages)); }, () => { _logger.Information("Unable to load queue"); return(TaskConstants.Completed); }); }