public void FindAddress_IE_8SilverBirchesDunboyneInvalidLicenceKey_ThrowsAutoaddressException()
        {
            const string licenceKey = "InvalidLicenceKey";
            const string address = "8 Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient(licenceKey);
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            AutoaddressException autoaddressException = Assert.Throws<AutoaddressException>(() => autoaddressClient.FindAddress(request));
            Assert.AreEqual(ErrorType.InvalidLicenceKey, autoaddressException.ErrorType);
        }
        public static void Main()
        {
            const string address = "8 Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            
            var request = new Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);
            var response = autoaddressClient.FindAddress(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.PostalAddress = {0}", string.Join(",", response.PostalAddress));
        }
        public void FindAddress_IE_8SilverBirchesDunboyneUseKeyFromAppConfig_ReturnsValidResponse()
        {
            const string address = "8 Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.FindAddress(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.PostcodeAppended, response.Result);
            Assert.AreEqual("A86VC04", response.Postcode);
        }
        public static void Main()
        {
            const string address = "Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            
            var request = new Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);
            var response1 = autoaddressClient.FindAddress(request);
            
            Console.WriteLine("response1.Result = {0}", response1.Result);
            Console.WriteLine("response1.AddressId = {0}", response1.AddressId);
            Console.WriteLine("response1.PostalAddress = {0}", string.Join(",", response1.PostalAddress));
            Console.WriteLine("response1.Options[1].DisplayName = {0}", response1.Options[1].DisplayName);

            var nextLink = response1.Options[1].Links.OfType<Model.FindAddress.Link>().First();
            var response2 = autoaddressClient.FindAddress(nextLink);
            
            Console.WriteLine("response2.Result = {0}", response2.Result);
            Console.WriteLine("response2.AddressId = {0}", response2.AddressId);
            Console.WriteLine("response2.Postcode = {0}", response2.Postcode);
            Console.WriteLine("response2.PostalAddress = {0}", string.Join(",", response2.PostalAddress));
        }
        public static void Run()
        {
            const string address           = "Silver Birches, Dunboyne";
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);

            var request   = new Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);
            var response1 = autoaddressClient.FindAddress(request);

            Console.WriteLine("response1.Result = {0}", response1.Result);
            Console.WriteLine("response1.AddressId = {0}", response1.AddressId);
            Console.WriteLine("response1.PostalAddress = {0}", string.Join(",", response1.PostalAddress));
            Console.WriteLine("response1.Options[1].DisplayName = {0}", response1.Options[1].DisplayName);

            var nextLink  = response1.Options[1].Links.OfType <Model.FindAddress.Link>().First();
            var response2 = autoaddressClient.FindAddress(nextLink);

            Console.WriteLine("response2.Result = {0}", response2.Result);
            Console.WriteLine("response2.AddressId = {0}", response2.AddressId);
            Console.WriteLine("response2.Postcode = {0}", response2.Postcode);
            Console.WriteLine("response2.PostalAddress = {0}", string.Join(",", response2.PostalAddress));
        }
