private async Task PersistLatestQueueState() { IEnumerable <SourceQualifiedImageId> sourceQualifiedImageIds = _queue.QueuedImageIds.ToList(); _logger.Information("Persisting queue state: {@QueuedImageIds}", sourceQualifiedImageIds); await _persistence.SaveSettings(SettingsKey, _imageQueueSerializer.Serialize(sourceQualifiedImageIds)); _logger.Information("Queue state persisted"); }
public PersistingImageQueueTests() { _enqueuedImageIds = new[] { CreateImageId("1"), CreateImageId("2"), CreateImageId("3") }; _innerQueue = A.Fake <IImageQueue>(); A.CallTo(() => _innerQueue.QueuedImageIds).Returns(_enqueuedImageIds); _persistence = A.Fake <IPersistence>(); _serializer = A.Fake <IImageQueueSerializer>(); A.CallTo(() => _serializer.Serialize(A <IEnumerable <SourceQualifiedImageId> > .That.IsSameSequenceAs(_enqueuedImageIds))).Returns(EnqueuedImageIdsJson); _sut = new PersistingImageQueue(_persistence, _serializer, _innerQueue, A.Fake <ILogger>()); }