public async Task GetPublishedProviderProfileForProviderIdAndSpecificationIdAndFundingStreamId_CallsCorrectly( string providerId, string specificationId, string fundingStreamId) { IResultsService resultsService = Substitute.For <IResultsService>(); IResultsSearchService resultsSearchService = Substitute.For <IResultsSearchService>(); ICalculationProviderResultsSearchService calculationProviderResultsSearchService = Substitute.For <ICalculationProviderResultsSearchService>(); IPublishedResultsService publishedResultsService = Substitute.For <IPublishedResultsService>(); IProviderCalculationResultsSearchService providerCalculationsResultsSearchService = Substitute.For <IProviderCalculationResultsSearchService>(); IFeatureToggle featureToggle = Substitute.For <IFeatureToggle>(); IProviderCalculationResultsReIndexerService providerCalculationResultsReIndexerService = Substitute.For <IProviderCalculationResultsReIndexerService>(); ResultsController controller = new ResultsController( resultsService, resultsSearchService, calculationProviderResultsSearchService, publishedResultsService, providerCalculationsResultsSearchService, featureToggle, providerCalculationResultsReIndexerService); await controller.GetPublishedProviderProfileForProviderIdAndSpecificationIdAndFundingStreamId(providerId, specificationId, fundingStreamId); await publishedResultsService .Received(1) .GetPublishedProviderProfileForProviderIdAndSpecificationIdAndFundingStreamId(providerId, specificationId, fundingStreamId); //Moq has a .VerifyNoOtherCalls method which would be really useful here to confirm the others weren't called. }
public ResultsController( IResultsService resultsService, IResultsSearchService resultsSearchService, ICalculationProviderResultsSearchService calculationProviderResultsSearchService, IPublishedResultsService publishedResultsService, IProviderCalculationResultsSearchService providerCalculationResultsSearchService, IFeatureToggle featureToggle, IProviderCalculationResultsReIndexerService providerCalculationResultsReIndexerService) { Guard.ArgumentNotNull(resultsSearchService, nameof(resultsSearchService)); Guard.ArgumentNotNull(resultsService, nameof(resultsService)); Guard.ArgumentNotNull(calculationProviderResultsSearchService, nameof(calculationProviderResultsSearchService)); Guard.ArgumentNotNull(publishedResultsService, nameof(publishedResultsService)); Guard.ArgumentNotNull(providerCalculationResultsSearchService, nameof(providerCalculationResultsSearchService)); Guard.ArgumentNotNull(featureToggle, nameof(featureToggle)); Guard.ArgumentNotNull(providerCalculationResultsReIndexerService, nameof(providerCalculationResultsReIndexerService)); _resultsSearchService = resultsSearchService; _calculationProviderResultsSearchService = calculationProviderResultsSearchService; _publishedResultsService = publishedResultsService; _resultsService = resultsService; _providerCalculationResultsSearchService = providerCalculationResultsSearchService; _featureToggle = featureToggle; _providerCalculationResultsReIndexerService = providerCalculationResultsReIndexerService; }