예제 #1
0
        private async Task FindPostcodeFromCoordinates()
        {
            Console.WriteLine("Find postcode from coords");
            await _ukNearestPostcodeToCoordinates.Initalize();

            var closestPostcode = await _ukNearestPostcodeToCoordinates.GetClosestPostcodeToCoordinate(50.796435, -1.0648767);

            PostcodeParts postcodeParts = new PostcodeParts(closestPostcode.Identifier, PostcodePartsType.Full);

            Console.WriteLine($"Neaest postcode (expect PO4 8RA) = {closestPostcode.Identifier} ({postcodeParts.GetAreaAndDistrict_10K()})");
            Console.WriteLine("END Postcde match");
        }
예제 #2
0
        public async Task InitializeTest()
        {
            List <LocationLatLng> lookupdata = Stubs.GetPostcodeLookupData_Full();

            var iProcessedUkDataMock = new Mock <IProcessedUkData>();

            iProcessedUkDataMock.Setup(_ =>
                                       _.GetData(It.IsAny <PostcodePartsType>())
                                       ).ReturnsAsync(lookupdata);

            _cut = new UkNearestPostcodeToCoordinates(iProcessedUkDataMock.Object);

            await _cut.Initalize();
        }