예제 #1
0
        public void should_map_zip_request()
        {
            //arrange
            var result = GetZipRequest();
            //act
            var codedResult = _sut.MapRequestResult(result).FirstOrDefault();

            //assert
            codedResult.City.ShouldNotBeEmpty();
            codedResult.State.ShouldNotBeEmpty();
            codedResult.Country.ShouldNotBeEmpty();
            codedResult.Zip.ShouldNotBeEmpty();
            codedResult.Coordinate.Latitude.ShouldEqual(40.1956139f);
            codedResult.Coordinate.Longitude.ShouldEqual(-74.71615f);
        }
예제 #2
0
        private IEnumerable <GeoCodingResult> GetData(Uri uri)
        {
            var client = new WebClient();

            var data = client.DownloadString(uri);

            var parseResult = _parser.Parse(data);

            return(!parseResult.Status.Equals("ZERO_RESULTS")
                ? _mapper.MapRequestResult(parseResult)
                : new List <GeoCodingResult>());
        }