public async Task EnqueueStagingAsync(StagingBatchQueueItem <long> queueItem, CancellationToken cancellationToken)
        {
            await _queue.CreateIfNotExistsAsync(cancellationToken);

            var message = new CloudQueueMessage(JsonConvert.SerializeObject(queueItem));
            await _queue.AddMessageAsync(message, cancellationToken);
        }
        public async Task EnqueueBatchOfStagingAsync(long[] ukprns, DateTime pointInTime, CancellationToken cancellationToken)
        {
            await _queue.CreateIfNotExistsAsync(cancellationToken);

            var queueItem = new StagingBatchQueueItem
            {
                Identifiers = ukprns,
                PointInTime = pointInTime,
            };

            var message = new CloudQueueMessage(JsonConvert.SerializeObject(queueItem));
            await _queue.AddMessageAsync(message, cancellationToken);
        }
Ejemplo n.º 3
0
        public async Task ThenItShouldCallCacheManagerWithDeserializedUrns(long[] ukprns, DateTime pointInTime)
        {
            var queueItem = new StagingBatchQueueItem
            {
                Identifiers = ukprns,
                PointInTime = pointInTime,
            };

            await _function.Run(JsonConvert.SerializeObject(queueItem), _cancellationToken);

            _cacheManagerMock.Verify(m => m.ProcessBatchOfProviders(
                                         It.Is <long[]>(actual => AreEqual(ukprns, actual)),
                                         pointInTime,
                                         _cancellationToken), Times.Once);
        }
        public async Task ThenItShouldCallCacheManagerWithDeserializedUidAndUrns(long uid, long[] urns, DateTime pointInTime)
        {
            var queueItem = new StagingBatchQueueItem <long>
            {
                ParentIdentifier = uid,
                Urns             = urns,
                PointInTime      = pointInTime,
            };

            await _function.Run(JsonConvert.SerializeObject(queueItem), _cancellationToken);

            _cacheManagerMock.Verify(m => m.ProcessGroupAsync(
                                         uid,
                                         It.Is <long[]>(actual => AreEqual(urns, actual)),
                                         pointInTime,
                                         _cancellationToken), Times.Once);
        }