public async Task Then_Returns_Results_From_Service_With_No_Location( GetCourseProvidersQuery query, TrainingCourseProviders providersFromService, [Frozen] Mock <ICourseService> mockService, GetCourseProvidersQueryHandler handler) { providersFromService.Location = null; mockService .Setup(service => service.GetCourseProviders(query.CourseId, query.Location, query.DeliveryModes, query.ProviderRatings, query.Lat, query.Lon, query.ShortlistUserId)) .ReturnsAsync(providersFromService); var result = await handler.Handle(query, CancellationToken.None); result.Course.Should().BeEquivalentTo(providersFromService.Course); result.Providers.Should().BeEquivalentTo(providersFromService.CourseProviders); result.Total.Should().Be(providersFromService.Total); result.Location.Should().BeNullOrEmpty(); result.LocationGeoPoint.Should().BeNull(); }
public async Task Then_Returns_Results_From_Service( GetCourseProvidersQuery query, TrainingCourseProviders providersFromService, [Frozen] Mock <ICourseService> mockService, GetCourseProvidersQueryHandler handler) { mockService .Setup(service => service.GetCourseProviders(query.CourseId, query.Location, query.DeliveryModes, query.ProviderRatings, query.Lat, query.Lon, query.ShortlistUserId)) .ReturnsAsync(providersFromService); var result = await handler.Handle(query, CancellationToken.None); result.Course.Should().BeEquivalentTo(providersFromService.Course); result.Providers.Should().BeEquivalentTo(providersFromService.CourseProviders); result.Total.Should().Be(providersFromService.Total); result.TotalFiltered.Should().Be(providersFromService.TotalFiltered); result.Location.Should().Be(providersFromService.Location.Name); result.LocationGeoPoint.Should().BeEquivalentTo(providersFromService.Location.LocationPoint.GeoPoint); result.ShortlistItemCount.Should().Be(providersFromService.ShortlistItemCount); result.ShowEmployerDemand.Should().Be(providersFromService.ShowEmployerDemand); }
public async Task Then_The_Api_Response_Is_Returned( int courseId, string location, List <DeliveryModeType> deliveryModes, List <ProviderRating> providerRatings, double lat, double lon, Guid?shortlistUserId, TrainingCourseProviders providersFromApi, [Frozen] Mock <IApiClient> mockApiClient, CourseService service) { mockApiClient .Setup(client => client.Get <TrainingCourseProviders>( It.IsAny <GetCourseProvidersApiRequest>())) .ReturnsAsync(providersFromApi); var response = await service.GetCourseProviders(courseId, location, deliveryModes, providerRatings, lat, lon, shortlistUserId); response.Course.Should().Be(providersFromApi.Course); response.CourseProviders.Should().BeEquivalentTo(providersFromApi.CourseProviders); response.Total.Should().Be(providersFromApi.Total); }