Пример #1
0
        public async Task SendMessageListDoesNotSendMessagesWhenListIsNull()
        {
            // Arrange
            var fakeTopicClient       = A.Fake <ITopicClient>();
            var correlationIdProvider = A.Fake <ICorrelationIdProvider>();
            var refreshService        = new JobProfileSegmentRefreshService <RefreshJobProfileSegmentServiceBusModel>(fakeTopicClient, correlationIdProvider);

            // Act
            await refreshService.SendMessageListAsync(null).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeTopicClient.SendAsync(A <Message> .Ignored)).MustNotHaveHappened();
        }
Пример #2
0
        public async Task SendMessageListSendsBatchedMessagesOnTopicClient(int batchSize, int expectedSentBatches)
        {
            // Arrange
            var fakeTopicClient       = A.Fake <ITopicClient>();
            var correlationIdProvider = A.Fake <ICorrelationIdProvider>();
            var refreshService        = new JobProfileSegmentRefreshService <RefreshJobProfileSegmentServiceBusModel>(fakeTopicClient, correlationIdProvider);
            var models = CreateListOfModels(batchSize);

            // Act
            await refreshService.SendMessageListAsync(models).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeTopicClient.SendAsync(A <List <Message> > .Ignored)).MustHaveHappened(expectedSentBatches, Times.Exactly);
        }