public async Task Search_Returns_ProviderLocations_Filtered_By_Qualification_And_NumberOfItems()
        {
            var providers = new List <Provider>
            {
                new Provider(),
                new Provider(),
                new Provider()
            }.AsQueryable();

            _providerDataService.GetProviders().Returns(providers);

            int?         qualificationId = 2232;
            const int    numberOfItems   = 2;
            const string postcode        = "mk669oo";
            var          searchRequest   = new SearchRequest
            {
                QualificationId = qualificationId,
                NumberOfItems   = numberOfItems,
                Postcode        = postcode,
                OriginLatitude  = "1.5",
                OriginLongitude = "50"
            };

            var locations = new List <Location>
            {
                new Location(),
                new Location(),
                new Location()
            }.AsQueryable();

            _providerDataService.GetLocations(Arg.Is <IQueryable <Provider> >(p => p == providers), Arg.Is <int>(q => q == searchRequest.QualificationId.Value)).Returns(locations);

            var providerLocations = new List <ProviderLocation>
            {
                new ProviderLocation(),
                new ProviderLocation(),
                new ProviderLocation()
            }.AsQueryable();

            _providerDataService.GetProviderLocations(
                Arg.Is <IQueryable <Location> >(l => l == locations),
                Arg.Is <IQueryable <Provider> >(p => p == providers))
            .Returns(providerLocations);

            _distanceCalculationService.CalculateProviderLocationDistanceInMiles(
                Arg.Is <PostcodeLocation>(p => p.Postcode == searchRequest.Postcode &&
                                          p.Latitude.ToString() == searchRequest.OriginLatitude &&
                                          p.Longitude.ToString() == searchRequest.OriginLongitude),
                providerLocations)
            .Returns(providerLocations.ToList());

            var(totalCount, searchResults) = await _service.Search(searchRequest);

            totalCount.Should().Be(providerLocations.Count());
            searchResults.Count().Should().Be(numberOfItems);
            _providerDataService.Received(1).GetProviders();
            _providerDataService.Received(1).GetLocations(Arg.Is <IQueryable <Provider> >(p => p == providers), Arg.Is <int>(q => q == searchRequest.QualificationId.Value));
            _providerDataService.Received(1).GetProviderLocations(Arg.Is <IQueryable <Location> >(l => l == locations), Arg.Is <IQueryable <Provider> >(p => p == providers));
            await _distanceCalculationService.Received(1).CalculateProviderLocationDistanceInMiles(
                Arg.Is <PostcodeLocation>(p => p.Postcode == searchRequest.Postcode),
                providerLocations);

            _journeyService.Received(numberOfItems)
            .GetDirectionsLink(searchRequest.Postcode, Arg.Any <ProviderLocation>());
        }