public async Task ThenItShouldGetEstablishmentsFromApiIfReadFromLive(int[] urns) { await _manager.GetLearningProvidersAsync(urns.Select(x => x.ToString()).ToArray(), null, true, null, _cancellationToken); _giasApiClientMock.Verify(c => c.GetEstablishmentAsync(It.IsAny <long>(), _cancellationToken), Times.Exactly(urns.Length)); for (var i = 0; i < urns.Length; i++) { _giasApiClientMock.Verify(c => c.GetEstablishmentAsync(urns[i], _cancellationToken), Times.Once, $"Expected call for urn {i}"); } _establishmentRepository.Verify(c => c.GetEstablishmentAsync(It.IsAny <long>(), It.IsAny <CancellationToken>()), Times.Never); }
public async Task ThenItShouldGetProvidersFromApiIfReadFromLive() { var ukprns = _fixture.Create <long[]>(); await _manager.GetLearningProvidersAsync(ukprns.Select(x => x.ToString()).ToArray(), null, true, null, _cancellationToken); _ukrlpApiClientMock.Verify(c => c.GetProvidersAsync( It.Is <long[]>(x => x.Length == ukprns.Length), _cancellationToken), Times.Once); _providerRepository.Verify(c => c.GetProvidersAsync(It.IsAny <long[]>(), It.IsAny <CancellationToken>()), Times.Never); }