public void Then_The_Fields_Are_Correctly_Mapped(GetProviderCourseInformation source) { //Act var actual = (GetProviderContactDetails)source; //Assert actual.Ukprn.Should().Be(source.Ukprn); actual.Website.Should().Be(source.ContactUrl); actual.PhoneNumber.Should().Be(source.Phone); actual.EmailAddress.Should().Be(source.Email); }
public async Task Then_The_Data_Is_Returned_From_The_Apis( GetEmployerCourseProviderDemandQuery query, LocationItem locationResult, GetStandardsListItem standardResult, GetEmployerCourseProviderListResponse demandResponse, GetProviderCourseInformation courseProviderResponse, [Frozen] Mock <ILocationLookupService> locationLookupService, [Frozen] Mock <ICoursesApiClient <CoursesApiConfiguration> > coursesApiClient, [Frozen] Mock <IEmployerDemandApiClient <EmployerDemandApiConfiguration> > employerDemandApiClient, [Frozen] Mock <ICourseDeliveryApiClient <CourseDeliveryApiConfiguration> > courseDeliveryApiClient, GetEmployerCourseProviderDemandQueryHandler handler) { //Arrange locationLookupService.Setup(x => x.GetLocationInformation(query.LocationName, 0, 0, true)) .ReturnsAsync(locationResult); coursesApiClient .Setup(x => x.Get <GetStandardsListItem>(It.Is <GetStandardRequest>(c => c.StandardId.Equals(query.CourseId)))).ReturnsAsync(standardResult); employerDemandApiClient .Setup(x => x.Get <GetEmployerCourseProviderListResponse>( It.Is <GetCourseProviderDemandsRequest>(c => c.GetUrl.Contains($"providers/{query.Ukprn}/courses/{query.CourseId}?lat={locationResult.GeoPoint.First()}&lon={locationResult.GeoPoint.Last()}&radius={query.LocationRadius}")))) .ReturnsAsync(demandResponse); courseDeliveryApiClient.Setup(x => x.Get <GetProviderCourseInformation>( It.Is <GetProviderCourseInformationRequest>(c => c.GetUrl.Contains($"courses/{query.CourseId}/providers/{query.Ukprn}")))) .ReturnsAsync(courseProviderResponse); //Act var actual = await handler.Handle(query, CancellationToken.None); //Assert actual.Course.Should().BeEquivalentTo(standardResult); actual.Location.Should().BeEquivalentTo(locationResult); actual.EmployerCourseDemands.Should().BeEquivalentTo(demandResponse.EmployerCourseDemands); actual.ProviderDetail.Should().BeEquivalentTo(courseProviderResponse); actual.Total.Should().Be(demandResponse.Total); actual.TotalFiltered.Should().Be(demandResponse.TotalFiltered); }