Esempio n. 1
0
        public static void Run()
        {
            const string postcode          = "D02C966";
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);
            var          request           = new Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response1 = autoaddressClient.PostcodeLookup(request);

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

            var response2 = autoaddressClient.PostcodeLookup(response1.Options[2].Links.OfType <Model.PostcodeLookup.Link>().First());

            Console.WriteLine("response2.Result = {0}", response2.Result);
            Console.WriteLine("response2.MatchLevel = {0}", response2.MatchLevel);
            Console.WriteLine("response2.AddressType = {0}", response2.AddressType);
            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 Main()
        {
            const string postcode = "D08XY00";
            var autoaddressClient = new AutoaddressClient();
            var request = new Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response1 = autoaddressClient.PostcodeLookup(request);

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

            var response2 = autoaddressClient.PostcodeLookup(response1.Options[2].Links.OfType<Model.PostcodeLookup.Link>().First());
            
            Console.WriteLine("response2.Result = {0}", response2.Result);
            Console.WriteLine("response2.MatchLevel = {0}", response2.MatchLevel);
            Console.WriteLine("response2.AddressType = {0}", response2.AddressType);
            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 Main()
        {
            const int ecadId = 1200003223;
            var autoaddressClient = new AutoaddressClient();
            var request = new Request(ecadId);

            var response = autoaddressClient.GetEcadData(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.EcadId = {0}", response.EcadId);
            Console.WriteLine("response.PostalAddress.English = {0}", string.Join(",", response.PostalAddress.English));
            Console.WriteLine("response.PostalAddress.Irish = {0}", string.Join(",", response.PostalAddress.Irish));
            Console.WriteLine("response.SpatialInfo.Etrs89.Location.Longitude = {0}", response.SpatialInfo.Etrs89.Location.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.Location.Latitude = {0}", response.SpatialInfo.Etrs89.Location.Latitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude);
            Console.WriteLine("response.SpatialInfo.Ing.Location.Easting = {0}", response.SpatialInfo.Ing.Location.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.Location.Northing = {0}", response.SpatialInfo.Ing.Location.Northing);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Min.Easting = {0}", response.SpatialInfo.Ing.BoundingBox.Min.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Min.Northing = {0}", response.SpatialInfo.Ing.BoundingBox.Min.Northing);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Max.Easting = {0}", response.SpatialInfo.Ing.BoundingBox.Max.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Max.Northing = {0}", response.SpatialInfo.Ing.BoundingBox.Max.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.Location.Easting = {0}", response.SpatialInfo.Itm.Location.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.Location.Northing = {0}", response.SpatialInfo.Itm.Location.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Min.Easting = {0}", response.SpatialInfo.Itm.BoundingBox.Min.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Min.Northing = {0}", response.SpatialInfo.Itm.BoundingBox.Min.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Max.Easting = {0}", response.SpatialInfo.Itm.BoundingBox.Max.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Max.Northing = {0}", response.SpatialInfo.Itm.BoundingBox.Max.Northing);
        }
Esempio n. 4
0
        public static async void Run()
        {
            const int ecadId            = 1200003223;
            var       autoaddressClient = new AutoaddressClient(Settings.Licence.Key);
            var       request           = new Request(ecadId, false);

            var response = await autoaddressClient.GetEcadDataAsync(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.EcadId = {0}", response.EcadId);
            Console.WriteLine("response.PostalAddress.English = {0}", string.Join(",", response.PostalAddress.English));
            Console.WriteLine("response.PostalAddress.Irish = {0}", string.Join(",", response.PostalAddress.Irish));
            Console.WriteLine("response.SpatialInfo.Etrs89.Location.Longitude = {0}", response.SpatialInfo.Etrs89.Location.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.Location.Latitude = {0}", response.SpatialInfo.Etrs89.Location.Latitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude);
            Console.WriteLine("response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude = {0}", response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude);
            Console.WriteLine("response.SpatialInfo.Ing.Location.Easting = {0}", response.SpatialInfo.Ing.Location.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.Location.Northing = {0}", response.SpatialInfo.Ing.Location.Northing);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Min.Easting = {0}", response.SpatialInfo.Ing.BoundingBox.Min.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Min.Northing = {0}", response.SpatialInfo.Ing.BoundingBox.Min.Northing);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Max.Easting = {0}", response.SpatialInfo.Ing.BoundingBox.Max.Easting);
            Console.WriteLine("response.SpatialInfo.Ing.BoundingBox.Max.Northing = {0}", response.SpatialInfo.Ing.BoundingBox.Max.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.Location.Easting = {0}", response.SpatialInfo.Itm.Location.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.Location.Northing = {0}", response.SpatialInfo.Itm.Location.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Min.Easting = {0}", response.SpatialInfo.Itm.BoundingBox.Min.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Min.Northing = {0}", response.SpatialInfo.Itm.BoundingBox.Min.Northing);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Max.Easting = {0}", response.SpatialInfo.Itm.BoundingBox.Max.Easting);
            Console.WriteLine("response.SpatialInfo.Itm.BoundingBox.Max.Northing = {0}", response.SpatialInfo.Itm.BoundingBox.Max.Northing);
        }
        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);
        }
Esempio n. 6
0
        public static async 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 response = await autoaddressClient.AutoCompleteAsync(request);

            Console.WriteLine("response.TotalOptions = {0}", response.TotalOptions);
            Console.WriteLine("response.Options[0].DisplayName = {0}", response.Options[0].DisplayName);
        }
        public static async 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 response = await autoaddressClient.AutoCompleteAsync(request);

            Console.WriteLine("response.TotalOptions = {0}", response.TotalOptions);
            Console.WriteLine("response.Options[0].DisplayName = {0}", response.Options[0].DisplayName);
        }
        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 = "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));
        }
Esempio n. 10
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 async Task Main()
        {
            const string postcode = "BT11 8QT";
            var autoaddressClient = new AutoaddressClient();
            var request = new Request(postcode);

            var response = await autoaddressClient.GetGbPostcodeDataAsync(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.SpatialInfo.Wgs84.Location.Longitude = {0}", response.SpatialInfo.Wgs84.Location.Longitude);
            Console.WriteLine("response.SpatialInfo.Wgs84.Location.Latitude = {0}", response.SpatialInfo.Wgs84.Location.Latitude);
        }
Esempio n. 12
0
        public static void Run()
        {
            const string postcode          = "BT11 8QT";
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);
            var          request           = new Request(postcode);

            var response = autoaddressClient.GetGbPostcodeData(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.SpatialInfo.Wgs84.Location.Longitude = {0}", response.SpatialInfo.Wgs84.Location.Longitude);
            Console.WriteLine("response.SpatialInfo.Wgs84.Location.Latitude = {0}", response.SpatialInfo.Wgs84.Location.Latitude);
        }
Esempio n. 13
0
        public static async void Run()
        {
            const double longitude         = -6.271796;
            const double latitude          = 53.343761;
            const double maxDistance       = 100;
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);
            var          request           = new Autoaddress2_0.Model.ReverseGeocode.Request(latitude: latitude, longitude: longitude, maxDistance: maxDistance, language: Language.EN, country: Country.IE, geographicAddress: false, vanityMode: true, addressProfileName: null);

            var response = await autoaddressClient.ReverseGeocodeAsync(request);

            Console.WriteLine("response.Hits[0].AddressId = {0}", response.Hits[0].AddressId);
            Console.WriteLine("response.Hits[0].PostalAddress = {0}", string.Join(",", response.Hits[0].PostalAddress));
            Console.WriteLine("response.Hits[0].VanityAddress = {0}", string.Join(",", response.Hits[0].VanityAddress));
        }
        public static async void Main()
        {
            const double longitude = -6.271796;
            const double latitude = 53.343761;
            const double maxDistance = 100;
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.ReverseGeocode.Request(latitude: latitude, longitude: longitude, maxDistance: maxDistance, language: Language.EN, country: Country.IE, geographicAddress: false, vanityMode: true, addressProfileName: null);

            var response = await autoaddressClient.ReverseGeocodeAsync(request);

            Console.WriteLine("response.Hits[0].AddressId = {0}", response.Hits[0].AddressId);
            Console.WriteLine("response.Hits[0].PostalAddress = {0}", string.Join(",", response.Hits[0].PostalAddress));
            Console.WriteLine("response.Hits[0].VanityAddress = {0}", string.Join(",", response.Hits[0].VanityAddress));
        }
Esempio n. 15
0
        public static void Run()
        {
            const string postcode          = "A86VC04";
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);
            var          request           = new Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.PostcodeLookup(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.MatchLevel = {0}", response.MatchLevel);
            Console.WriteLine("response.AddressType = {0}", response.AddressType);
            Console.WriteLine("response.AddressId = {0}", response.AddressId);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.PostalAddress = {0}", string.Join(",", response.PostalAddress));
        }
        public static void Main()
        {
            const string postcode = "A86VC04";
            var autoaddressClient = new AutoaddressClient();
            var request = new Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.PostcodeLookup(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.MatchLevel = {0}", response.MatchLevel);
            Console.WriteLine("response.AddressType = {0}", response.AddressType);
            Console.WriteLine("response.AddressId = {0}", response.AddressId);
            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 async void MainAsync()
        {
            const string address           = "8 Silver Birches, Dunboyne";
            const string postcode          = "A86VC04";
            var          autoaddressClient = new AutoaddressClient(Settings.Licence.Key);

            var request  = new Request(postcode: postcode, address: address, language: Language.EN, country: Country.IE, geographicAddress: false, vanityMode: false);
            var response = await autoaddressClient.VerifyAddressAsync(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.MatchLevel = {0}", response.MatchLevel);
            Console.WriteLine("response.AddressType = {0}", response.AddressType);
            Console.WriteLine("response.AddressId = {0}", response.AddressId);
            Console.WriteLine("response.Postcode = {0}", response.Postcode);
            Console.WriteLine("response.PostalAddress = {0}", string.Join(",", response.PostalAddress));
        }
        public static void Main()
        {
            const string address = "8 Silver Birches, Dunboyne";
            const string postcode = "A86VC04";
            var autoaddressClient = new AutoaddressClient();

            var request = new Request(postcode: postcode, address: address, language: Language.EN, country: Country.IE, geographicAddress: false, vanityMode: false);
            var response = autoaddressClient.VerifyAddress(request);

            Console.WriteLine("response.Result = {0}", response.Result);
            Console.WriteLine("response.MatchLevel = {0}", response.MatchLevel);
            Console.WriteLine("response.AddressType = {0}", response.AddressType);
            Console.WriteLine("response.AddressId = {0}", response.AddressId);
            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 static async void MainAsync()
        {
            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 = await autoaddressClient.FindAddressAsync(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 = await autoaddressClient.FindAddressAsync(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));
        }
        public void PostcodeLookup_IE_D08XY00_ReturnsValidResponse()
        {
            const string postcode = "D08XY00";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.PostcodeLookup(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.PostcodeLookup.ReturnCode.ValidPostcode, response.Result);
            Assert.AreEqual(postcode, response.Postcode);
            Assert.NotNull(response.PostalAddress);
            Assert.AreEqual(3, response.PostalAddress.Length);
            Assert.AreEqual("4 INNS COURT", response.PostalAddress[0]);
            Assert.AreEqual("WINETAVERN STREET", response.PostalAddress[1]);
            Assert.AreEqual("DUBLIN 8", response.PostalAddress[2]);
            Assert.IsNotNull(response.Options);
            Assert.AreEqual(3, response.Options.Length);
            Assert.AreEqual("4 INNS COURT, WINETAVERN STREET, DUBLIN 8", response.Options[0].DisplayName);
            Assert.AreEqual("AUTOADDRESS, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", response.Options[1].DisplayName);
            Assert.AreEqual("GAMMA, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", response.Options[2].DisplayName);
        }
        public void PostcodeLookup_IE_F94H289_ReturnsValidResponse()
        {
            const string postcode = "F94H289";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.PostcodeLookup(request);

            Assert.IsNotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.PostcodeLookup.ReturnCode.RetiredPostcode, response.Result);
            Assert.AreEqual("F94H289", response.Postcode);
            Assert.AreEqual(MatchLevel.Unknown, response.MatchLevel);
            Assert.IsNull(response.AddressType);
            Assert.IsNull(response.AddressId);
            Assert.IsNull(response.AddressType);
            Assert.IsNull(response.PostalAddress);
            Assert.IsNull(response.PostalAddressElements);
            Assert.IsNull(response.VanityAddress);
            Assert.IsNull(response.VanityAddressElements);
            Assert.IsNull(response.ReformattedAddressResult);
            Assert.IsNull(response.ReformattedAddress);
            Assert.AreEqual(0, response.TotalOptions);
            Assert.IsNotNull(response.Options);
            Assert.AreEqual(0, response.Options.Length);
        }
        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 async Task PostcodeLookupAsync_IE_D08XY00ThenSelectGammaFromOptions_ReturnsValidResponses()
        {
            const string postcode = "D08XY00";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var firstResponse = await autoaddressClient.PostcodeLookupAsync(request);

            Assert.NotNull(firstResponse);
            Assert.AreEqual(Autoaddress2_0.Model.PostcodeLookup.ReturnCode.ValidPostcode, firstResponse.Result);
            Assert.AreEqual(postcode, firstResponse.Postcode);
            Assert.NotNull(firstResponse.PostalAddress);
            Assert.AreEqual(3, firstResponse.PostalAddress.Length);
            Assert.AreEqual("4 INNS COURT", firstResponse.PostalAddress[0]);
            Assert.AreEqual("WINETAVERN STREET", firstResponse.PostalAddress[1]);
            Assert.AreEqual("DUBLIN 8", firstResponse.PostalAddress[2]);
            Assert.IsNotNull(firstResponse.Options);
            Assert.AreEqual(3, firstResponse.Options.Length);
            Assert.AreEqual("4 INNS COURT, WINETAVERN STREET, DUBLIN 8", firstResponse.Options[0].DisplayName);
            Assert.AreEqual("AUTOADDRESS, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", firstResponse.Options[1].DisplayName);
            Assert.AreEqual("GAMMA, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", firstResponse.Options[2].DisplayName);
            Assert.NotNull(firstResponse.Options[2].Links);
            Assert.Greater(firstResponse.Options[2].Links.Length, 0);
            Assert.NotNull(firstResponse.Options[2].Links[0]);

            var secondResponse = await autoaddressClient.PostcodeLookupAsync(firstResponse.Options[2].Links.OfType<Model.PostcodeLookup.Link>().First());
            Assert.AreEqual(Autoaddress2_0.Model.PostcodeLookup.ReturnCode.ValidPostcode, firstResponse.Result);
            Assert.AreEqual(postcode, firstResponse.Postcode);
            Assert.AreEqual(AddressType.Organisation, secondResponse.AddressType);
        }
        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 async Task GetEcadDataAsync_1701984269_ReturnsValidResponse()
        {
            const int ecadId = 1701984269;
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.GetEcadData.Request(ecadId);

            var response = await autoaddressClient.GetEcadDataAsync(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.GetEcadData.ReturnCode.EcadIdValid, response.Result);
            Assert.AreEqual(ecadId, response.EcadId);
            Assert.AreEqual(2150, response.AddressTypeId);
            Assert.NotNull(response.EircodeInfo);
            Assert.AreEqual(ecadId, response.EircodeInfo.EcadId);
            Assert.AreEqual("A86VC04", response.EircodeInfo.Eircode);
            Assert.NotNull(response.PostalAddress);
            Assert.NotNull(response.PostalAddress.English);
            Assert.AreEqual(4, response.PostalAddress.English.Length);
            Assert.AreEqual("8 SILVER BIRCHES", response.PostalAddress.English[0]);
            Assert.AreEqual("MILLFARM", response.PostalAddress.English[1]);
            Assert.AreEqual("DUNBOYNE", response.PostalAddress.English[2]);
            Assert.AreEqual("CO. MEATH", response.PostalAddress.English[3]);
            Assert.NotNull(response.PostalAddress.Irish);
            Assert.AreEqual(4, response.PostalAddress.Irish.Length);
            Assert.AreEqual("8 NA BEITHEANNA GEALA", response.PostalAddress.Irish[0]);
            Assert.AreEqual("FEIRM AN MHUILINN", response.PostalAddress.Irish[1]);
            Assert.AreEqual("DÚN BÚINNE", response.PostalAddress.Irish[2]);
            Assert.AreEqual("CO. NA MÍ", response.PostalAddress.Irish[3]);
            Assert.NotNull(response.AdministrativeInfo);
            Assert.AreEqual(1400247786, response.AdministrativeInfo.EcadId);
            Assert.AreEqual(16, response.AdministrativeInfo.LaId);
            Assert.AreEqual(167029, response.AdministrativeInfo.DedId);
            Assert.AreEqual(14588, response.AdministrativeInfo.SmallAreaId);
            Assert.AreEqual(160648, response.AdministrativeInfo.TownlandId);
            Assert.AreEqual(1001000020, response.AdministrativeInfo.CountyId);
            Assert.AreEqual(false, response.AdministrativeInfo.Gaeltacht);
            Assert.NotNull(response.BuildingInfo);
            Assert.AreEqual(1400247786, response.BuildingInfo.EcadId);
            Assert.AreEqual(1, response.BuildingInfo.BuildingTypeId);
            Assert.AreEqual(false, response.BuildingInfo.UnderConstruction);
            Assert.AreEqual("R", response.BuildingInfo.BuildingUse);
            Assert.AreEqual(false, response.BuildingInfo.Vacant);
            Assert.AreEqual(null, response.BuildingInfo.HolidayHome);
            Assert.IsNull(response.OrganisationInfo);
            Assert.NotNull(response.SpatialInfo);
            Assert.NotNull(response.SpatialInfo.Etrs89);
            Assert.NotNull(response.SpatialInfo.Etrs89.Location);
            Assert.Greater(response.SpatialInfo.Etrs89.Location.Latitude, 0);
            Assert.Less(response.SpatialInfo.Etrs89.Location.Longitude, 0);
            Assert.IsNull(response.SpatialInfo.Etrs89.BoundingBox);
            Assert.NotNull(response.SpatialInfo.Ing);
            Assert.NotNull(response.SpatialInfo.Ing.Location);
            Assert.Greater(response.SpatialInfo.Ing.Location.Easting, 0);
            Assert.Greater(response.SpatialInfo.Ing.Location.Northing, 0);
            Assert.IsNull(response.SpatialInfo.Ing.BoundingBox);
            Assert.NotNull(response.SpatialInfo.Itm);
            Assert.NotNull(response.SpatialInfo.Itm.Location);
            Assert.Greater(response.SpatialInfo.Itm.Location.Easting, 0);
            Assert.Greater(response.SpatialInfo.Itm.Location.Northing, 0);
            Assert.IsNull(response.SpatialInfo.Itm.BoundingBox);
            Assert.AreEqual("3", response.SpatialInfo.SpatialAccuracy);
            Assert.IsNotNull(response.RelatedEcadIds);
            Assert.IsNotNull(response.RelatedEcadIds.GeographicCountyEcadIds);
            Assert.AreEqual(1, response.RelatedEcadIds.GeographicCountyEcadIds.Length);
            Assert.AreEqual(1001000020, response.RelatedEcadIds.GeographicCountyEcadIds[0]);
        }
        public void PostcodeLookup_IE_Y35F9KX_ReturnsValidResponse()
        {
            const string postcode = "Y35F9KX";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = autoaddressClient.PostcodeLookup(request);

            Assert.IsNotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.PostcodeLookup.ReturnCode.ChangedPostcode, response.Result);
            Assert.NotNull(response.Postcode);
            Assert.AreEqual("Y35TD51", response.Postcode);
            Assert.AreEqual(1702151625, response.AddressId);
            Assert.AreEqual(MatchLevel.AddressPoint, response.MatchLevel);
            Assert.AreEqual(AddressType.ResidentialAddressPoint, response.AddressType);
            Assert.IsNotNull(response.PostalAddress);
            Assert.AreEqual(3, response.PostalAddress.Length);
            Assert.AreEqual("22 HILLCREST", response.PostalAddress[0]);
            Assert.AreEqual("MULGANNON", response.PostalAddress[1]);
            Assert.AreEqual("WEXFORD", response.PostalAddress[2]);
            Assert.IsNull(response.PostalAddressElements);
            Assert.IsNull(response.VanityAddress);
            Assert.IsNull(response.VanityAddressElements);
            Assert.AreEqual(0, response.TotalOptions);
            Assert.IsNotNull(response.Options);
            Assert.AreEqual(0, response.Options.Length);
        }
        public void GetEcadData_1200003223_ReturnsValidResponse()
        {
            const int ecadId = 1200003223;
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.GetEcadData.Request(ecadId);

            var response = autoaddressClient.GetEcadData(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.GetEcadData.ReturnCode.EcadIdValid, response.Result);
            Assert.AreEqual(ecadId, response.EcadId);
            Assert.AreEqual(3100, response.AddressTypeId);
            Assert.IsNull(response.EircodeInfo);
            Assert.NotNull(response.PostalAddress);
            Assert.NotNull(response.PostalAddress.English);
            Assert.AreEqual(2, response.PostalAddress.English.Length);
            Assert.AreEqual("DAME STREET", response.PostalAddress.English[0]);
            Assert.AreEqual("DUBLIN 2", response.PostalAddress.English[1]);
            Assert.NotNull(response.PostalAddress.Irish);
            Assert.AreEqual(2, response.PostalAddress.Irish.Length);
            Assert.AreEqual("SRÁID AN DÁMA", response.PostalAddress.Irish[0]);
            Assert.AreEqual("BAILE ÁTHA CLIATH 2", response.PostalAddress.Irish[1]);
            Assert.IsNotNull(response.AdministrativeInfo);
            Assert.AreEqual(ecadId, response.AdministrativeInfo.EcadId);
            Assert.AreEqual(268140, response.AdministrativeInfo.DedId);
            Assert.AreEqual(false, response.AdministrativeInfo.Gaeltacht);
            Assert.AreEqual(29, response.AdministrativeInfo.LaId);
            Assert.IsNull(response.AdministrativeInfo.SmallAreaId);
            Assert.IsNull(response.AdministrativeInfo.TownlandId);
            Assert.AreEqual(1001000025, response.AdministrativeInfo.CountyId);
            Assert.IsNull(response.BuildingInfo);
            Assert.IsNull(response.OrganisationInfo);
            Assert.NotNull(response.SpatialInfo);
            Assert.AreEqual(ecadId, response.SpatialInfo.EcadId);
            Assert.NotNull(response.SpatialInfo.Etrs89);
            Assert.NotNull(response.SpatialInfo.Etrs89.Location);
            Assert.Greater(response.SpatialInfo.Etrs89.Location.Latitude, 0);
            Assert.Less(response.SpatialInfo.Etrs89.Location.Longitude, 0);
            Assert.NotNull(response.SpatialInfo.Etrs89.BoundingBox);
            Assert.NotNull(response.SpatialInfo.Etrs89.BoundingBox.Min);
            Assert.NotNull(response.SpatialInfo.Etrs89.BoundingBox.Max);
            Assert.Greater(response.SpatialInfo.Etrs89.BoundingBox.Min.Latitude, 0);
            Assert.Less(response.SpatialInfo.Etrs89.BoundingBox.Min.Longitude, 0);
            Assert.Greater(response.SpatialInfo.Etrs89.BoundingBox.Max.Latitude, 0);
            Assert.Less(response.SpatialInfo.Etrs89.BoundingBox.Max.Longitude, 0);
            Assert.NotNull(response.SpatialInfo.Ing);
            Assert.NotNull(response.SpatialInfo.Etrs89.Location);
            Assert.Greater(response.SpatialInfo.Etrs89.Location.Latitude, 0);
            Assert.Less(response.SpatialInfo.Etrs89.Location.Longitude, 0);
            Assert.NotNull(response.SpatialInfo.Ing);
            Assert.NotNull(response.SpatialInfo.Ing.BoundingBox);
            Assert.NotNull(response.SpatialInfo.Ing.BoundingBox.Min);
            Assert.NotNull(response.SpatialInfo.Ing.BoundingBox.Max);
            Assert.Greater(response.SpatialInfo.Ing.BoundingBox.Min.Easting, 0);
            Assert.Greater(response.SpatialInfo.Ing.BoundingBox.Min.Northing, 0);
            Assert.Greater(response.SpatialInfo.Ing.BoundingBox.Max.Easting, 0);
            Assert.Greater(response.SpatialInfo.Ing.BoundingBox.Max.Northing, 0);
            Assert.NotNull(response.SpatialInfo.Itm);
            Assert.NotNull(response.SpatialInfo.Itm.BoundingBox);
            Assert.NotNull(response.SpatialInfo.Itm.BoundingBox.Min);
            Assert.NotNull(response.SpatialInfo.Itm.BoundingBox.Max);
            Assert.Greater(response.SpatialInfo.Itm.BoundingBox.Min.Easting, 0);
            Assert.Greater(response.SpatialInfo.Itm.BoundingBox.Min.Northing, 0);
            Assert.Greater(response.SpatialInfo.Itm.BoundingBox.Max.Easting, 0);
            Assert.Greater(response.SpatialInfo.Itm.BoundingBox.Max.Northing, 0);
            Assert.AreEqual("3", response.SpatialInfo.SpatialAccuracy);
            Assert.IsNotNull(response.RelatedEcadIds);
        }
        public void GetEcadData_1701984269ThenSelectSelfLink_ReturnsValidResponses()
        {
            const int ecadId = 1701984269;
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.GetEcadData.Request(ecadId);

            var firstResponse = autoaddressClient.GetEcadData(request);

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

            var secondResponse = autoaddressClient.GetEcadData(link);

            Assert.NotNull(secondResponse);
            Assert.AreEqual(firstResponse.Result, secondResponse.Result);
            Assert.AreEqual(firstResponse.EcadId, secondResponse.EcadId);
        }
        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 async Task VerifyAddressAsync_IE_8SilverBirchesDunboyneA86VC04_ReturnsValidResponse()
        {
            const string address = "8 Silver Birches, Dunboyne";
            const string postcode = "A86VC04";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.VerifyAddress.Request(postcode: postcode, address: address, language: Language.EN, country: Country.IE, geographicAddress: false, vanityMode: false);

            var response = await autoaddressClient.VerifyAddressAsync(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.VerifyAddress.ReturnCode.AddressAndEircodeMatch, response.Result);
            Assert.AreEqual(postcode, response.Postcode);
            Assert.NotNull(response.PostalAddress);
            Assert.AreEqual(4, response.PostalAddress.Length);
            Assert.AreEqual("8 SILVER BIRCHES", response.PostalAddress[0]);
            Assert.AreEqual("MILLFARM", response.PostalAddress[1]);
            Assert.AreEqual("DUNBOYNE", response.PostalAddress[2]);
            Assert.AreEqual("CO. MEATH", response.PostalAddress[3]);
        }
        public void PostcodeLookup_IE_A86VC04ThenSelectSelfLink_ReturnsValidResponse()
        {
            const string postcode = "A86VC04";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

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

            var secondResponse = autoaddressClient.PostcodeLookup(link);

            Assert.NotNull(secondResponse);
            Assert.AreEqual(firstResponse.Result, secondResponse.Result);
            Assert.AreEqual(firstResponse.AddressId, secondResponse.AddressId);
        }
        public void PostcodeLookup_IE_A96E2R8_vanityModeEqualsTrue_addressElementsEqualsTrue_ReturnsValidResponse()
        {
            const string postcode = "A96E2R8";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: true, addressElements: true, addressProfileName: null);

            var response = autoaddressClient.PostcodeLookup(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress.Autoaddress2_0.Model.PostcodeLookup.ReturnCode.ValidPostcode, response.Result);
            Assert.AreEqual("A96E2R8", response.Postcode);
            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("Dun Laoghaire", response.VanityAddress[1]);
            Assert.AreEqual("Co. Dublin", 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("Dun Laoghaire", response.VanityAddressElements[2].Value);
            Assert.AreEqual(AddressElementType.Locality, response.VanityAddressElements[2].Type);
            Assert.AreEqual(1100000131, response.VanityAddressElements[2].AddressId);
            Assert.AreEqual("Co. Dublin", response.VanityAddressElements[3].Value);
            Assert.AreEqual(AddressElementType.County, response.VanityAddressElements[3].Type);
            Assert.AreEqual(1001000025, response.VanityAddressElements[3].AddressId);
        }
        public async Task AutoCompleteAsync_IE_SilverBirchesDunboyne_ReturnsValidResponse()
        {
            const string address = "Silver Birches, Dunboyne";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.AutoComplete.Request(address: address, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = await autoaddressClient.AutoCompleteAsync(request);

            Assert.NotNull(response);
            Assert.NotNull(response.Options);
            Assert.AreEqual(1, response.Options.Length);
            Assert.AreEqual("SILVER BIRCHES, MILLFARM, DUNBOYNE, CO. MEATH", response.Options[0].DisplayName);
        }
        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 async Task AutoCompleteAsync_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 response = await autoaddressClient.AutoCompleteAsync(request);

            Assert.NotNull(response);
            Assert.NotNull(response.Options);
            Assert.AreEqual(3, response.Options.Length);
            Assert.AreEqual("4 INNS COURT, WINETAVERN STREET, DUBLIN 8", response.Options[0].DisplayName);
            Assert.AreEqual("AUTOADDRESS, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", response.Options[1].DisplayName);
            Assert.AreEqual("GAMMA, 4 INNS COURT, WINETAVERN STREET, DUBLIN 8", response.Options[2].DisplayName);
        }
        public void VerifyAddress_IE_8SilverBirchesDunboyneA86VC04ThenSelectSelfLink_ReturnsValidResponse()
        {
            const string address = "8 Silver Birches, Dunboyne";
            const string postcode = "A86VC04";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.VerifyAddress.Request(postcode: postcode, address: address, language: Language.EN, country: Country.IE, geographicAddress: false, vanityMode: false);

            var firstResponse = autoaddressClient.VerifyAddress(request);

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

            var secondResponse = autoaddressClient.VerifyAddress(link);

            Assert.NotNull(secondResponse);
            Assert.AreEqual(firstResponse.Result, secondResponse.Result);
            Assert.AreEqual(firstResponse.AddressId, secondResponse.AddressId);
        }
        public async Task PostcodeLookupAsync_IE_A86VC04_ReturnsValidResponse()
        {
            const string postcode = "A86VC04";
            var autoaddressClient = new AutoaddressClient();
            var request = new Autoaddress2_0.Model.PostcodeLookup.Request(postcode: postcode, language: Language.EN, country: Country.IE, limit: 20, geographicAddress: false, vanityMode: false, addressElements: false, addressProfileName: null);

            var response = await autoaddressClient.PostcodeLookupAsync(request);

            Assert.NotNull(response);
            Assert.AreEqual(Autoaddress2_0.Model.PostcodeLookup.ReturnCode.ValidPostcode, response.Result);
            Assert.AreEqual(postcode, response.Postcode);
            Assert.NotNull(response.PostalAddress);
            Assert.AreEqual(4, response.PostalAddress.Length);
            Assert.AreEqual("8 SILVER BIRCHES", response.PostalAddress[0]);
            Assert.AreEqual("MILLFARM", response.PostalAddress[1]);
            Assert.AreEqual("DUNBOYNE", response.PostalAddress[2]);
            Assert.AreEqual("CO. MEATH", response.PostalAddress[3]);
        }