From 9eeee5e245f6b9c9c6e492cba74cbf70f5e84546 Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 11 Sep 2025 19:13:28 +0100 Subject: [PATCH 1/6] Add Gabon support with tests and country registration This commit introduces support for the country Gabon in the application. It includes updates to the `CountryInitializer` to register Gabon, the implementation of the `Gabon` class adhering to the `ICountry` interface, and the addition of unit tests in `GabonTest` to ensure the accuracy of the country information provided by the `CountryProvider`. --- src/World.Net.UnitTests/GabonTest.cs | 24 +++++++++++ src/World.Net/Countries/Gabon.cs | 45 +++++++++++++++++++++ src/World.Net/Country.cs | 0 src/World.Net/Helpers/CountryInitializer.cs | 1 + 4 files changed, 70 insertions(+) create mode 100644 src/World.Net.UnitTests/GabonTest.cs create mode 100644 src/World.Net/Countries/Gabon.cs create mode 100644 src/World.Net/Country.cs diff --git a/src/World.Net.UnitTests/GabonTest.cs b/src/World.Net.UnitTests/GabonTest.cs new file mode 100644 index 0000000..d69b535 --- /dev/null +++ b/src/World.Net.UnitTests/GabonTest.cs @@ -0,0 +1,24 @@ +using World.Net.Countries; +using World.Net.Helpers; +using Xunit; + +namespace World.Net.UnitTests; + +public class GabonTest +{ + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForGabon() + { + var country = CountryProvider.GetCountry(CountryIdentifier.Gabon); + + Assert.Equal(CountryIdentifier.Gabon, country.Id); + Assert.Equal("Gabon", country.Name); + Assert.Equal("Gabonese Republic", country.OfficialName); + Assert.Equal("République gabonaise", country.NativeName); + Assert.Equal("Libreville", country.Capital); + Assert.Equal(266, country.NumericCode); + Assert.Equal("GA", country.ISO2Code); + Assert.Equal("GAB", country.ISO3Code); + Assert.Equal(new[] { "+241" }, country.CallingCode); + } +} diff --git a/src/World.Net/Countries/Gabon.cs b/src/World.Net/Countries/Gabon.cs new file mode 100644 index 0000000..fec65b5 --- /dev/null +++ b/src/World.Net/Countries/Gabon.cs @@ -0,0 +1,45 @@ +namespace World.Net.Countries; + +internal sealed class Gabon : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Gabon; + + // + public string Name { get; } = "Gabon"; + + // + public string OfficialName { get; } = "Gabonese Republic"; + + // + public string NativeName => "République gabonaise"; + + // + public string Capital { get; } = "Libreville"; + + // + public int NumericCode { get; } = 266; + + // + public string ISO2Code { get; } = "GA"; + + // + public string ISO3Code { get; } = "GAB"; + + // + public string[] CallingCode { get; } = ["+241"]; + + // + public IEnumerable States => + [ + new("Estuaire", "GA-1"), + new("Haut-Ogooué", "GA-2"), + new("Moyen-Ogooué", "GA-3"), + new("Ngounié", "GA-4"), + new("Nyanga", "GA-5"), + new("Ogooué-Ivindo", "GA-6"), + new("Ogooué-Lolo", "GA-7"), + new("Ogooué-Maritime", "GA-8"), + new("Woleu-Ntem", "GA-9") + ]; +} diff --git a/src/World.Net/Country.cs b/src/World.Net/Country.cs new file mode 100644 index 0000000..e69de29 diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 0f76427..03c4595 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -84,6 +84,7 @@ public static Dictionary Initialize() { CountryIdentifier.France, new France() }, { CountryIdentifier.FrenchGuiana, new FrenchGuiana() }, { CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() }, + { CountryIdentifier.Gabon, new Gabon() }, { CountryIdentifier.Iraq, new Iraq() }, { CountryIdentifier.Ireland, new Ireland() }, { CountryIdentifier.Israel, new Israel() }, From 53c7855261d92dd19e1f3e77393039207a2eff3f Mon Sep 17 00:00:00 2001 From: IDAM Date: Sun, 12 Oct 2025 22:35:14 +0100 Subject: [PATCH 2/6] Updated Gabon Test --- .../Countries/GabonTest.cs | 50 +++++++++++++++++++ src/World.Net.UnitTests/GabonTest.cs | 24 --------- 2 files changed, 50 insertions(+), 24 deletions(-) create mode 100644 src/World.Net.UnitTests/Countries/GabonTest.cs delete mode 100644 src/World.Net.UnitTests/GabonTest.cs diff --git a/src/World.Net.UnitTests/Countries/GabonTest.cs b/src/World.Net.UnitTests/Countries/GabonTest.cs new file mode 100644 index 0000000..0100ec8 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/GabonTest.cs @@ -0,0 +1,50 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class GabonTest : AssertCountryTestBase +{ + private const string GABON_COUNTRY_NAME = "Gabon"; + private const string GABON_NATIVE_NAME = "République gabonaise"; + private const string GABON_CAPITAL = "Libreville"; + private const string GABON_OFFICIAL_NAME = "Gabonese Republic"; + private const string GABON_ISO2_CODE = "GA"; + private const string GABON_ISO3_CODE = "GAB"; + private const int GABON_NUMERIC_CODE = 266; + private readonly string[] GABON_CALLING_CODE = ["+241"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Gabon; + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Estuaire", "GA-1", "Province"), + new("Haut-Ogooué", "GA-2", "Province"), + new("Moyen-Ogooué", "GA-3", "Province"), + new("Ngounié", "GA-4", "Province"), + new("Nyanga", "GA-5", "Province"), + new("Ogooué-Ivindo", "GA-6", "Province"), + new("Ogooué-Lolo", "GA-7", "Province"), + new("Ogooué-Maritime", "GA-8", "Province"), + new("Woleu-Ntem", "GA-9", "Province") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForGabon() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + GABON_COUNTRY_NAME, + GABON_OFFICIAL_NAME, + GABON_NATIVE_NAME, + GABON_CAPITAL, + GABON_NUMERIC_CODE, + GABON_ISO2_CODE, + GABON_ISO3_CODE, + GABON_CALLING_CODE, + EXPECTED_STATES + ); + } +} + diff --git a/src/World.Net.UnitTests/GabonTest.cs b/src/World.Net.UnitTests/GabonTest.cs deleted file mode 100644 index d69b535..0000000 --- a/src/World.Net.UnitTests/GabonTest.cs +++ /dev/null @@ -1,24 +0,0 @@ -using World.Net.Countries; -using World.Net.Helpers; -using Xunit; - -namespace World.Net.UnitTests; - -public class GabonTest -{ - [Fact] - public void GetCountry_ReturnsCorrectInformation_ForGabon() - { - var country = CountryProvider.GetCountry(CountryIdentifier.Gabon); - - Assert.Equal(CountryIdentifier.Gabon, country.Id); - Assert.Equal("Gabon", country.Name); - Assert.Equal("Gabonese Republic", country.OfficialName); - Assert.Equal("République gabonaise", country.NativeName); - Assert.Equal("Libreville", country.Capital); - Assert.Equal(266, country.NumericCode); - Assert.Equal("GA", country.ISO2Code); - Assert.Equal("GAB", country.ISO3Code); - Assert.Equal(new[] { "+241" }, country.CallingCode); - } -} From 537f25d57b60862d862ac49b3fd4e7953a5934ad Mon Sep 17 00:00:00 2001 From: IDAM Date: Sun, 12 Oct 2025 22:47:01 +0100 Subject: [PATCH 3/6] =?UTF-8?q?update=20R=C3=A9publique=20gabonaise=20to?= =?UTF-8?q?=20Republique=20gabonaise?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/World.Net.UnitTests/Countries/GabonTest.cs | 2 +- src/World.Net/Countries/Gabon.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/GabonTest.cs b/src/World.Net.UnitTests/Countries/GabonTest.cs index 0100ec8..afc0100 100644 --- a/src/World.Net.UnitTests/Countries/GabonTest.cs +++ b/src/World.Net.UnitTests/Countries/GabonTest.cs @@ -3,7 +3,7 @@ public sealed class GabonTest : AssertCountryTestBase { private const string GABON_COUNTRY_NAME = "Gabon"; - private const string GABON_NATIVE_NAME = "République gabonaise"; + private const string GABON_NATIVE_NAME = "Republique gabonaise"; private const string GABON_CAPITAL = "Libreville"; private const string GABON_OFFICIAL_NAME = "Gabonese Republic"; private const string GABON_ISO2_CODE = "GA"; diff --git a/src/World.Net/Countries/Gabon.cs b/src/World.Net/Countries/Gabon.cs index fec65b5..6ff67af 100644 --- a/src/World.Net/Countries/Gabon.cs +++ b/src/World.Net/Countries/Gabon.cs @@ -12,7 +12,7 @@ internal sealed class Gabon : ICountry public string OfficialName { get; } = "Gabonese Republic"; // - public string NativeName => "République gabonaise"; + public string NativeName => "Republique gabonaise"; // public string Capital { get; } = "Libreville"; From feb59eb3e20bcaefdbbc9281e738a7039a9f4d32 Mon Sep 17 00:00:00 2001 From: IDAM Date: Sun, 12 Oct 2025 22:55:30 +0100 Subject: [PATCH 4/6] reverted all special e to normal e in gabon --- src/World.Net.UnitTests/Countries/GabonTest.cs | 10 +++++----- src/World.Net/Countries/Gabon.cs | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/GabonTest.cs b/src/World.Net.UnitTests/Countries/GabonTest.cs index afc0100..762459e 100644 --- a/src/World.Net.UnitTests/Countries/GabonTest.cs +++ b/src/World.Net.UnitTests/Countries/GabonTest.cs @@ -14,12 +14,12 @@ public sealed class GabonTest : AssertCountryTestBase private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = [ new("Estuaire", "GA-1", "Province"), - new("Haut-Ogooué", "GA-2", "Province"), - new("Moyen-Ogooué", "GA-3", "Province"), - new("Ngounié", "GA-4", "Province"), + new("Haut-Ogooue", "GA-2", "Province"), + new("Moyen-Ogooue", "GA-3", "Province"), + new("Ngounie", "GA-4", "Province"), new("Nyanga", "GA-5", "Province"), - new("Ogooué-Ivindo", "GA-6", "Province"), - new("Ogooué-Lolo", "GA-7", "Province"), + new("Ogooue-Ivindo", "GA-6", "Province"), + new("Ogooue-Lolo", "GA-7", "Province"), new("Ogooué-Maritime", "GA-8", "Province"), new("Woleu-Ntem", "GA-9", "Province") ]; diff --git a/src/World.Net/Countries/Gabon.cs b/src/World.Net/Countries/Gabon.cs index 6ff67af..cf961cb 100644 --- a/src/World.Net/Countries/Gabon.cs +++ b/src/World.Net/Countries/Gabon.cs @@ -33,13 +33,13 @@ internal sealed class Gabon : ICountry public IEnumerable States => [ new("Estuaire", "GA-1"), - new("Haut-Ogooué", "GA-2"), - new("Moyen-Ogooué", "GA-3"), - new("Ngounié", "GA-4"), + new("Haut-Ogooue", "GA-2"), + new("Moyen-Ogooue", "GA-3"), + new("Ngounie", "GA-4"), new("Nyanga", "GA-5"), - new("Ogooué-Ivindo", "GA-6"), - new("Ogooué-Lolo", "GA-7"), - new("Ogooué-Maritime", "GA-8"), + new("Ogooue-Ivindo", "GA-6"), + new("Ogooue-Lolo", "GA-7"), + new("Ogooue-Maritime", "GA-8"), new("Woleu-Ntem", "GA-9") ]; } From d9ffd532a683032a62a845a55550b3a0c8a4d1c4 Mon Sep 17 00:00:00 2001 From: IDAM Date: Sun, 12 Oct 2025 22:58:21 +0100 Subject: [PATCH 5/6] updated one more e --- src/World.Net.UnitTests/Countries/GabonTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/World.Net.UnitTests/Countries/GabonTest.cs b/src/World.Net.UnitTests/Countries/GabonTest.cs index 762459e..8315945 100644 --- a/src/World.Net.UnitTests/Countries/GabonTest.cs +++ b/src/World.Net.UnitTests/Countries/GabonTest.cs @@ -20,7 +20,7 @@ private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_ST new("Nyanga", "GA-5", "Province"), new("Ogooue-Ivindo", "GA-6", "Province"), new("Ogooue-Lolo", "GA-7", "Province"), - new("Ogooué-Maritime", "GA-8", "Province"), + new("Ogooue-Maritime", "GA-8", "Province"), new("Woleu-Ntem", "GA-9", "Province") ]; From 9ce4a91aaf9ea4ae119ea1e7b8e2aee50fcfe146 Mon Sep 17 00:00:00 2001 From: IDAM Date: Sun, 12 Oct 2025 23:05:29 +0100 Subject: [PATCH 6/6] Removed unused class --- src/World.Net/Country.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/World.Net/Country.cs diff --git a/src/World.Net/Country.cs b/src/World.Net/Country.cs deleted file mode 100644 index e69de29..0000000