From e57de560b53d40d894637b901c9d57d329f2668a Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 11:37:23 +0100 Subject: [PATCH 01/30] add estonia --- .../Countries/EstoniaTests.cs | 40 +++++++++++++++++ src/World.Net/Countries/Estonia.cs | 43 +++++++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 23 ++++++++++ 3 files changed, 106 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/EstoniaTests.cs create mode 100644 src/World.Net/Countries/Estonia.cs diff --git a/src/World.Net.UnitTests/Countries/EstoniaTests.cs b/src/World.Net.UnitTests/Countries/EstoniaTests.cs new file mode 100644 index 0000000..37c8b77 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/EstoniaTests.cs @@ -0,0 +1,40 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class EstoniaTests + { + private const string ESTONIA_NAME = "Estonia"; + private const int ESTONIA_STATE_COUNT = 15; + private const string ESTONIA_OFFICIAL_NAME = "Republic of Estonia"; + private const string ESTONIA_NATIVE_NAME = "Eesti"; + private const string ESTONIA_CAPITAL = "Tallinn"; + private const int ESTONIA_NUMERIC_CODE = 233; + private const string ESTONIA_ISO2_CODE = "EE"; + private const string ESTONIA_ISO3_CODE = "EST"; + private readonly string[] ESTONIA_CALLING_CODE = ["372"]; + private static readonly string[] VALID_STATE_TYPES = { "County" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForEstonia() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Estonia; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(ESTONIA_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(ESTONIA_STATE_COUNT, country.States.Count()); + Assert.Equal(ESTONIA_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(ESTONIA_NATIVE_NAME, country.NativeName); + Assert.Equal(ESTONIA_CAPITAL, country.Capital); + Assert.Equal(ESTONIA_NUMERIC_CODE, country.NumericCode); + Assert.Equal(ESTONIA_ISO2_CODE, country.ISO2Code); + Assert.Equal(ESTONIA_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(ESTONIA_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net/Countries/Estonia.cs b/src/World.Net/Countries/Estonia.cs new file mode 100644 index 0000000..1361a74 --- /dev/null +++ b/src/World.Net/Countries/Estonia.cs @@ -0,0 +1,43 @@ + +namespace World.Net.Countries +{ + internal class Estonia : ICountry + { + public CountryIdentifier Id => CountryIdentifier.Estonia; + + public string Name => nameof(Estonia); + + public string OfficialName => "Republic of Estonia"; + + public string NativeName => "Eesti"; + + public string Capital => "Tallinn"; + + public int NumericCode => 233; + + public string ISO2Code => "EE"; + + public string ISO3Code => "EST"; + + public string[] CallingCode => ["372"]; + + public IEnumerable States => + [ + new("Harju", "37", "County"), + new("Hiiu", "39", "County"), + new("Ida-Viru", "44", "County"), + new("Jõgeva", "49", "County"), + new("Järva", "51", "County"), + new("Lääne", "57", "County"), + new("Lääne-Viru", "59", "County"), + new("Põlva", "65", "County"), + new("Pärnu", "67", "County"), + new("Rapla", "70", "County"), + new("Saare", "74", "County"), + new("Tartu", "78", "County"), + new("Valga", "82", "County"), + new("Viljandi", "84", "County"), + new("Võru", "86", "County") + ]; + } +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 9c15451..df31cc2 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -55,6 +55,29 @@ public static Dictionary Initialize() { CountryIdentifier.CocosKeelingIslands, new CocosKeelingIslands() }, { CountryIdentifier.Colombia, new Colombia() }, { CountryIdentifier.Comoros, new Comoros() }, + { CountryIdentifier.Congo, new Congo() }, + { CountryIdentifier.CostaRica, new CostaRica() }, + { CountryIdentifier.CookIslands, new CookIslands() }, + { CountryIdentifier.CoteDIvoire, new CoteDIvoire() }, + { CountryIdentifier.Croatia, new Croatia() }, + { CountryIdentifier.Cuba, new Cuba() }, + { CountryIdentifier.Curacao, new Curaçao() }, + { CountryIdentifier.Cyprus, new Cyprus() }, + { CountryIdentifier.CzechRepublic, new CzechRepublic() }, + { CountryIdentifier.Denmark, new Denmark() }, + { CountryIdentifier.Djibouti, new Djibouti() }, + { CountryIdentifier.Dominica, new Dominica() }, + { CountryIdentifier.DominicanRepublic, new DominicanRepublic() }, + { CountryIdentifier.TimorLeste, new TimorLeste() }, + { CountryIdentifier.Ecuador, new Ecuador() }, + { CountryIdentifier.Egypt, new Egypt() }, + { CountryIdentifier.Estonia, new Estonia() }, + { CountryIdentifier.FaroeIslands, new FaroeIslands() }, + { CountryIdentifier.FijiIslands, new FijiIslands() }, + { CountryIdentifier.Finland, new Finland() }, + { CountryIdentifier.France, new France() }, + { CountryIdentifier.FrenchGuiana, new FrenchGuiana() }, + { CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() }, // Future countries can be added here in the same format. }; From 84bc92c0b7e6a03df0e29ecb23be2fd6b8753af6 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 11:40:34 +0100 Subject: [PATCH 02/30] initialize estonia --- src/World.Net/Helpers/CountryInitializer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index e898d83..dfc17e7 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -71,6 +71,7 @@ public static Dictionary Initialize() { CountryIdentifier.TimorLeste, new TimorLeste() }, { CountryIdentifier.Ecuador, new Ecuador() }, { CountryIdentifier.Egypt, new Egypt() }, + { CountryIdentifier.Estonia, new Estonia() }, { CountryIdentifier.FaroeIslands, new FaroeIslands() }, { CountryIdentifier.FijiIslands, new FijiIslands() }, { CountryIdentifier.Finland, new Finland() }, From 983c251ae4096d41e639e504423c2e7ce7873ab8 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 11:48:59 +0100 Subject: [PATCH 03/30] add Ethiopia details --- src/World.Net/Countries/Ethiopia.cs | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/World.Net/Countries/Ethiopia.cs diff --git a/src/World.Net/Countries/Ethiopia.cs b/src/World.Net/Countries/Ethiopia.cs new file mode 100644 index 0000000..2da8ab0 --- /dev/null +++ b/src/World.Net/Countries/Ethiopia.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries +{ + internal class Ethiopia : ICountry + { + public CountryIdentifier Id => CountryIdentifier.Ethiopia; + + public string Name => nameof(Ethiopia); + + public string OfficialName => "Federal Democratic Republic of Ethiopia"; + + public string NativeName => "ኢትዮጵያ"; + + public string Capital => "Addis Ababa"; + + public int NumericCode => 231; + + public string ISO2Code => "ET"; + + public string ISO3Code => "ETH"; + + public string[] CallingCode => ["251"]; + + public IEnumerable States => + [ + new("Addis Ababa", "AA", "Administration"), + new("Afar", "AF", "Region"), + new("Amhara", "AM", "Region"), + new("Benishangul-Gumuz", "BE", "Region"), + new("Dire Dawa", "DD", "Administration"), + new("Gambela", "GA", "Region"), + new("Harari", "HA", "Region"), + new("Oromia", "OR", "Region"), + new("Sidama", "SI", "Region"), + new("Somali", "SO", "Region"), + new("Southern Nations, Nationalities, and Peoples' Region", "SN", "Region"), + new("Tigray", "TI", "Region") + ]; + } +} From 42615bc4c833819428c001b97f84370fbf0bd42d Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 12:37:26 +0100 Subject: [PATCH 04/30] rename estonia test class --- .../Countries/{EstoniaTests.cs => EstoniaTest.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/World.Net.UnitTests/Countries/{EstoniaTests.cs => EstoniaTest.cs} (97%) diff --git a/src/World.Net.UnitTests/Countries/EstoniaTests.cs b/src/World.Net.UnitTests/Countries/EstoniaTest.cs similarity index 97% rename from src/World.Net.UnitTests/Countries/EstoniaTests.cs rename to src/World.Net.UnitTests/Countries/EstoniaTest.cs index 37c8b77..e9a235d 100644 --- a/src/World.Net.UnitTests/Countries/EstoniaTests.cs +++ b/src/World.Net.UnitTests/Countries/EstoniaTest.cs @@ -1,6 +1,6 @@ namespace World.Net.UnitTests.Countries { - public sealed class EstoniaTests + public sealed class EstoniaTest { private const string ESTONIA_NAME = "Estonia"; private const int ESTONIA_STATE_COUNT = 15; From 3ea2802d9c5504fc5d1ea0eade8a7c37113ddaff Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 12:41:10 +0100 Subject: [PATCH 05/30] add ethiopia test class --- .../Countries/EthiopiaTest.cs | 40 +++++++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 1 + 2 files changed, 41 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/EthiopiaTest.cs diff --git a/src/World.Net.UnitTests/Countries/EthiopiaTest.cs b/src/World.Net.UnitTests/Countries/EthiopiaTest.cs new file mode 100644 index 0000000..606a0e9 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/EthiopiaTest.cs @@ -0,0 +1,40 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class EthiopiaTest + { + private const string ETHIOPIA_NAME = "Ethiopia"; + private const int ETHIOPIA_STATE_COUNT = 12; + private const string ETHIOPIA_OFFICIAL_NAME = "Federal Democratic Republic of Ethiopia"; + private const string ETHIOPIA_NATIVE_NAME = "ኢትዮጵያ"; + private const string ETHIOPIA_CAPITAL = "Addis Ababa"; + private const int ETHIOPIA_NUMERIC_CODE = 231; + private const string ETHIOPIA_ISO2_CODE = "ET"; + private const string ETHIOPIA_ISO3_CODE = "ETH"; + private readonly string[] ETHIOPIA_CALLING_CODE = ["251"]; + private static readonly string[] VALID_STATE_TYPES = { "Region", "Administration" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForEthiopia() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Ethiopia; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(ETHIOPIA_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(ETHIOPIA_STATE_COUNT, country.States.Count()); + Assert.Equal(ETHIOPIA_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(ETHIOPIA_NATIVE_NAME, country.NativeName); + Assert.Equal(ETHIOPIA_CAPITAL, country.Capital); + Assert.Equal(ETHIOPIA_NUMERIC_CODE, country.NumericCode); + Assert.Equal(ETHIOPIA_ISO2_CODE, country.ISO2Code); + Assert.Equal(ETHIOPIA_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(ETHIOPIA_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index dfc17e7..d4c47e5 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -72,6 +72,7 @@ public static Dictionary Initialize() { CountryIdentifier.Ecuador, new Ecuador() }, { CountryIdentifier.Egypt, new Egypt() }, { CountryIdentifier.Estonia, new Estonia() }, + { CountryIdentifier.Ethiopia, new Ethiopia() }, { CountryIdentifier.FaroeIslands, new FaroeIslands() }, { CountryIdentifier.FijiIslands, new FijiIslands() }, { CountryIdentifier.Finland, new Finland() }, From 511d7d2563a676066c24b2cca47d5231cd2294aa Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 13:14:31 +0100 Subject: [PATCH 06/30] add FalklandIslands details --- src/World.Net/Countries/FalklandIslands.cs | 29 +++++++++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 1 + 2 files changed, 30 insertions(+) create mode 100644 src/World.Net/Countries/FalklandIslands.cs diff --git a/src/World.Net/Countries/FalklandIslands.cs b/src/World.Net/Countries/FalklandIslands.cs new file mode 100644 index 0000000..3a14e3b --- /dev/null +++ b/src/World.Net/Countries/FalklandIslands.cs @@ -0,0 +1,29 @@ +namespace World.Net.Countries +{ + internal class FalklandIslands : ICountry + { + public CountryIdentifier Id => CountryIdentifier.FalklandIslands; + + public string Name => nameof(FalklandIslands); + + public string OfficialName => "Falkland Islands"; + + public string NativeName => "Falkland Islands"; + + public string Capital => "Stanley"; + + public int NumericCode => 238; + + public string ISO2Code => "FK"; + + public string ISO3Code => "FLK"; + + public string[] CallingCode => ["500"]; + + public IEnumerable States => + [ + new("Falkland Islands", "FK", "Overseas Territory") + ]; + } + +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index d4c47e5..eab88eb 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -73,6 +73,7 @@ public static Dictionary Initialize() { CountryIdentifier.Egypt, new Egypt() }, { CountryIdentifier.Estonia, new Estonia() }, { CountryIdentifier.Ethiopia, new Ethiopia() }, + { CountryIdentifier.FalklandIslands, new FalklandIslands() }, { CountryIdentifier.FaroeIslands, new FaroeIslands() }, { CountryIdentifier.FijiIslands, new FijiIslands() }, { CountryIdentifier.Finland, new Finland() }, From ffe2b65d7a8caf1ac27e02e3c77d8893727f914d Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 13:14:40 +0100 Subject: [PATCH 07/30] add FalklandIslands tests --- .../Countries/FalklandIslandsTest.cs | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/FalklandIslandsTest.cs diff --git a/src/World.Net.UnitTests/Countries/FalklandIslandsTest.cs b/src/World.Net.UnitTests/Countries/FalklandIslandsTest.cs new file mode 100644 index 0000000..c8c8d7d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/FalklandIslandsTest.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class FalklandIslandsTest + { + private const string FALKLANDS_NAME = "FalklandIslands"; + private const string FALKLANDS_OFFICIAL_NAME = "Falkland Islands"; + private const string FALKLANDS_NATIVE_NAME = "Falkland Islands"; + private const string FALKLANDS_CAPITAL = "Stanley"; + private const int FALKLANDS_NUMERIC_CODE = 238; + private const string FALKLANDS_ISO2_CODE = "FK"; + private const string FALKLANDS_ISO3_CODE = "FLK"; + private readonly string[] FALKLANDS_CALLING_CODE = ["500"]; + private static readonly string[] VALID_STATE_TYPES = { "Overseas Territory" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForFalklandIslands() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.FalklandIslands; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(FALKLANDS_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Single(country.States); + Assert.Equal(FALKLANDS_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(FALKLANDS_NATIVE_NAME, country.NativeName); + Assert.Equal(FALKLANDS_CAPITAL, country.Capital); + Assert.Equal(FALKLANDS_NUMERIC_CODE, country.NumericCode); + Assert.Equal(FALKLANDS_ISO2_CODE, country.ISO2Code); + Assert.Equal(FALKLANDS_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(FALKLANDS_CALLING_CODE, country.CallingCode); + } + } +} From 1c7d0b949e149759a8dd3640819e12ee2fd35862 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 13:19:58 +0100 Subject: [PATCH 08/30] add Eswatini --- src/World.Net/Countries/Estonia.cs | 2 +- src/World.Net/Countries/Eswatini.cs | 32 ++++++++++++++++++++++ src/World.Net/Countries/Ethiopia.cs | 2 +- src/World.Net/Countries/FalklandIslands.cs | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 src/World.Net/Countries/Eswatini.cs diff --git a/src/World.Net/Countries/Estonia.cs b/src/World.Net/Countries/Estonia.cs index 1361a74..162b4c8 100644 --- a/src/World.Net/Countries/Estonia.cs +++ b/src/World.Net/Countries/Estonia.cs @@ -1,7 +1,7 @@  namespace World.Net.Countries { - internal class Estonia : ICountry + internal sealed class Estonia : ICountry { public CountryIdentifier Id => CountryIdentifier.Estonia; diff --git a/src/World.Net/Countries/Eswatini.cs b/src/World.Net/Countries/Eswatini.cs new file mode 100644 index 0000000..9ecce67 --- /dev/null +++ b/src/World.Net/Countries/Eswatini.cs @@ -0,0 +1,32 @@ +namespace World.Net.Countries +{ + internal sealed class Eswatini : ICountry + { + public CountryIdentifier Id => CountryIdentifier.Eswatini; + + public string Name => nameof(Eswatini); + + public string OfficialName => "Kingdom of Eswatini"; + + public string NativeName => "eSwatini"; + + public string Capital => "Mbabane"; + + public int NumericCode => 748; + + public string ISO2Code => "SZ"; + + public string ISO3Code => "SWZ"; + + public string[] CallingCode => ["268"]; + + public IEnumerable States => + [ + new State("Hhohho", "HH", "Region"), + new State("Lubombo", "LU", "Region"), + new State("Manzini", "MA", "Region"), + new State("Shiselweni", "SH", "Region") + ]; + } + +} diff --git a/src/World.Net/Countries/Ethiopia.cs b/src/World.Net/Countries/Ethiopia.cs index 2da8ab0..4c74fc8 100644 --- a/src/World.Net/Countries/Ethiopia.cs +++ b/src/World.Net/Countries/Ethiopia.cs @@ -1,6 +1,6 @@ namespace World.Net.Countries { - internal class Ethiopia : ICountry + internal sealed class Ethiopia : ICountry { public CountryIdentifier Id => CountryIdentifier.Ethiopia; diff --git a/src/World.Net/Countries/FalklandIslands.cs b/src/World.Net/Countries/FalklandIslands.cs index 3a14e3b..765cad3 100644 --- a/src/World.Net/Countries/FalklandIslands.cs +++ b/src/World.Net/Countries/FalklandIslands.cs @@ -1,6 +1,6 @@ namespace World.Net.Countries { - internal class FalklandIslands : ICountry + internal sealed class FalklandIslands : ICountry { public CountryIdentifier Id => CountryIdentifier.FalklandIslands; From 0b6237ed512ec1ccf00c48da72e68997a13ca7d5 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 13:20:09 +0100 Subject: [PATCH 09/30] add Eswatini test class --- .../Countries/EswatiniTest.cs | 40 +++++++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 1 + 2 files changed, 41 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/EswatiniTest.cs diff --git a/src/World.Net.UnitTests/Countries/EswatiniTest.cs b/src/World.Net.UnitTests/Countries/EswatiniTest.cs new file mode 100644 index 0000000..4ea9a4e --- /dev/null +++ b/src/World.Net.UnitTests/Countries/EswatiniTest.cs @@ -0,0 +1,40 @@ +namespace World.Net.UnitTests.Countries +{ + public class EswatiniTest + { + private const string ESWATINI_NAME = "Eswatini"; + private const int ESWATINI_STATE_COUNT = 4; + private const string ESWATINI_OFFICIAL_NAME = "Kingdom of Eswatini"; + private const string ESWATINI_NATIVE_NAME = "eSwatini"; + private const string ESWATINI_CAPITAL = "Mbabane"; + private const int ESWATINI_NUMERIC_CODE = 748; + private const string ESWATINI_ISO2_CODE = "SZ"; + private const string ESWATINI_ISO3_CODE = "SWZ"; + private readonly string[] ESWATINI_CALLING_CODE = ["268"]; + private static readonly string[] VALID_STATE_TYPES = { "Region" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForEswatini() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Eswatini; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(ESWATINI_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(ESWATINI_STATE_COUNT, country.States.Count()); + Assert.Equal(ESWATINI_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(ESWATINI_NATIVE_NAME, country.NativeName); + Assert.Equal(ESWATINI_CAPITAL, country.Capital); + Assert.Equal(ESWATINI_NUMERIC_CODE, country.NumericCode); + Assert.Equal(ESWATINI_ISO2_CODE, country.ISO2Code); + Assert.Equal(ESWATINI_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(ESWATINI_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index eab88eb..0f9c8e1 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -73,6 +73,7 @@ public static Dictionary Initialize() { CountryIdentifier.Egypt, new Egypt() }, { CountryIdentifier.Estonia, new Estonia() }, { CountryIdentifier.Ethiopia, new Ethiopia() }, + { CountryIdentifier.Eswatini, new Eswatini() }, { CountryIdentifier.FalklandIslands, new FalklandIslands() }, { CountryIdentifier.FaroeIslands, new FaroeIslands() }, { CountryIdentifier.FijiIslands, new FijiIslands() }, From 48b03669f7544f535eaf5c0fe3179b7b2eeb500d Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 17:52:40 +0100 Subject: [PATCH 10/30] add el salvador --- .../Countries/ElSalvadorTest.cs | 40 ++++++++++++++++++ src/World.Net/Countries/ElSalvador.cs | 41 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/ElSalvadorTest.cs create mode 100644 src/World.Net/Countries/ElSalvador.cs diff --git a/src/World.Net.UnitTests/Countries/ElSalvadorTest.cs b/src/World.Net.UnitTests/Countries/ElSalvadorTest.cs new file mode 100644 index 0000000..2093cb5 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/ElSalvadorTest.cs @@ -0,0 +1,40 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class ElSalvadorTest + { + private const string ELSALVADOR_NAME = "ElSalvador"; + private const int ELSALVADOR_STATE_COUNT = 14; + private const string ELSALVADOR_OFFICIAL_NAME = "Republic of El Salvador"; + private const string ELSALVADOR_NATIVE_NAME = "República de El Salvador"; + private const string ELSALVADOR_CAPITAL = "San Salvador"; + private const int ELSALVADOR_NUMERIC_CODE = 222; + private const string ELSALVADOR_ISO2_CODE = "SV"; + private const string ELSALVADOR_ISO3_CODE = "SLV"; + private readonly string[] ELSALVADOR_CALLING_CODE = ["503"]; + private static readonly string[] VALID_STATE_TYPES = { "Department" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForElSalvador() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.ElSalvador; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(ELSALVADOR_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(ELSALVADOR_STATE_COUNT, country.States.Count()); + Assert.Equal(ELSALVADOR_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(ELSALVADOR_NATIVE_NAME, country.NativeName); + Assert.Equal(ELSALVADOR_CAPITAL, country.Capital); + Assert.Equal(ELSALVADOR_NUMERIC_CODE, country.NumericCode); + Assert.Equal(ELSALVADOR_ISO2_CODE, country.ISO2Code); + Assert.Equal(ELSALVADOR_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(ELSALVADOR_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net/Countries/ElSalvador.cs b/src/World.Net/Countries/ElSalvador.cs new file mode 100644 index 0000000..4b832bd --- /dev/null +++ b/src/World.Net/Countries/ElSalvador.cs @@ -0,0 +1,41 @@ +namespace World.Net.Countries +{ + internal class ElSalvador : ICountry + { + public CountryIdentifier Id => CountryIdentifier.ElSalvador; + + public string Name => nameof(ElSalvador); + + public string OfficialName => "Republic of El Salvador"; + + public string NativeName => "República de El Salvador"; + + public string Capital => "San Salvador"; + + public int NumericCode => 222; + + public string ISO2Code => "SV"; + + public string ISO3Code => "SLV"; + + public string[] CallingCode => ["503"]; + + public IEnumerable States => + [ + new("Ahuachapán", "AH", "Department"), + new("Cabañas", "CA", "Department"), + new("Chalatenango", "CH", "Department"), + new("Cuscatlán", "CU", "Department"), + new("La Libertad", "LI", "Department"), + new("La Paz", "PA", "Department"), + new("La Unión", "UN", "Department"), + new("Morazán", "MO", "Department"), + new("San Miguel", "SM", "Department"), + new("San Salvador", "SS", "Department"), + new("San Vicente", "SV", "Department"), + new("Santa Ana", "SA", "Department"), + new("Sonsonate", "SO", "Department"), + new("Usulután", "US", "Department") + ]; + } +} From a6b7d9f84f23f8ca206259ce826a80e28b6db244 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 17:53:13 +0100 Subject: [PATCH 11/30] add equatorial --- .../Countries/EquatorialGuineaTest.cs | 41 +++++++++++++++++++ src/World.Net/Countries/EquatorialGuinea.cs | 36 ++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/EquatorialGuineaTest.cs create mode 100644 src/World.Net/Countries/EquatorialGuinea.cs diff --git a/src/World.Net.UnitTests/Countries/EquatorialGuineaTest.cs b/src/World.Net.UnitTests/Countries/EquatorialGuineaTest.cs new file mode 100644 index 0000000..5124266 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/EquatorialGuineaTest.cs @@ -0,0 +1,41 @@ +namespace World.Net.UnitTests.Countries +{ + public class EquatorialGuineaTest + { + private const string EQUATORIALGUINEA_NAME = "EquatorialGuinea"; + private const int EQUATORIALGUINEA_STATE_COUNT = 8; + private const string EQUATORIALGUINEA_OFFICIAL_NAME = "Republic of Equatorial Guinea"; + private const string EQUATORIALGUINEA_NATIVE_NAME = "República de Guinea Ecuatorial"; + private const string EQUATORIALGUINEA_CAPITAL = "Malabo"; + private const int EQUATORIALGUINEA_NUMERIC_CODE = 226; + private const string EQUATORIALGUINEA_ISO2_CODE = "GQ"; + private const string EQUATORIALGUINEA_ISO3_CODE = "GNQ"; + private readonly string[] EQUATORIALGUINEA_CALLING_CODE = ["240"]; + private static readonly string[] VALID_STATE_TYPES = { "Province" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForEquatorialGuinea() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.EquatorialGuinea; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(EQUATORIALGUINEA_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(EQUATORIALGUINEA_STATE_COUNT, country.States.Count()); + Assert.Equal(EQUATORIALGUINEA_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(EQUATORIALGUINEA_NATIVE_NAME, country.NativeName); + Assert.Equal(EQUATORIALGUINEA_CAPITAL, country.Capital); + Assert.Equal(EQUATORIALGUINEA_NUMERIC_CODE, country.NumericCode); + Assert.Equal(EQUATORIALGUINEA_ISO2_CODE, country.ISO2Code); + Assert.Equal(EQUATORIALGUINEA_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(EQUATORIALGUINEA_CALLING_CODE, country.CallingCode); + } + + } +} diff --git a/src/World.Net/Countries/EquatorialGuinea.cs b/src/World.Net/Countries/EquatorialGuinea.cs new file mode 100644 index 0000000..1dede84 --- /dev/null +++ b/src/World.Net/Countries/EquatorialGuinea.cs @@ -0,0 +1,36 @@ +namespace World.Net.Countries +{ + internal sealed class EquatorialGuinea : ICountry + { + public CountryIdentifier Id => CountryIdentifier.EquatorialGuinea; + + public string Name => nameof(EquatorialGuinea); + + public string OfficialName => "Republic of Equatorial Guinea"; + + public string NativeName => "República de Guinea Ecuatorial"; + + public string Capital => "Malabo"; + + public int NumericCode => 226; + + public string ISO2Code => "GQ"; + + public string ISO3Code => "GNQ"; + + public string[] CallingCode => new[] { "240" }; + + public IEnumerable States => + [ + new("Annobón", "AN", "Province"), + new("Bioko Norte", "BN", "Province"), + new("Bioko Sur", "BS", "Province"), + new("Centro Sur", "CS", "Province"), + new("Djibloho", "DJ", "Province"), + new("Kié-Ntem", "KN", "Province"), + new("Litoral", "LI", "Province"), + new("Wele-Nzas", "WN", "Province") + ]; + } + +} From ee912f3d3a24c9ebf30461dfc49b7c3d97ac9d19 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 17:53:30 +0100 Subject: [PATCH 12/30] add eritrea --- .../Countries/EritreaTest.cs | 46 +++++++++++++++++++ src/World.Net/Countries/Eritrea.cs | 34 ++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 3 ++ 3 files changed, 83 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/EritreaTest.cs create mode 100644 src/World.Net/Countries/Eritrea.cs diff --git a/src/World.Net.UnitTests/Countries/EritreaTest.cs b/src/World.Net.UnitTests/Countries/EritreaTest.cs new file mode 100644 index 0000000..f551075 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/EritreaTest.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public class EritreaTest + { + private const string ERITREA_NAME = "Eritrea"; + private const int ERITREA_STATE_COUNT = 6; + private const string ERITREA_OFFICIAL_NAME = "State of Eritrea"; + private const string ERITREA_NATIVE_NAME = "ሃገረ ኤርትራ"; + private const string ERITREA_CAPITAL = "Asmara"; + private const int ERITREA_NUMERIC_CODE = 232; + private const string ERITREA_ISO2_CODE = "ER"; + private const string ERITREA_ISO3_CODE = "ERI"; + private readonly string[] ERITREA_CALLING_CODE = ["291"]; + private static readonly string[] VALID_STATE_TYPES = { "Region" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForEritrea() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Eritrea; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(ERITREA_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(ERITREA_STATE_COUNT, country.States.Count()); + Assert.Equal(ERITREA_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(ERITREA_NATIVE_NAME, country.NativeName); + Assert.Equal(ERITREA_CAPITAL, country.Capital); + Assert.Equal(ERITREA_NUMERIC_CODE, country.NumericCode); + Assert.Equal(ERITREA_ISO2_CODE, country.ISO2Code); + Assert.Equal(ERITREA_ISO3_CODE, country.ISO3Code); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + Assert.Equal(ERITREA_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net/Countries/Eritrea.cs b/src/World.Net/Countries/Eritrea.cs new file mode 100644 index 0000000..0722f30 --- /dev/null +++ b/src/World.Net/Countries/Eritrea.cs @@ -0,0 +1,34 @@ +namespace World.Net.Countries +{ + internal sealed class Eritrea : ICountry + { + public CountryIdentifier Id => CountryIdentifier.Eritrea; + + public string Name => nameof(Eritrea); + + public string OfficialName => "State of Eritrea"; + + public string NativeName => "ሃገረ ኤርትራ"; // Tigrinya: Hagere Ertra + + public string Capital => "Asmara"; + + public int NumericCode => 232; + + public string ISO2Code => "ER"; + + public string ISO3Code => "ERI"; + + public string[] CallingCode => ["291"]; + + public IEnumerable States => + [ + new("Anseba", "AN", "Region"), + new("Debub", "DU", "Region"), + new("Debubawi Keyih Bahri", "DK", "Region"), + new("Gash-Barka", "GB", "Region"), + new("Maekel", "MA", "Region"), + new("Semenawi Keyih Bahri", "SK", "Region") + ]; + } + +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 0f9c8e1..ad7dd7c 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -71,6 +71,9 @@ public static Dictionary Initialize() { CountryIdentifier.TimorLeste, new TimorLeste() }, { CountryIdentifier.Ecuador, new Ecuador() }, { CountryIdentifier.Egypt, new Egypt() }, + { CountryIdentifier.ElSalvador, new ElSalvador() }, + { CountryIdentifier.EquatorialGuinea, new EquatorialGuinea() }, + { CountryIdentifier.Eritrea, new Eritrea() }, { CountryIdentifier.Estonia, new Estonia() }, { CountryIdentifier.Ethiopia, new Ethiopia() }, { CountryIdentifier.Eswatini, new Eswatini() }, From fd2f5051bc3a89069250860ef1a8e105aeead6a8 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 17:55:57 +0100 Subject: [PATCH 13/30] update initializer --- src/World.Net/Helpers/CountryInitializer.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index b95ca29..7ceff95 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -71,16 +71,16 @@ public static Dictionary Initialize() { CountryIdentifier.TimorLeste, new TimorLeste() }, { CountryIdentifier.Ecuador, new Ecuador() }, { CountryIdentifier.Egypt, new Egypt() }, - { CountryIdentifier.Estonia, new Estonia() }, - { CountryIdentifier.Ethiopia, new Ethiopia() }, - { CountryIdentifier.Eswatini, new Eswatini() }, - { CountryIdentifier.FalklandIslands, new FalklandIslands() }, { CountryIdentifier.ElSalvador, new ElSalvador() }, { CountryIdentifier.EquatorialGuinea, new EquatorialGuinea() }, { CountryIdentifier.Eritrea, new Eritrea() }, { CountryIdentifier.Estonia, new Estonia() }, { CountryIdentifier.Ethiopia, new Ethiopia() }, { CountryIdentifier.Eswatini, new Eswatini() }, + { CountryIdentifier.FalklandIslands, new FalklandIslands() }, + { CountryIdentifier.Estonia, new Estonia() }, + { CountryIdentifier.Ethiopia, new Ethiopia() }, + { CountryIdentifier.Eswatini, new Eswatini() }, { CountryIdentifier.FalklandIslands, new FalklandIslands() }, { CountryIdentifier.FaroeIslands, new FaroeIslands() }, { CountryIdentifier.FijiIslands, new FijiIslands() }, From b04bd065f23c4902ab452571b843d811d32039fe Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 24 May 2025 17:59:04 +0100 Subject: [PATCH 14/30] remove duplicate keys --- src/World.Net/Helpers/CountryInitializer.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 7ceff95..ad7dd7c 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -77,10 +77,6 @@ public static Dictionary Initialize() { CountryIdentifier.Estonia, new Estonia() }, { CountryIdentifier.Ethiopia, new Ethiopia() }, { CountryIdentifier.Eswatini, new Eswatini() }, - { CountryIdentifier.FalklandIslands, new FalklandIslands() }, - { CountryIdentifier.Estonia, new Estonia() }, - { CountryIdentifier.Ethiopia, new Ethiopia() }, - { CountryIdentifier.Eswatini, new Eswatini() }, { CountryIdentifier.FalklandIslands, new FalklandIslands() }, { CountryIdentifier.FaroeIslands, new FaroeIslands() }, { CountryIdentifier.FijiIslands, new FijiIslands() }, From 3d9de0c52378f4f056d1d50864db2f841df5fbc5 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Wed, 10 Sep 2025 10:47:29 +0100 Subject: [PATCH 15/30] add Kazakhstan details --- src/World.Net/Countries/Kazakhstan.cs | 53 +++++++++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 3 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 src/World.Net/Countries/Kazakhstan.cs diff --git a/src/World.Net/Countries/Kazakhstan.cs b/src/World.Net/Countries/Kazakhstan.cs new file mode 100644 index 0000000..2fca4ee --- /dev/null +++ b/src/World.Net/Countries/Kazakhstan.cs @@ -0,0 +1,53 @@ +namespace World.Net.Countries; + +internal sealed class Kazakhstan : ICountry +{ + /// + public CountryIdentifier Id => CountryIdentifier.Kazakhstan; + + /// + public string Name => "Kazakhstan"; + + /// + public string OfficialName { get; } = "Republic of Kazakhstan"; + + /// + public string NativeName { get; } = "?????????"; + + /// + public string Capital { get; } = "Astana"; + + /// + public int NumericCode { get; } = 398; + + /// + public string ISO2Code { get; } = "KZ"; + + /// + public string ISO3Code { get; } = "KAZ"; + + /// + public string[] CallingCode { get; } = ["+7"]; + + /// + public IEnumerable States { get; } = + [ + new("Akmola", "KZ-AKM", "Region"), + new("Aktobe", "KZ-AKT", "Region"), + new("Almaty", "KZ-ALM", "Region"), + new("Atyrau", "KZ-ATY", "Region"), + new("East Kazakhstan", "KZ-VOS", "Region"), + new("Jambyl", "KZ-ZHA", "Region"), + new("Karaganda", "KZ-KAR", "Region"), + new("Kostanay", "KZ-KUS", "Region"), + new("Kyzylorda", "KZ-KZY", "Region"), + new("Mangystau", "KZ-MAN", "Region"), + new("Pavlodar", "KZ-PAV", "Region"), + new("North Kazakhstan", "KZ-SEV", "Region"), + new("Turkistan", "KZ-TUR", "Region"), + new("West Kazakhstan", "KZ-ZAP", "Region"), + new("Nur-Sultan", "KZ-NUR", "City"), + new("Almaty City", "KZ-ALA", "City"), + new("Shymkent", "KZ-SHY", "City") + ]; +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 673508c..ed66e81 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -91,7 +91,8 @@ public static Dictionary Initialize() { CountryIdentifier.Jamaica, new Jamaica() }, { CountryIdentifier.Japan, new Japan() }, { CountryIdentifier.Jersey, new Jersey() }, - { CountryIdentifier.Jordan, new Jordan() } + { CountryIdentifier.Jordan, new Jordan() }, + { CountryIdentifier.Kazakhstan, new World.Net.Countries.Kazakhstan() } // Future countries can be added here in the same format. }; From fb386cf5a9573f9a8ea18e40f4604d68eef47ef2 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Wed, 10 Sep 2025 10:47:44 +0100 Subject: [PATCH 16/30] add unit tests for Kazakhstan --- .../Countries/KazakhstanTest.cs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/KazakhstanTest.cs diff --git a/src/World.Net.UnitTests/Countries/KazakhstanTest.cs b/src/World.Net.UnitTests/Countries/KazakhstanTest.cs new file mode 100644 index 0000000..d498c7d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KazakhstanTest.cs @@ -0,0 +1,47 @@ +namespace World.Net.UnitTests.Countries; + +internal static class KazakhstanTestData +{ + internal const string COUNTRY_NAME = "Kazakhstan"; + internal const string NATIVE_NAME = "?????????"; + internal const string CAPITAL = "Astana"; + internal const string OFFICIAL_NAME = "Republic of Kazakhstan"; + internal const string ISO2_CODE = "KZ"; + internal const string ISO3_CODE = "KAZ"; + internal const int NUMERIC_CODE = 398; + internal static readonly string[] CALLING_CODE = ["+7"]; + internal const string REGION_TYPE = "Region"; + internal const string CITY_TYPE = "City"; + internal const int EXPECTED_REGION_COUNT = 14; + internal const int EXPECTED_CITY_COUNT = 3; +} + +public sealed class KazakhstanTest +{ + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKazakhstan() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Kazakhstan; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.NotNull(country); + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(KazakhstanTestData.COUNTRY_NAME, country.Name); + Assert.Equal(KazakhstanTestData.OFFICIAL_NAME, country.OfficialName); + Assert.Equal(KazakhstanTestData.NATIVE_NAME, country.NativeName); + Assert.Equal(KazakhstanTestData.CAPITAL, country.Capital); + Assert.Equal(KazakhstanTestData.NUMERIC_CODE, country.NumericCode); + Assert.Equal(KazakhstanTestData.ISO2_CODE, country.ISO2Code); + Assert.Equal(KazakhstanTestData.ISO3_CODE, country.ISO3Code); + Assert.Equal(KazakhstanTestData.CALLING_CODE, country.CallingCode); + + Assert.NotNull(country.States); + Assert.Equal(KazakhstanTestData.EXPECTED_REGION_COUNT + KazakhstanTestData.EXPECTED_CITY_COUNT, country.States.Count()); + Assert.Equal(KazakhstanTestData.EXPECTED_REGION_COUNT, country.States.Count(s => s.Type == KazakhstanTestData.REGION_TYPE)); + Assert.Equal(KazakhstanTestData.EXPECTED_CITY_COUNT, country.States.Count(s => s.Type == KazakhstanTestData.CITY_TYPE)); + } +} From 47bb5a30275e642ffb80ef4e1756d876e1c48b70 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Wed, 10 Sep 2025 11:08:52 +0100 Subject: [PATCH 17/30] update initializer --- src/World.Net/Helpers/CountryInitializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index ed66e81..2b22923 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -92,7 +92,7 @@ public static Dictionary Initialize() { CountryIdentifier.Japan, new Japan() }, { CountryIdentifier.Jersey, new Jersey() }, { CountryIdentifier.Jordan, new Jordan() }, - { CountryIdentifier.Kazakhstan, new World.Net.Countries.Kazakhstan() } + { CountryIdentifier.Kazakhstan, new Kazakhstan() } // Future countries can be added here in the same format. }; From ac0b1d40b7ef4dfe84612be0bb70ec749f686f5e Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 09:29:55 +0100 Subject: [PATCH 18/30] update copilot prompt file --- src/.copilot/generate-country.prompt.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/.copilot/generate-country.prompt.md b/src/.copilot/generate-country.prompt.md index 99b4b14..5610f3f 100644 --- a/src/.copilot/generate-country.prompt.md +++ b/src/.copilot/generate-country.prompt.md @@ -29,6 +29,7 @@ When you are asked to "create a country": - Use immutable properties (fixed values, no setters). - Use the correct `CountryIdentifier.` for `Id`. - All data must be ISO/UN recognized and complete. + - **When generating the `States` property, always provide the type for each state object (e.g., `new State("Kakamega", "KE-11", "County")`). Do not omit the type argument, except if the type is exactly `"Province"` (the default), in which case you may skip it.** 4. **Register in CountryInitializer** - Add the new country to `CountryInitializer.Initialize()` in `src/World.Net/Helpers/CountryInitializer.cs`. @@ -96,6 +97,7 @@ src/World.Net.UnitTests/Countries/NigeriaTest.cs - Follow the naming and ordering conventions strictly. - Use only ISO/UN official data for all country properties. - If a country has subdivisions (states, provinces, etc.), list them in the `States` property using the correct type and ISO codes. +- **Always provide the type argument for each state in the `States` property, unless the type is exactly `"Province"` (the default), in which case you may skip it.** - If you are unsure about a country's data, do not create a placeholderskip or request clarification. --- From 4e10df5968cc53d72898504d8b9c0ec5da02da41 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 09:32:01 +0100 Subject: [PATCH 19/30] add kenya details --- .../Countries/KenyaTest.cs | 43 +++++++++++ src/World.Net/Countries/Kenya.cs | 73 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/KenyaTest.cs create mode 100644 src/World.Net/Countries/Kenya.cs diff --git a/src/World.Net.UnitTests/Countries/KenyaTest.cs b/src/World.Net.UnitTests/Countries/KenyaTest.cs new file mode 100644 index 0000000..1c537fd --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KenyaTest.cs @@ -0,0 +1,43 @@ +using World.Net; +using World.Net.Helpers; + +namespace World.Net.UnitTests.Countries; + +public sealed class KenyaTest +{ + private const string KENYA_COUNTRY_NAME = "Kenya"; + private const string KENYA_NATIVE_NAME = "Kenya"; + private const string KENYA_CAPITAL = "Nairobi"; + private const string KENYA_OFFICIAL_NAME = "Republic of Kenya"; + private const string KENYA_ISO2_CODE = "KE"; + private const string KENYA_ISO3_CODE = "KEN"; + private const int KENYA_NUMERIC_CODE = 404; + private readonly string[] KENYA_CALLING_CODE = ["+254"]; + private const int KENYA_STATE_COUNT = 47; + private static readonly string[] VALID_STATE_TYPES = { "County" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKenya() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Kenya; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.NotNull(country); + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(KENYA_COUNTRY_NAME, country.Name); + Assert.Equal(KENYA_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(KENYA_NATIVE_NAME, country.NativeName); + Assert.Equal(KENYA_CAPITAL, country.Capital); + Assert.Equal(KENYA_NUMERIC_CODE, country.NumericCode); + Assert.Equal(KENYA_ISO2_CODE, country.ISO2Code); + Assert.Equal(KENYA_ISO3_CODE, country.ISO3Code); + Assert.Equal(KENYA_CALLING_CODE, country.CallingCode); + Assert.NotNull(country.States); + Assert.Equal(KENYA_STATE_COUNT, country.States.Count()); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + } +} diff --git a/src/World.Net/Countries/Kenya.cs b/src/World.Net/Countries/Kenya.cs new file mode 100644 index 0000000..2800ae3 --- /dev/null +++ b/src/World.Net/Countries/Kenya.cs @@ -0,0 +1,73 @@ +namespace World.Net.Countries; + +internal sealed class Kenya : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Kenya; + + public string Name => "Kenya"; + + public string OfficialName => "Republic of Kenya"; + + public string NativeName => "Kenya"; + + public string Capital => "Nairobi"; + + public int NumericCode => 404; + + public string ISO2Code => "KE"; + + public string ISO3Code => "KEN"; + + public string[] CallingCode => ["+254"]; + + public IEnumerable States => + [ + new("Baringo", "KE-01", "County"), + new("Bomet", "KE-02", "County"), + new("Bungoma", "KE-03", "County"), + new("Busia", "KE-04", "County"), + new("Elgeyo-Marakwet", "KE-05", "County"), + new("Embu", "KE-06", "County"), + new("Garissa", "KE-07", "County"), + new("Homa Bay", "KE-08", "County"), + new("Isiolo", "KE-09", "County"), + new("Kajiado", "KE-10", "County"), + new("Kakamega", "KE-11", "County"), + new("Kericho", "KE-12", "County"), + new("Kiambu", "KE-13", "County"), + new("Kilifi", "KE-14", "County"), + new("Kirinyaga", "KE-15", "County"), + new("Kisii", "KE-16", "County"), + new("Kisumu", "KE-17", "County"), + new("Kitui", "KE-18", "County"), + new("Kwale", "KE-19", "County"), + new("Laikipia", "KE-20", "County"), + new("Lamu", "KE-21", "County"), + new("Machakos", "KE-22", "County"), + new("Makueni", "KE-23", "County"), + new("Mandera", "KE-24", "County"), + new("Marsabit", "KE-25", "County"), + new("Meru", "KE-26", "County"), + new("Migori", "KE-27", "County"), + new("Mombasa", "KE-28", "County"), + new("Murang'a", "KE-29", "County"), + new("Nairobi City", "KE-30", "County"), + new("Nakuru", "KE-31", "County"), + new("Nandi", "KE-32", "County"), + new("Narok", "KE-33", "County"), + new("Nyamira", "KE-34", "County"), + new("Nyandarua", "KE-35", "County"), + new("Nyeri", "KE-36", "County"), + new("Samburu", "KE-37", "County"), + new("Siaya", "KE-38", "County"), + new("Taita-Taveta", "KE-39", "County"), + new("Tana River", "KE-40", "County"), + new("Tharaka-Nithi", "KE-41", "County"), + new("Trans Nzoia", "KE-42", "County"), + new("Turkana", "KE-43", "County"), + new("Uasin Gishu", "KE-44", "County"), + new("Vihiga", "KE-45", "County"), + new("Wajir", "KE-46", "County"), + new("West Pokot", "KE-47", "County") + ]; +} From 9807581fb3f215a4de04e868235efab1e8181940 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 09:32:20 +0100 Subject: [PATCH 20/30] initialize kenya --- src/World.Net/Helpers/CountryInitializer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 2b22923..a0f93a1 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -92,7 +92,8 @@ public static Dictionary Initialize() { CountryIdentifier.Japan, new Japan() }, { CountryIdentifier.Jersey, new Jersey() }, { CountryIdentifier.Jordan, new Jordan() }, - { CountryIdentifier.Kazakhstan, new Kazakhstan() } + { CountryIdentifier.Kazakhstan, new Kazakhstan() }, + { CountryIdentifier.Kenya, new Kenya() }, // Future countries can be added here in the same format. }; From 3b8b3de95e22c763be03b720c5bbab9ac7a61ab7 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 09:44:00 +0100 Subject: [PATCH 21/30] add kiribati details --- .../Countries/KiribatiTest.cs | 43 +++++++++++++++++++ src/World.Net/Countries/Kiribati.cs | 20 +++++++++ 2 files changed, 63 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/KiribatiTest.cs create mode 100644 src/World.Net/Countries/Kiribati.cs diff --git a/src/World.Net.UnitTests/Countries/KiribatiTest.cs b/src/World.Net.UnitTests/Countries/KiribatiTest.cs new file mode 100644 index 0000000..4997171 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KiribatiTest.cs @@ -0,0 +1,43 @@ +using World.Net; +using World.Net.Helpers; + +namespace World.Net.UnitTests.Countries; + +public sealed class KiribatiTest +{ + private const string KIRIBATI_COUNTRY_NAME = "Kiribati"; + private const string KIRIBATI_NATIVE_NAME = "Kiribati"; + private const string KIRIBATI_CAPITAL = "South Tarawa"; + private const string KIRIBATI_OFFICIAL_NAME = "Republic of Kiribati"; + private const string KIRIBATI_ISO2_CODE = "KI"; + private const string KIRIBATI_ISO3_CODE = "KIR"; + private const int KIRIBATI_NUMERIC_CODE = 296; + private readonly string[] KIRIBATI_CALLING_CODE = ["+686"]; + private const int KIRIBATI_STATE_COUNT = 3; + private static readonly string[] VALID_STATE_TYPES = { "Group" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKiribati() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Kiribati; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.NotNull(country); + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(KIRIBATI_COUNTRY_NAME, country.Name); + Assert.Equal(KIRIBATI_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(KIRIBATI_NATIVE_NAME, country.NativeName); + Assert.Equal(KIRIBATI_CAPITAL, country.Capital); + Assert.Equal(KIRIBATI_NUMERIC_CODE, country.NumericCode); + Assert.Equal(KIRIBATI_ISO2_CODE, country.ISO2Code); + Assert.Equal(KIRIBATI_ISO3_CODE, country.ISO3Code); + Assert.Equal(KIRIBATI_CALLING_CODE, country.CallingCode); + Assert.NotNull(country.States); + Assert.Equal(KIRIBATI_STATE_COUNT, country.States.Count()); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + } +} diff --git a/src/World.Net/Countries/Kiribati.cs b/src/World.Net/Countries/Kiribati.cs new file mode 100644 index 0000000..64de137 --- /dev/null +++ b/src/World.Net/Countries/Kiribati.cs @@ -0,0 +1,20 @@ +namespace World.Net.Countries; + +internal sealed class Kiribati : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Kiribati; + public string Name => "Kiribati"; + public string OfficialName => "Republic of Kiribati"; + public string NativeName => "Kiribati"; + public string Capital => "South Tarawa"; + public int NumericCode => 296; + public string ISO2Code => "KI"; + public string ISO3Code => "KIR"; + public string[] CallingCode => ["+686"]; + public IEnumerable States => + [ + new("Gilbert Islands", "KI-G", "Group"), + new("Line Islands", "KI-L", "Group"), + new("Phoenix Islands", "KI-P", "Group") + ]; +} From 979b905e65991f103fafdfc1c2aca92f8132cc51 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 09:44:09 +0100 Subject: [PATCH 22/30] initialize kiribati --- src/World.Net/Helpers/CountryInitializer.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index a0f93a1..0f76427 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -94,6 +94,7 @@ public static Dictionary Initialize() { CountryIdentifier.Jordan, new Jordan() }, { CountryIdentifier.Kazakhstan, new Kazakhstan() }, { CountryIdentifier.Kenya, new Kenya() }, + { CountryIdentifier.Kiribati, new Kiribati() }, // Future countries can be added here in the same format. }; From fd6963bbfd75778883a661044bf6fddc919487cb Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 12:19:24 +0100 Subject: [PATCH 23/30] add kosovo details --- src/World.Net/Countries/Kosovo.cs | 44 +++++++++++++++++++++ src/World.Net/Helpers/CountryIdentifier.cs | 18 ++++----- src/World.Net/Helpers/CountryInitializer.cs | 1 + 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 src/World.Net/Countries/Kosovo.cs 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/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..aabe0ed 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -95,6 +95,7 @@ public static Dictionary Initialize() { CountryIdentifier.Kazakhstan, new Kazakhstan() }, { CountryIdentifier.Kenya, new Kenya() }, { CountryIdentifier.Kiribati, new Kiribati() }, + { CountryIdentifier.Kosovo, new Kosovo() }, // Future countries can be added here in the same format. }; From 4b3e1e360a36d9730828d62aa8d1337ff1494b32 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 12:20:14 +0100 Subject: [PATCH 24/30] add unit test for kosovo --- .../Countries/KosovoTest.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/KosovoTest.cs 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); + } + } + } +} From c64f018b59b39bed14ffe616eceb30b5bedd92f3 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 12:25:56 +0100 Subject: [PATCH 25/30] add kuwait --- .../Countries/KuwaitTest.cs | 53 +++++++++++++++++++ src/World.Net/Countries/Kuwait.cs | 23 ++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/KuwaitTest.cs create mode 100644 src/World.Net/Countries/Kuwait.cs diff --git a/src/World.Net.UnitTests/Countries/KuwaitTest.cs b/src/World.Net.UnitTests/Countries/KuwaitTest.cs new file mode 100644 index 0000000..d58bb06 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KuwaitTest.cs @@ -0,0 +1,53 @@ +using World.Net; +using World.Net.Countries; +using World.Net.Helpers; +using Xunit; + +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/Countries/Kuwait.cs b/src/World.Net/Countries/Kuwait.cs new file mode 100644 index 0000000..77df2bf --- /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") + ]; +} From 19cf6c4961590494ad072f79d90df325c4b3090a Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 12:26:16 +0100 Subject: [PATCH 26/30] add Kyrgyzstan --- .../Countries/KyrgyzstanTest.cs | 56 +++++++++++++++++++ src/World.Net/Countries/Kyrgyzstan.cs | 26 +++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs create mode 100644 src/World.Net/Countries/Kyrgyzstan.cs diff --git a/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs new file mode 100644 index 0000000..03db25b --- /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"), + ("Ysyk-Kol", "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/Countries/Kyrgyzstan.cs b/src/World.Net/Countries/Kyrgyzstan.cs new file mode 100644 index 0000000..ac1d004 --- /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("Ysyk-Kol", "KG-Y", "Region"), + new State("Bishkek", "KG-GB", "City"), + new State("Osh City", "KG-GO", "City") + ]; +} From 290a1dad0f1625c56baef1c7f3fece1719ddb614 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 12:26:25 +0100 Subject: [PATCH 27/30] initialize states --- src/World.Net/Helpers/CountryInitializer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index aabe0ed..fe1834b 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -96,6 +96,8 @@ public static Dictionary Initialize() { CountryIdentifier.Kenya, new Kenya() }, { CountryIdentifier.Kiribati, new Kiribati() }, { CountryIdentifier.Kosovo, new Kosovo() }, + { CountryIdentifier.Kuwait, new Kuwait() }, + { CountryIdentifier.Kyrgyzstan, new Kyrgyzstan() }, // Future countries can be added here in the same format. }; From 41a3bdce9ee0b8b6cb1741980302ba60188098ca Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 12:39:17 +0100 Subject: [PATCH 28/30] update tests --- src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs | 6 +++--- src/World.Net/Countries/Kyrgyzstan.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs index 03db25b..71b958a 100644 --- a/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs +++ b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs @@ -1,4 +1,4 @@ -using World.Net; +using World.Net; using World.Net.Countries; using World.Net.Helpers; using Xunit; @@ -10,7 +10,7 @@ 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 ExpectedNativeName = "Киргизская Республика"; private const string ExpectedCapital = "Bishkek"; private const int ExpectedNumericCode = 417; private const string ExpectedISO2Code = "KG"; @@ -24,7 +24,7 @@ private static readonly (string Name, string IsoCode, string Type)[] ExpectedSta ("Naryn", "KG-N", "Region"), ("Osh", "KG-O", "Region"), ("Talas", "KG-T", "Region"), - ("Ysyk-Kol", "KG-Y", "Region"), + ("Issyk-Kul", "KG-Y", "Region"), ("Bishkek", "KG-GB", "City"), ("Osh City", "KG-GO", "City") ]; diff --git a/src/World.Net/Countries/Kyrgyzstan.cs b/src/World.Net/Countries/Kyrgyzstan.cs index ac1d004..a71586e 100644 --- a/src/World.Net/Countries/Kyrgyzstan.cs +++ b/src/World.Net/Countries/Kyrgyzstan.cs @@ -1,11 +1,11 @@ -namespace World.Net.Countries; +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 NativeName { get; } = "Киргизская Республика"; public string Capital { get; } = "Bishkek"; public int NumericCode { get; } = 417; public string ISO2Code { get; } = "KG"; @@ -19,7 +19,7 @@ internal sealed class Kyrgyzstan : ICountry new State("Naryn", "KG-N", "Region"), new State("Osh", "KG-O", "Region"), new State("Talas", "KG-T", "Region"), - new State("Ysyk-Kol", "KG-Y", "Region"), + new State("Issyk-Kul", "KG-Y", "Region"), new State("Bishkek", "KG-GB", "City"), new State("Osh City", "KG-GO", "City") ]; From e064106f71826d34f60ca64e8592cf48f806467e Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 11 Sep 2025 14:34:55 +0100 Subject: [PATCH 29/30] update kuwait --- src/World.Net.UnitTests/Countries/KuwaitTest.cs | 4 ++-- src/World.Net/Countries/Kuwait.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/KuwaitTest.cs b/src/World.Net.UnitTests/Countries/KuwaitTest.cs index d58bb06..98c8c08 100644 --- a/src/World.Net.UnitTests/Countries/KuwaitTest.cs +++ b/src/World.Net.UnitTests/Countries/KuwaitTest.cs @@ -1,4 +1,4 @@ -using World.Net; +using World.Net; using World.Net.Countries; using World.Net.Helpers; using Xunit; @@ -10,7 +10,7 @@ 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 ExpectedNativeName = "دولة الكويت"; private const string ExpectedCapital = "Kuwait City"; private const int ExpectedNumericCode = 414; private const string ExpectedISO2Code = "KW"; diff --git a/src/World.Net/Countries/Kuwait.cs b/src/World.Net/Countries/Kuwait.cs index 77df2bf..e01047c 100644 --- a/src/World.Net/Countries/Kuwait.cs +++ b/src/World.Net/Countries/Kuwait.cs @@ -1,11 +1,11 @@ -namespace World.Net.Countries; +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 NativeName { get; } = "دولة الكويت"; public string Capital { get; } = "Kuwait City"; public int NumericCode { get; } = 414; public string ISO2Code { get; } = "KW"; From b184d48bd8562437c2f37cf9cfb5e23278a49030 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sat, 4 Oct 2025 23:46:09 +0100 Subject: [PATCH 30/30] remove unused --- src/World.Net.UnitTests/Countries/KuwaitTest.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/KuwaitTest.cs b/src/World.Net.UnitTests/Countries/KuwaitTest.cs index 98c8c08..58a97c1 100644 --- a/src/World.Net.UnitTests/Countries/KuwaitTest.cs +++ b/src/World.Net.UnitTests/Countries/KuwaitTest.cs @@ -1,9 +1,4 @@ -using World.Net; -using World.Net.Countries; -using World.Net.Helpers; -using Xunit; - -namespace World.Net.UnitTests.Countries +namespace World.Net.UnitTests.Countries { public class KuwaitTest {