diff --git a/src/World.Net.UnitTests/AssertCountryTestBase.cs b/src/World.Net.UnitTests/AssertCountryTestBase.cs new file mode 100644 index 0000000..7eb84e7 --- /dev/null +++ b/src/World.Net.UnitTests/AssertCountryTestBase.cs @@ -0,0 +1,41 @@ +namespace World.Net.UnitTests +{ + public abstract class AssertCountryTestBase + { + protected static void AssertCorrectInformation( + ICountry country, + CountryIdentifier expectedId, + string expectedName, + string expectedOfficialName, + string expectedNativeName, + string expectedCapital, + int expectedNumericCode, + string expectedISO2Code, + string expectedISO3Code, + string[] expectedCallingCode, + (string Name, string IsoCode, string Type)[] expectedStates) + { + Assert.NotNull(country); + Assert.Equal(expectedId, country.Id); + Assert.Equal(expectedName, country.Name); + Assert.Equal(expectedOfficialName, country.OfficialName); + Assert.Equal(expectedNativeName, country.NativeName); + Assert.Equal(expectedCapital, country.Capital); + Assert.Equal(expectedNumericCode, country.NumericCode); + Assert.Equal(expectedISO2Code, country.ISO2Code); + Assert.Equal(expectedISO3Code, country.ISO3Code); + Assert.Equal(expectedCallingCode, country.CallingCode); + Assert.NotNull(country.States); + + var states = country.States.ToArray(); + Assert.Equal(expectedStates.Length, states.Length); + + for (int i = 0; i < states.Length; i++) + { + Assert.Equal(expectedStates[i].Name, states[i].Name); + Assert.Equal(expectedStates[i].IsoCode, states[i].IsoCode); + Assert.Equal(expectedStates[i].Type, states[i].Type); + } + } + } +} diff --git a/src/World.Net.UnitTests/Countries/FinlandTest.cs b/src/World.Net.UnitTests/Countries/FinlandTest.cs index 3b223c5..57afd0d 100644 --- a/src/World.Net.UnitTests/Countries/FinlandTest.cs +++ b/src/World.Net.UnitTests/Countries/FinlandTest.cs @@ -1,6 +1,6 @@ namespace World.Net.UnitTests.Countries; -public sealed class FinlandTest +public sealed class FinlandTest : AssertCountryTestBase { private const string FINLAND_COUNTRY_NAME = "Finland"; private const string FINLAND_NATIVE_NAME = "Suomen tasavalta / Republiken Finland"; @@ -10,32 +10,53 @@ public sealed class FinlandTest private const string FINLAND_ISO3_CODE = "FIN"; private const int FINLAND_NUMERIC_CODE = 246; private readonly string[] FINLAND_CALLING_CODE = ["+358"]; - private const int FINLAND_STATE_COUNT = 21; - private static readonly string[] VALID_STATE_TYPES = { "Region" }; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Finland; + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Åland", "FI-01", "Region"), + new("Central Finland", "FI-08", "Region"), + new("Central Ostrobothnia", "FI-07", "Region"), + new("Etelä-Karjala", "FI-02", "Region"), + new("Etelä-Pohjanmaa", "FI-03", "Region"), + new("Etelä-Savo", "FI-04", "Region"), + new("Kainuu", "FI-05", "Region"), + new("Kanta-Häme", "FI-06", "Region"), + new("Keski-Pohjanmaa", "FI-09", "Region"), + new("Keski-Suomi", "FI-10", "Region"), + new("Kymenlaakso", "FI-11", "Region"), + new("Lappi", "FI-12", "Region"), + new("Pirkanmaa", "FI-13", "Region"), + new("Pohjanmaa", "FI-14", "Region"), + new("Pohjois-Karjala", "FI-15", "Region"), + new("Pohjois-Pohjanmaa", "FI-16", "Region"), + new("Pohjois-Savo", "FI-17", "Region"), + new("Päijät-Häme", "FI-18", "Region"), + new("Satakunta", "FI-19", "Region"), + new("Uusimaa", "FI-20", "Region"), + new("Varsinais-Suomi", "FI-21", "Region") + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForFinland() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.Finland; - // Act - var country = CountryProvider.GetCountry(existingCountryId); + var country = CountryProvider.GetCountry(EXPECTEDID); // Assert - Assert.NotNull(country); - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(FINLAND_COUNTRY_NAME, country.Name); - Assert.Equal(FINLAND_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(FINLAND_NATIVE_NAME, country.NativeName); - Assert.Equal(FINLAND_CAPITAL, country.Capital); - Assert.Equal(FINLAND_NUMERIC_CODE, country.NumericCode); - Assert.Equal(FINLAND_ISO2_CODE, country.ISO2Code); - Assert.Equal(FINLAND_ISO3_CODE, country.ISO3Code); - Assert.Equal(FINLAND_CALLING_CODE, country.CallingCode); - Assert.NotNull(country.States); - Assert.Equal(FINLAND_STATE_COUNT, country.States.Count()); - Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + AssertCorrectInformation( + country, + EXPECTEDID, + FINLAND_COUNTRY_NAME, + FINLAND_OFFICIAL_NAME, + FINLAND_NATIVE_NAME, + FINLAND_CAPITAL, + FINLAND_NUMERIC_CODE, + FINLAND_ISO2_CODE, + FINLAND_ISO3_CODE, + FINLAND_CALLING_CODE, + EXPECTED_STATES + ); } } diff --git a/src/World.Net.UnitTests/Countries/KosovoTest.cs b/src/World.Net.UnitTests/Countries/KosovoTest.cs new file mode 100644 index 0000000..2e2cd1a --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KosovoTest.cs @@ -0,0 +1,54 @@ +using World.Net; +using World.Net.Countries; +using World.Net.Helpers; +using Xunit; + +namespace World.Net.UnitTests.Countries +{ + public class KosovoTest + { + private const CountryIdentifier ExpectedId = CountryIdentifier.Kosovo; + private const string ExpectedName = "Kosovo"; + private const string ExpectedOfficialName = "Republic of Kosovo"; + private const string ExpectedNativeName = "Republika e Kosovs"; + private const string ExpectedCapital = "Pristina"; + private const int ExpectedNumericCode = 383; + private const string ExpectedISO2Code = "XK"; + private const string ExpectedISO3Code = "XKX"; + private static readonly string[] ExpectedCallingCode = ["+383"]; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Ferizaj", "XK-05", "District"), + ("Gjakov", "XK-06", "District"), + ("Gjilan", "XK-07", "District"), + ("Mitrovic", "XK-03", "District"), + ("Pej", "XK-02", "District"), + ("Prishtin", "XK-01", "District"), + ("Prizren", "XK-04", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKosovo() + { + var country = CountryProvider.GetCountry(ExpectedId); + Assert.Equal(ExpectedId, country.Id); + Assert.Equal(ExpectedName, country.Name); + Assert.Equal(ExpectedOfficialName, country.OfficialName); + Assert.Equal(ExpectedNativeName, country.NativeName); + Assert.Equal(ExpectedCapital, country.Capital); + Assert.Equal(ExpectedNumericCode, country.NumericCode); + Assert.Equal(ExpectedISO2Code, country.ISO2Code); + Assert.Equal(ExpectedISO3Code, country.ISO3Code); + Assert.Equal(ExpectedCallingCode, country.CallingCode); + + var states = country.States.ToArray(); + Assert.Equal(ExpectedStates.Length, states.Length); + for (int i = 0; i < states.Length; i++) + { + Assert.Equal(ExpectedStates[i].Name, states[i].Name); + Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode); + Assert.Equal(ExpectedStates[i].Type, states[i].Type); + } + } + } +} diff --git a/src/World.Net.UnitTests/Countries/KuwaitTest.cs b/src/World.Net.UnitTests/Countries/KuwaitTest.cs new file mode 100644 index 0000000..58a97c1 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KuwaitTest.cs @@ -0,0 +1,48 @@ +namespace World.Net.UnitTests.Countries +{ + public class KuwaitTest + { + private const CountryIdentifier ExpectedId = CountryIdentifier.Kuwait; + private const string ExpectedName = "Kuwait"; + private const string ExpectedOfficialName = "State of Kuwait"; + private const string ExpectedNativeName = "دولة الكويت"; + private const string ExpectedCapital = "Kuwait City"; + private const int ExpectedNumericCode = 414; + private const string ExpectedISO2Code = "KW"; + private const string ExpectedISO3Code = "KWT"; + private static readonly string[] ExpectedCallingCode = ["+965"]; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Al Ahmadi", "KW-AH", "Governorate"), + ("Al Farwaniyah", "KW-FA", "Governorate"), + ("Al Asimah", "KW-KU", "Governorate"), + ("Al Jahra", "KW-JA", "Governorate"), + ("Hawalli", "KW-HA", "Governorate"), + ("Mubarak Al-Kabeer", "KW-MU", "Governorate") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKuwait() + { + var country = CountryProvider.GetCountry(ExpectedId); + Assert.Equal(ExpectedId, country.Id); + Assert.Equal(ExpectedName, country.Name); + Assert.Equal(ExpectedOfficialName, country.OfficialName); + Assert.Equal(ExpectedNativeName, country.NativeName); + Assert.Equal(ExpectedCapital, country.Capital); + Assert.Equal(ExpectedNumericCode, country.NumericCode); + Assert.Equal(ExpectedISO2Code, country.ISO2Code); + Assert.Equal(ExpectedISO3Code, country.ISO3Code); + Assert.Equal(ExpectedCallingCode, country.CallingCode); + + var states = country.States.ToArray(); + Assert.Equal(ExpectedStates.Length, states.Length); + for (int i = 0; i < states.Length; i++) + { + Assert.Equal(ExpectedStates[i].Name, states[i].Name); + Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode); + Assert.Equal(ExpectedStates[i].Type, states[i].Type); + } + } + } +} diff --git a/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs new file mode 100644 index 0000000..71b958a --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs @@ -0,0 +1,56 @@ +using World.Net; +using World.Net.Countries; +using World.Net.Helpers; +using Xunit; + +namespace World.Net.UnitTests.Countries +{ + public class KyrgyzstanTest + { + private const CountryIdentifier ExpectedId = CountryIdentifier.Kyrgyzstan; + private const string ExpectedName = "Kyrgyzstan"; + private const string ExpectedOfficialName = "Kyrgyz Republic"; + private const string ExpectedNativeName = "Киргизская Республика"; + private const string ExpectedCapital = "Bishkek"; + private const int ExpectedNumericCode = 417; + private const string ExpectedISO2Code = "KG"; + private const string ExpectedISO3Code = "KGZ"; + private static readonly string[] ExpectedCallingCode = ["+996"]; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Batken", "KG-B", "Region"), + ("Chuy", "KG-C", "Region"), + ("Jalal-Abad", "KG-J", "Region"), + ("Naryn", "KG-N", "Region"), + ("Osh", "KG-O", "Region"), + ("Talas", "KG-T", "Region"), + ("Issyk-Kul", "KG-Y", "Region"), + ("Bishkek", "KG-GB", "City"), + ("Osh City", "KG-GO", "City") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKyrgyzstan() + { + var country = CountryProvider.GetCountry(ExpectedId); + Assert.Equal(ExpectedId, country.Id); + Assert.Equal(ExpectedName, country.Name); + Assert.Equal(ExpectedOfficialName, country.OfficialName); + Assert.Equal(ExpectedNativeName, country.NativeName); + Assert.Equal(ExpectedCapital, country.Capital); + Assert.Equal(ExpectedNumericCode, country.NumericCode); + Assert.Equal(ExpectedISO2Code, country.ISO2Code); + Assert.Equal(ExpectedISO3Code, country.ISO3Code); + Assert.Equal(ExpectedCallingCode, country.CallingCode); + + var states = country.States.ToArray(); + Assert.Equal(ExpectedStates.Length, states.Length); + for (int i = 0; i < states.Length; i++) + { + Assert.Equal(ExpectedStates[i].Name, states[i].Name); + Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode); + Assert.Equal(ExpectedStates[i].Type, states[i].Type); + } + } + } +} diff --git a/src/World.Net.UnitTests/Countries/LaosTest.cs b/src/World.Net.UnitTests/Countries/LaosTest.cs new file mode 100644 index 0000000..be4dbbc --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LaosTest.cs @@ -0,0 +1,61 @@ +namespace World.Net.UnitTests.Countries +{ + public class LaosTest + { + private const CountryIdentifier ExpectedId = CountryIdentifier.Laos; + private const string ExpectedName = "Laos"; + private const string ExpectedOfficialName = "Lao People's Democratic Republic"; + private const string ExpectedNativeName = "ສາທາລະນະລັດ ປະຊາຊົນລາວ"; + private const string ExpectedCapital = "Vientiane"; + private const int ExpectedNumericCode = 418; + private const string ExpectedISO2Code = "LA"; + private const string ExpectedISO3Code = "LAO"; + private static readonly string[] ExpectedCallingCode = ["+856"]; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Attapeu", "LA-AT", "Province"), + ("Bokeo", "LA-BK", "Province"), + ("Bolikhamxai", "LA-BL", "Province"), + ("Champasak", "LA-CH", "Province"), + ("Houaphan", "LA-HO", "Province"), + ("Khammouan", "LA-KH", "Province"), + ("Luang Namtha", "LA-LM", "Province"), + ("Luang Prabang", "LA-LP", "Province"), + ("Oudomxai", "LA-OU", "Province"), + ("Phongsaly", "LA-PH", "Province"), + ("Salavan", "LA-SL", "Province"), + ("Savannakhét", "LA-SV", "Province"), + ("Sekong", "LA-XE", "Province"), + ("Vientiane Province", "LA-VI", "Province"), + ("Vientiane Prefecture", "LA-VT", "Prefecture"), + ("Xaignabouli", "LA-XA", "Province"), + ("Xaisomboun", "LA-XN", "Province"), + ("Xiangkhouang", "LA-XI", "Province") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLaos() + { + var country = CountryProvider.GetCountry(ExpectedId); + Assert.Equal(ExpectedId, country.Id); + Assert.Equal(ExpectedName, country.Name); + Assert.Equal(ExpectedOfficialName, country.OfficialName); + Assert.Equal(ExpectedNativeName, country.NativeName); + Assert.Equal(ExpectedCapital, country.Capital); + Assert.Equal(ExpectedNumericCode, country.NumericCode); + Assert.Equal(ExpectedISO2Code, country.ISO2Code); + Assert.Equal(ExpectedISO3Code, country.ISO3Code); + Assert.Equal(ExpectedCallingCode, country.CallingCode); + + var states = country.States.ToArray(); + Assert.Equal(ExpectedStates.Length, states.Length); + for (int i = 0; i < states.Length; i++) + { + Assert.Equal(ExpectedStates[i].Name, states[i].Name); + Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode); + Assert.Equal(ExpectedStates[i].Type, states[i].Type); + } + } + } +} diff --git a/src/World.Net.UnitTests/Countries/LatviaTests.cs b/src/World.Net.UnitTests/Countries/LatviaTests.cs new file mode 100644 index 0000000..e3b04c4 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LatviaTests.cs @@ -0,0 +1,75 @@ +namespace World.Net.UnitTests.Countries +{ + public class LatviaTests : AssertCountryTestBase + { + private const CountryIdentifier ExpectedId = CountryIdentifier.Latvia; + private const string ExpectedName = "Latvia"; + private const string ExpectedOfficialName = "Republic of Latvia"; + private const string ExpectedNativeName = "Latvijas Republika"; + private const string ExpectedCapital = "Riga"; + private const int ExpectedNumericCode = 428; + private const string ExpectedISO2Code = "LV"; + private const string ExpectedISO3Code = "LVA"; + private static readonly string[] ExpectedCallingCode = ["+371"]; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Aizkraukle", "LV-AI", "Municipality"), + ("Alūksne", "LV-AL", "Municipality"), + ("Balvi", "LV-BL", "Municipality"), + ("Bauska", "LV-BU", "Municipality"), + ("Cēsis", "LV-CE", "Municipality"), + ("Dobele", "LV-DO", "Municipality"), + ("Gulbene", "LV-GU", "Municipality"), + ("Jelgava", "LV-JL", "Municipality"), + ("Jēkabpils", "LV-JK", "Municipality"), + ("Krāslava", "LV-KR", "Municipality"), + ("Kuldīga", "LV-KU", "Municipality"), + ("Limbaži", "LV-LM", "Municipality"), + ("Līvāni", "LV-LV", "Municipality"), + ("Ludza", "LV-LU", "Municipality"), + ("Madona", "LV-MA", "Municipality"), + ("Ogre", "LV-OG", "Municipality"), + ("Preiļi", "LV-PR", "Municipality"), + ("Rēzekne", "LV-RE", "Municipality"), + ("Riga", "LV-RI", "Municipality"), + ("Saldus", "LV-SA", "Municipality"), + ("Sigulda", "LV-SI", "Municipality"), + ("Smiltene", "LV-SM", "Municipality"), + ("Talsi", "LV-TA", "Municipality"), + ("Tukums", "LV-TU", "Municipality"), + ("Valka", "LV-VA", "Municipality"), + ("Valmiera", "LV-VM", "Municipality"), + ("Ventspils", "LV-VE", "Municipality"), + ("Augšdaugava", "LV-AD", "Municipality"), + ("Dienvidkurzeme", "LV-DK", "Municipality"), + ("Rēzekne City", "LV-RC", "Republic City"), + ("Daugavpils City", "LV-DC", "Republic City"), + ("Jelgava City", "LV-JC", "Republic City"), + ("Jūrmala City", "LV-JU", "Republic City"), + ("Liepāja City", "LV-LP", "Republic City"), + ("Riga City", "LV-RG", "Republic City"), + ("Ventspils City", "LV-VC", "Republic City") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLaos() + { + var country = CountryProvider.GetCountry(ExpectedId); + + AssertCorrectInformation( + country, + ExpectedId, + ExpectedName, + ExpectedOfficialName, + ExpectedNativeName, + ExpectedCapital, + ExpectedNumericCode, + ExpectedISO2Code, + ExpectedISO3Code, + ExpectedCallingCode, + ExpectedStates + ); + } + } +} diff --git a/src/World.Net/Countries/Kosovo.cs b/src/World.Net/Countries/Kosovo.cs new file mode 100644 index 0000000..1921937 --- /dev/null +++ b/src/World.Net/Countries/Kosovo.cs @@ -0,0 +1,44 @@ +namespace World.Net.Countries +{ + internal sealed class Kosovo : ICountry + { + /// + public CountryIdentifier Id => CountryIdentifier.Kosovo; + + /// + public string Name => "Kosovo"; + + /// + public string OfficialName { get; } = "Republic of Kosovo"; + + /// + public string NativeName { get; } = "Republika e Kosovs"; + + /// + public string Capital { get; } = "Pristina"; + + /// + public int NumericCode { get; } = 383; + + /// + public string ISO2Code { get; } = "XK"; + + /// + public string ISO3Code { get; } = "XKX"; + + /// + public string[] CallingCode { get; } = ["+383"]; + + /// + public IEnumerable States { get; } = + [ + new State("Ferizaj", "XK-05", "District"), + new State("Gjakov", "XK-06", "District"), + new State("Gjilan", "XK-07", "District"), + new State("Mitrovic", "XK-03", "District"), + new State("Pej", "XK-02", "District"), + new State("Prishtin", "XK-01", "District"), + new State("Prizren", "XK-04", "District") + ]; + } +} diff --git a/src/World.Net/Countries/Kuwait.cs b/src/World.Net/Countries/Kuwait.cs new file mode 100644 index 0000000..e01047c --- /dev/null +++ b/src/World.Net/Countries/Kuwait.cs @@ -0,0 +1,23 @@ +namespace World.Net.Countries; + +internal sealed class Kuwait : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Kuwait; + public string Name { get; } = "Kuwait"; + public string OfficialName { get; } = "State of Kuwait"; + public string NativeName { get; } = "دولة الكويت"; + public string Capital { get; } = "Kuwait City"; + public int NumericCode { get; } = 414; + public string ISO2Code { get; } = "KW"; + public string ISO3Code { get; } = "KWT"; + public string[] CallingCode { get; } = ["+965"]; + public IEnumerable States { get; } = + [ + new State("Al Ahmadi", "KW-AH", "Governorate"), + new State("Al Farwaniyah", "KW-FA", "Governorate"), + new State("Al Asimah", "KW-KU", "Governorate"), + new State("Al Jahra", "KW-JA", "Governorate"), + new State("Hawalli", "KW-HA", "Governorate"), + new State("Mubarak Al-Kabeer", "KW-MU", "Governorate") + ]; +} diff --git a/src/World.Net/Countries/Kyrgyzstan.cs b/src/World.Net/Countries/Kyrgyzstan.cs new file mode 100644 index 0000000..a71586e --- /dev/null +++ b/src/World.Net/Countries/Kyrgyzstan.cs @@ -0,0 +1,26 @@ +namespace World.Net.Countries; + +internal sealed class Kyrgyzstan : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Kyrgyzstan; + public string Name { get; } = "Kyrgyzstan"; + public string OfficialName { get; } = "Kyrgyz Republic"; + public string NativeName { get; } = "Киргизская Республика"; + public string Capital { get; } = "Bishkek"; + public int NumericCode { get; } = 417; + public string ISO2Code { get; } = "KG"; + public string ISO3Code { get; } = "KGZ"; + public string[] CallingCode { get; } = ["+996"]; + public IEnumerable States { get; } = + [ + new State("Batken", "KG-B", "Region"), + new State("Chuy", "KG-C", "Region"), + new State("Jalal-Abad", "KG-J", "Region"), + new State("Naryn", "KG-N", "Region"), + new State("Osh", "KG-O", "Region"), + new State("Talas", "KG-T", "Region"), + new State("Issyk-Kul", "KG-Y", "Region"), + new State("Bishkek", "KG-GB", "City"), + new State("Osh City", "KG-GO", "City") + ]; +} diff --git a/src/World.Net/Countries/Laos.cs b/src/World.Net/Countries/Laos.cs new file mode 100644 index 0000000..3a4879b --- /dev/null +++ b/src/World.Net/Countries/Laos.cs @@ -0,0 +1,55 @@ +namespace World.Net.Countries +{ + internal sealed class Laos : ICountry + { + /// + public CountryIdentifier Id => CountryIdentifier.Laos; + + /// + public string Name { get; } = "Laos"; + + /// + public string OfficialName { get; } = "Lao People's Democratic Republic"; + + /// + public string NativeName { get; } = "ສາທາລະນະລັດ ປະຊາຊົນລາວ"; + + /// + public string Capital { get; } = "Vientiane"; + + /// + public int NumericCode { get; } = 418; + + /// + public string ISO2Code { get; } = "LA"; + + /// + public string ISO3Code { get; } = "LAO"; + + /// + public string[] CallingCode { get; } = ["+856"]; + + public IEnumerable States { get; } = + [ + new("Attapeu", "LA-AT"), + new("Bokeo", "LA-BK"), + new("Bolikhamxai", "LA-BL"), + new("Champasak", "LA-CH"), + new("Houaphan", "LA-HO"), + new("Khammouan", "LA-KH"), + new("Luang Namtha", "LA-LM"), + new("Luang Prabang", "LA-LP"), + new("Oudomxai", "LA-OU"), + new("Phongsaly", "LA-PH"), + new("Salavan", "LA-SL"), + new("Savannakhét", "LA-SV"), + new("Sekong", "LA-XE"), + new("Vientiane Province", "LA-VI"), + new("Vientiane Prefecture", "LA-VT", "Prefecture"), + new("Xaignabouli", "LA-XA"), + new("Xaisomboun", "LA-XN"), + new("Xiangkhouang", "LA-XI") + ]; + } + +} diff --git a/src/World.Net/Countries/Latvia.cs b/src/World.Net/Countries/Latvia.cs new file mode 100644 index 0000000..d7a3aa1 --- /dev/null +++ b/src/World.Net/Countries/Latvia.cs @@ -0,0 +1,73 @@ +namespace World.Net.Countries +{ + internal sealed class Latvia : ICountry + { + /// + public CountryIdentifier Id => CountryIdentifier.Latvia; + + /// + public string Name { get; } = "Latvia"; + + /// + public string OfficialName { get; } = "Republic of Latvia"; + + /// + public string NativeName { get; } = "Latvijas Republika"; + + /// + public string Capital { get; } = "Riga"; + + /// + public int NumericCode { get; } = 428; + + /// + public string ISO2Code { get; } = "LV"; + + /// + public string ISO3Code { get; } = "LVA"; + + /// + public string[] CallingCode { get; } = ["+371"]; + + /// + public IEnumerable States { get; } = + [ + new("Aizkraukle", "LV-AI", "Municipality"), + new("Alūksne", "LV-AL", "Municipality"), + new("Balvi", "LV-BL", "Municipality"), + new("Bauska", "LV-BU", "Municipality"), + new("Cēsis", "LV-CE", "Municipality"), + new("Dobele", "LV-DO", "Municipality"), + new("Gulbene", "LV-GU", "Municipality"), + new("Jelgava", "LV-JL", "Municipality"), + new("Jēkabpils", "LV-JK", "Municipality"), + new("Krāslava", "LV-KR", "Municipality"), + new("Kuldīga", "LV-KU", "Municipality"), + new("Limbaži", "LV-LM", "Municipality"), + new("Līvāni", "LV-LV", "Municipality"), + new("Ludza", "LV-LU", "Municipality"), + new("Madona", "LV-MA", "Municipality"), + new("Ogre", "LV-OG", "Municipality"), + new("Preiļi", "LV-PR", "Municipality"), + new("Rēzekne", "LV-RE", "Municipality"), + new("Riga", "LV-RI", "Municipality"), + new("Saldus", "LV-SA", "Municipality"), + new("Sigulda", "LV-SI", "Municipality"), + new("Smiltene", "LV-SM", "Municipality"), + new("Talsi", "LV-TA", "Municipality"), + new("Tukums", "LV-TU", "Municipality"), + new("Valka", "LV-VA", "Municipality"), + new("Valmiera", "LV-VM", "Municipality"), + new("Ventspils", "LV-VE", "Municipality"), + new("Augšdaugava", "LV-AD", "Municipality"), + new("Dienvidkurzeme", "LV-DK", "Municipality"), + new("Rēzekne City", "LV-RC", "Republic City"), + new("Daugavpils City", "LV-DC", "Republic City"), + new("Jelgava City", "LV-JC", "Republic City"), + new("Jūrmala City", "LV-JU", "Republic City"), + new("Liepāja City", "LV-LP", "Republic City"), + new("Riga City", "LV-RG", "Republic City"), + new("Ventspils City", "LV-VC", "Republic City") + ]; + } +} diff --git a/src/World.Net/Helpers/CountryIdentifier.cs b/src/World.Net/Helpers/CountryIdentifier.cs index 446d70b..a56af6e 100644 --- a/src/World.Net/Helpers/CountryIdentifier.cs +++ b/src/World.Net/Helpers/CountryIdentifier.cs @@ -922,6 +922,14 @@ public enum CountryIdentifier /// Kiribati, + /// + /// The unique identifier for Kosovo. + /// + /// + /// Use this identifier to reference Kosovo in operations that require a country ID. + /// + Kosovo, + /// /// The unique identifier for North Korea. /// @@ -1981,15 +1989,7 @@ public enum CountryIdentifier /// /// Use this identifier to reference Zimbabwe in operations that require a country ID. /// - Zimbabwe, - - /// - /// The unique identifier for Kosovo. - /// - /// - /// Use this identifier to reference Kosovo in operations that require a country ID. - /// - Kosovo, + Zimbabwe, /// /// The unique identifier for Curaçao. diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 0f76427..c58af85 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -95,6 +95,11 @@ public static Dictionary Initialize() { CountryIdentifier.Kazakhstan, new Kazakhstan() }, { CountryIdentifier.Kenya, new Kenya() }, { CountryIdentifier.Kiribati, new Kiribati() }, + { CountryIdentifier.Kosovo, new Kosovo() }, + { CountryIdentifier.Kuwait, new Kuwait() }, + { CountryIdentifier.Kyrgyzstan, new Kyrgyzstan() }, + { CountryIdentifier.Laos, new Laos() }, + { CountryIdentifier.Latvia, new Latvia() }, // Future countries can be added here in the same format. };