public async Task Then_Postcode_Is_Returned_Correctly()
        {
            var postcodeData = await _locationApiClient
                               .GetGeoLocationDataAsync("CV12WT");

            postcodeData.Should().NotBeNull();
            postcodeData.Postcode.Should().Be("CV1 2WT");
            postcodeData.Latitude.Should().Be("50.001");
            postcodeData.Longitude.Should().Be("-1.234");
        }
Beispiel #2
0
        public When_LocationService_Is_Called_To_GetProximity_Data_For_Valid_Postcode()
        {
            var httpClient = new TestPostcodesIoHttpClient().Get();

            var locationService = new LocationApiClient(httpClient, new MatchingConfiguration
            {
                PostcodeRetrieverBaseUrl = "https://api.postcodes.io/"
            });

            _postcodeLookupResultDto = locationService.GetGeoLocationDataAsync("CV1 2WT").GetAwaiter().GetResult();
        }
Beispiel #3
0
    public async Task Then_Postcode_Is_Returned_Correctly()
    {
        var httpClient = IntializeHttpClient(GoodPostcode);

        var locationApiClient = new LocationApiClient(httpClient);

        var postcodeData = await locationApiClient.GetGeoLocationDataAsync(GoodPostcode);

        postcodeData.Should().NotBeNull();
        postcodeData.Postcode.Should().Be(GoodPostcode);
        postcodeData.Latitude.Should().Be(52.400997);
        postcodeData.Longitude.Should().Be(-1.508122);
    }
Beispiel #4
0
    public async Task Then_Outcode_Is_Returned_Correctly()
    {
        var httpClient = IntializeOutcodeHttpClient(Outcode);

        var locationApiClient = new LocationApiClient(httpClient);

        var postcodeData = await locationApiClient
                           .GetGeoLocationDataAsync(Outcode);

        postcodeData.Should().NotBeNull();
        postcodeData.Postcode.Should().Be(Outcode);
        postcodeData.Latitude.Should().Be(52.5198364972316);
        postcodeData.Longitude.Should().Be(-1.45313659025471);
    }
Beispiel #5
0
    public async Task Then_Terminated_Postcode_Is_Returned_Correctly()
    {
        var httpClient = IntializeTerminatedHttpClient(TerminatedPostcode);

        var locationApiClient = new LocationApiClient(httpClient);

        var postcodeData = await locationApiClient
                           .GetGeoLocationDataAsync(TerminatedPostcode);

        postcodeData.Should().NotBeNull();
        postcodeData.Postcode.Should().Be(TerminatedPostcode);
        postcodeData.Latitude.Should().Be(53.551618);
        postcodeData.Longitude.Should().Be(-1.482797);
    }
        public async Task Then_Postcode_Is_Returned_Correctly()
        {
            // Arrange
            var responseData = new PostcodeLookupResultDto
            {
                Postcode  = "CV1 2WT",
                Latitude  = 50.001,
                Longitude = -1.234
            };

            var httpClient = IntializeHttpClient("CV1 2WT", responseData);

            var locationApiClient = new LocationApiClient(httpClient, _configurationOptions);

            // Act
            var postcodeData = await locationApiClient.GetGeoLocationDataAsync("CV12WT");

            // Assert
            postcodeData.Should().NotBeNull();
            postcodeData.Postcode.Should().Be("CV1 2WT");
            postcodeData.Latitude.Should().Be(50.001);
            postcodeData.Longitude.Should().Be(-1.234);
        }