コード例 #1
0
ファイル: AddressTests.cs プロジェクト: OneCyrus/FakeHttp
        public async Task RoundtripPostalCode()
        {
            MessageHandlerFactory.Mode = MessageHandlerMode.Capture;
            var handler = MessageHandlerFactory.CreateMessageHandler(new FileSystemResources(TestContext.TestRunDirectory));
            var service = new GeoCoder(handler, CredentialStore.RetrieveObject("bing.key.json").Key);

            var coord = await service.GetCoordinate(new Address()
            {
                postalCode = "55116", countryRegion = "US"
            });

            var address = await service.GetAddress(coord.Item1, coord.Item2);

            Assert.AreEqual("55116", address.postalCode);
        }
コード例 #2
0
        internal async void searchAddress()
        {
            if (!Searchable)
            {
                return;
            }

            var queryResult = await geocoder.GetCoordinate(
                addressLine : Street,
                locality : Town,
                adminDistrict : Region,
                postalCode : Postcode,
                countryRegion : Country);

            Latitude  = queryResult.Item1;
            Longitude = queryResult.Item2;
        }