Esempio n. 6
0
        public static void Run()
        {
            const string address           = "8 Silver Birches, Dunboyne";
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);

            var request  = new Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);
            var response = autoaddressClient.FindAddress(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.PostalAddress = {0}", string.Join(",", response.PostalAddress));
        }
        public static void Run()
        {
            const string apiBaseAddress             = "https://api.autoaddress.ie";
            const int    requestTimeoutMilliseconds = 5000;
            const string licenceKey        = "TheLicenceKey";
            const string address           = "8 Silver Birches, Dunboyne";
            var          autoaddressConfig = new AutoaddressConfig(apiBaseAddress, requestTimeoutMilliseconds);
            var          autoaddressClient = new AutoaddressClient(licenceKey, autoaddressConfig);

            var request  = new Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);
            var response = autoaddressClient.FindAddress(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.PostalAddress = {0}", string.Join(",", response.PostalAddress));
        }
 public static void Main()
 {
     const string apiBaseAddress = "https://api.autoaddress.ie";
     const int requestTimeoutMilliseconds = 5000;
     const string licenceKey = "TheLicenceKey";
     const string address = "8 Silver Birches, Dunboyne";
     var autoaddressConfig = new AutoaddressConfig(apiBaseAddress, requestTimeoutMilliseconds);
     var autoaddressClient = new AutoaddressClient(licenceKey, autoaddressConfig);
     
     var request = new Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);
     var response = autoaddressClient.FindAddress(request);
     
     Console.WriteLine("response.Result = {0}", response.Result);
     Console.WriteLine("response.Postcode = {0}", response.Postcode);
     Console.WriteLine("response.PostalAddress = {0}", string.Join(",", response.PostalAddress));
 }
        public void AutoCompleteThenFindAddress_IE_D08XY00_ReturnsValidResponse()
        {
            const string eircode = "D08XY00";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.AutoComplete.Request(address: eircode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var autoCompleteResponse = autoaddressClient.AutoComplete(request);

            Assert.NotNull(autoCompleteResponse);
            Assert.NotNull(autoCompleteResponse.Options);
            Assert.AreEqual(3, autoCompleteResponse.Options.Length);
            Assert.AreEqual("4 INNS COURT, WINETAVERN STREET, DUBLIN 8", autoCompleteResponse.Options[0].DisplayName);
            Assert.AreEqual("AUTOADDRESS, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", autoCompleteResponse.Options[1].DisplayName);
            Assert.AreEqual("GAMMA, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", autoCompleteResponse.Options[2].DisplayName);

            var link = autoCompleteResponse.Options[1].Links.OfType<Model.FindAddress.Link>().First();

            var findAddressResponse = autoaddressClient.FindAddress(link);
            
            Assert.NotNull(findAddressResponse);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.PostcodeAppended, findAddressResponse.Result);
            Assert.AreEqual(eircode, findAddressResponse.Postcode);
            Assert.NotNull(findAddressResponse.PostalAddress);
            Assert.AreEqual(4, findAddressResponse.PostalAddress.Length);
            Assert.AreEqual("AUTOADDRESS", findAddressResponse.PostalAddress[0]);
            Assert.AreEqual("4 INNS COURT", findAddressResponse.PostalAddress[1]);
            Assert.AreEqual("WINETAVERN STREET", findAddressResponse.PostalAddress[2]);
            Assert.AreEqual("DUBLIN 8", findAddressResponse.PostalAddress[3]);
        }
        public void FindAddress_IE_SilverBirchesDunboyne_ReturnsValidResponse()
        {
            const string address = "Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.FindAddress(request);

            Assert.NotNull(response);
            Assert.NotNull(response.Options);
        }
        public void FindAddress_NI_9AvocaCloseBelfast_ReturnsValidResponse()
        {
            const string address = "9 Avoca Close, Belfast";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.NI, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.FindAddress(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.PostcodeAppended, response.Result);
            Assert.AreEqual("BT11 8QT", response.Postcode);
            Assert.NotNull(response.PostalAddress);
            Assert.AreEqual(2, response.PostalAddress.Length);
            Assert.AreEqual("9 AVOCA CLOSE", response.PostalAddress[0]);
            Assert.AreEqual("BELFAST", response.PostalAddress[1]);
        }
        public void FindAddress_IE_TerminalBuildingShannonAirportShannonCoDotClare_geographicAddressEqualsTrue_addressElementsEqualsTrue_ReturnsValidResponse()
        {
            const string address = "Terminal Building, Shannon Airport, Shannon, Co. Clare";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: true, vanityMode: false, addressElements: true, addressProfileName: null);

            var response = autoaddressClient.FindAddress(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.PostcodeAppended, response.Result);
            Assert.AreEqual("V14NX04", response.Postcode);
            Assert.IsNull(response.Unmatched);
            Assert.IsNull(response.UnmatchedAddressElements);
            Assert.NotNull(response.PostalAddress);
            Assert.AreEqual("TERMINAL BUILDING", response.PostalAddress[0]);
            Assert.AreEqual("SHANNON AIRPORT", response.PostalAddress[1]);
            Assert.AreEqual("SHANNON", response.PostalAddress[2]);
            Assert.AreEqual("LIMERICK", response.PostalAddress[3]);
            Assert.NotNull(response.PostalAddressElements);
            Assert.AreEqual(4, response.PostalAddressElements.Length);
            Assert.AreEqual("TERMINAL BUILDING", response.PostalAddressElements[0].Value);
            Assert.AreEqual(AddressElementType.BuildingName, response.PostalAddressElements[0].Type);
            Assert.AreEqual(1401207129, response.PostalAddressElements[0].AddressId);
            Assert.AreEqual("SHANNON AIRPORT", response.PostalAddressElements[1].Value);
            Assert.AreEqual(AddressElementType.RuralLocality, response.PostalAddressElements[1].Type);
            Assert.AreEqual(1110026207, response.PostalAddressElements[1].AddressId);
            Assert.AreEqual("SHANNON", response.PostalAddressElements[2].Value);
            Assert.AreEqual(AddressElementType.Town, response.PostalAddressElements[2].Type);
            Assert.AreEqual(1100000099, response.PostalAddressElements[2].AddressId);
            Assert.AreEqual("LIMERICK", response.PostalAddressElements[3].Value);
            Assert.AreEqual(AddressElementType.City, response.PostalAddressElements[3].Type);
            Assert.AreEqual(1100000030, response.PostalAddressElements[3].AddressId);
            Assert.NotNull(response.GeographicAddress);
            Assert.AreEqual("TERMINAL BUILDING", response.GeographicAddress[0]);
            Assert.AreEqual("SHANNON AIRPORT", response.GeographicAddress[1]);
            Assert.AreEqual("SHANNON", response.GeographicAddress[2]);
            Assert.AreEqual("CO. CLARE", response.GeographicAddress[3]);
            Assert.NotNull(response.GeographicAddressElements);
            Assert.AreEqual(4, response.GeographicAddressElements.Length);
            Assert.AreEqual("TERMINAL BUILDING", response.GeographicAddressElements[0].Value);
            Assert.AreEqual(AddressElementType.BuildingName, response.GeographicAddressElements[0].Type);
            Assert.AreEqual(1401207129, response.GeographicAddressElements[0].AddressId);
            Assert.AreEqual("SHANNON AIRPORT", response.GeographicAddressElements[1].Value);
            Assert.AreEqual(AddressElementType.RuralLocality, response.GeographicAddressElements[1].Type);
            Assert.AreEqual(1110026207, response.GeographicAddressElements[1].AddressId);
            Assert.AreEqual("SHANNON", response.GeographicAddressElements[2].Value);
            Assert.AreEqual(AddressElementType.Town, response.GeographicAddressElements[2].Type);
            Assert.AreEqual(1100000099, response.GeographicAddressElements[2].AddressId);
            Assert.AreEqual("CO. CLARE", response.GeographicAddressElements[3].Value);
            Assert.AreEqual(AddressElementType.County, response.GeographicAddressElements[3].Type);
            Assert.AreEqual(1001000003, response.GeographicAddressElements[3].AddressId);
            Assert.IsNull(response.VanityAddress);
        }
        public void FindAddress_IE_1WoodlandsRoadCabinteelyDublin18_vanityModeEqualsTrue_addressElementsEqualsTrue_ReturnsValidResponse()
        {
            const string address = "1 Woodlands Road, Cabinteely, Dublin 18";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: true, addressElements: true, addressProfileName: null);

            var response = autoaddressClient.FindAddress(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.PostcodeAppended, response.Result);
            Assert.AreEqual("A96E2R8", response.Postcode);
            Assert.IsNull(response.Unmatched);
            Assert.IsNull(response.UnmatchedAddressElements);
            Assert.NotNull(response.PostalAddress);
            Assert.AreEqual("1 WOODLANDS ROAD", response.PostalAddress[0]);
            Assert.AreEqual("GLENAGEARY", response.PostalAddress[1]);
            Assert.AreEqual("CO. DUBLIN", response.PostalAddress[2]);
            Assert.NotNull(response.PostalAddressElements);
            Assert.AreEqual(4, response.PostalAddressElements.Length);
            Assert.AreEqual("1", response.PostalAddressElements[0].Value);
            Assert.AreEqual(AddressElementType.BuildingNumber, response.PostalAddressElements[0].Type);
            Assert.AreEqual(1401042441, response.PostalAddressElements[0].AddressId);
            Assert.AreEqual("WOODLANDS ROAD", response.PostalAddressElements[1].Value);
            Assert.AreEqual(AddressElementType.Thoroughfare, response.PostalAddressElements[1].Type);
            Assert.AreEqual(1200029775, response.PostalAddressElements[1].AddressId);
            Assert.AreEqual("GLENAGEARY", response.PostalAddressElements[2].Value);
            Assert.AreEqual(AddressElementType.Town, response.PostalAddressElements[2].Type);
            Assert.AreEqual(1100000090, response.PostalAddressElements[2].AddressId);
            Assert.AreEqual("CO. DUBLIN", response.PostalAddressElements[3].Value);
            Assert.AreEqual(AddressElementType.County, response.PostalAddressElements[3].Type);
            Assert.AreEqual(1001000025, response.PostalAddressElements[3].AddressId);
            Assert.NotNull(response.VanityAddress);
            Assert.AreEqual("1 Woodlands Road", response.VanityAddress[0]);
            Assert.AreEqual("Cabinteely", response.VanityAddress[1]);
            Assert.AreEqual("Dublin 18", response.VanityAddress[2]);
            Assert.NotNull(response.VanityAddressElements);
            Assert.AreEqual(4, response.VanityAddressElements.Length);
            Assert.AreEqual("1", response.VanityAddressElements[0].Value);
            Assert.AreEqual(AddressElementType.BuildingNumber, response.VanityAddressElements[0].Type);
            Assert.AreEqual(1401042441, response.VanityAddressElements[0].AddressId);
            Assert.AreEqual("Woodlands Road", response.VanityAddressElements[1].Value);
            Assert.AreEqual(AddressElementType.Thoroughfare, response.VanityAddressElements[1].Type);
            Assert.AreEqual(1200029775, response.VanityAddressElements[1].AddressId);
            Assert.AreEqual("Cabinteely", response.VanityAddressElements[2].Value);
            Assert.AreEqual(AddressElementType.UrbanArea, response.VanityAddressElements[2].Type);
            Assert.AreEqual(1110029573, response.VanityAddressElements[2].AddressId);
            Assert.AreEqual("Dublin 18", response.VanityAddressElements[3].Value);
            Assert.AreEqual(AddressElementType.DublinPostalArea, response.VanityAddressElements[3].Type);
            Assert.AreEqual(1100000017, response.VanityAddressElements[3].AddressId);
        }
        public void FindAddress_IE_SilverBirchesDunboyneThenSelectSelfLink_ReturnsValidResponses()
        {
            const string address = "Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var firstResponse = autoaddressClient.FindAddress(request);

            Assert.NotNull(firstResponse);
            Assert.NotNull(firstResponse.Links);
            Assert.Greater(firstResponse.Links.Length, 0);
            var link = firstResponse.Links.OfType<Model.FindAddress.Link>().First();

            var secondResponse = autoaddressClient.FindAddress(link);

            Assert.NotNull(secondResponse);
            Assert.AreEqual(firstResponse.Result, secondResponse.Result);
            Assert.AreEqual(firstResponse.AddressId, secondResponse.AddressId);
        }
        public void FindAddress_IE_SilverBirchesDunboyneThenSelectFirstOption_ReturnsValidResponses()
        {
            const string address = "Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress.Autoaddress2_0.Model.FindAddress.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var firstResponse = autoaddressClient.FindAddress(request);

            Assert.NotNull(firstResponse);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.IncompleteAddressEntered, firstResponse.Result);
            Assert.NotNull(firstResponse.Options);
            var option = firstResponse.Options[0];
            var nextLink = option.Links.OfType<Model.FindAddress.Link>().First();

            var secondResponse = autoaddressClient.FindAddress(nextLink);
            Assert.NotNull(secondResponse);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.FindAddress.ReturnCode.IncompleteAddressEntered, secondResponse.Result);
            Assert.NotNull(secondResponse.Options);
        }