public async Task Then_Gets_Demands_And_Courses_From_Apis_And_Adds_Courses_To_Cache( GetAggregatedCourseDemandListQuery query, GetStandardsListResponse coursesApiResponse, GetAggregatedCourseDemandListResponse demandApiResponse, [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > mockCoursesApi, [Frozen] Mock <IEmployerDemandApiClient <EmployerDemandApiConfiguration> > mockDemandApi, [Frozen] Mock <ILocationLookupService> mockLocationLookup, [Frozen] Mock <ICacheStorageService> cacheStorageService, GetAggregatedCourseDemandListQueryHandler handler) { query.LocationName = null; query.LocationRadius = null; cacheStorageService .Setup(client => client.RetrieveFromCache <GetStandardsListResponse>(nameof(GetStandardsListResponse))) .ReturnsAsync((GetStandardsListResponse)null); mockLocationLookup .Setup(service => service.GetLocationInformation(null, default, default))
public async Task Then_Returns_List_From_Service( int totalResultCount, GetAggregatedCourseDemandListQuery query, List <AggregatedCourseDemandSummary> listFromService, [Frozen] Mock <ICourseDemandService> mockDemandService, GetAggregatedCourseDemandListQueryHandler handler) { mockDemandService .Setup(service => service.GetAggregatedCourseDemandList( query.Ukprn, query.CourseId, query.Lat, query.Lon, query.Radius)) .ReturnsAsync(listFromService); mockDemandService .Setup(service => service.GetAggregatedDemandTotal(query.Ukprn)).ReturnsAsync(totalResultCount); var result = await handler.Handle(query, CancellationToken.None); result.AggregatedCourseDemandList.Should().BeEquivalentTo(listFromService); result.Total.Should().Be(totalResultCount); }