Skip to content

Commit 7621577

Browse files
authored
Merge pull request #69 from deanology/feature/gabon-countryy-details
Add Gabon support with tests and country registration
2 parents a9bf284 + 9ce4a91 commit 7621577

3 files changed

Lines changed: 96 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class GabonTest : AssertCountryTestBase
4+
{
5+
private const string GABON_COUNTRY_NAME = "Gabon";
6+
private const string GABON_NATIVE_NAME = "Republique gabonaise";
7+
private const string GABON_CAPITAL = "Libreville";
8+
private const string GABON_OFFICIAL_NAME = "Gabonese Republic";
9+
private const string GABON_ISO2_CODE = "GA";
10+
private const string GABON_ISO3_CODE = "GAB";
11+
private const int GABON_NUMERIC_CODE = 266;
12+
private readonly string[] GABON_CALLING_CODE = ["+241"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Gabon;
14+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
15+
[
16+
new("Estuaire", "GA-1", "Province"),
17+
new("Haut-Ogooue", "GA-2", "Province"),
18+
new("Moyen-Ogooue", "GA-3", "Province"),
19+
new("Ngounie", "GA-4", "Province"),
20+
new("Nyanga", "GA-5", "Province"),
21+
new("Ogooue-Ivindo", "GA-6", "Province"),
22+
new("Ogooue-Lolo", "GA-7", "Province"),
23+
new("Ogooue-Maritime", "GA-8", "Province"),
24+
new("Woleu-Ntem", "GA-9", "Province")
25+
];
26+
27+
[Fact]
28+
public void GetCountry_ReturnsCorrectInformation_ForGabon()
29+
{
30+
// Arrange
31+
// Act
32+
var country = CountryProvider.GetCountry(EXPECTEDID);
33+
34+
// Assert
35+
AssertCorrectInformation(
36+
country,
37+
EXPECTEDID,
38+
GABON_COUNTRY_NAME,
39+
GABON_OFFICIAL_NAME,
40+
GABON_NATIVE_NAME,
41+
GABON_CAPITAL,
42+
GABON_NUMERIC_CODE,
43+
GABON_ISO2_CODE,
44+
GABON_ISO3_CODE,
45+
GABON_CALLING_CODE,
46+
EXPECTED_STATES
47+
);
48+
}
49+
}
50+

src/World.Net/Countries/Gabon.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Gabon : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Gabon;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Gabon";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Gabonese Republic";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Republique gabonaise";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Libreville";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 266;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "GA";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "GAB";
28+
29+
//<inheritdoc/>
30+
public string[] CallingCode { get; } = ["+241"];
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Estuaire", "GA-1"),
36+
new("Haut-Ogooue", "GA-2"),
37+
new("Moyen-Ogooue", "GA-3"),
38+
new("Ngounie", "GA-4"),
39+
new("Nyanga", "GA-5"),
40+
new("Ogooue-Ivindo", "GA-6"),
41+
new("Ogooue-Lolo", "GA-7"),
42+
new("Ogooue-Maritime", "GA-8"),
43+
new("Woleu-Ntem", "GA-9")
44+
];
45+
}

src/World.Net/Helpers/CountryInitializer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
8484
{ CountryIdentifier.France, new France() },
8585
{ CountryIdentifier.FrenchGuiana, new FrenchGuiana() },
8686
{ CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() },
87+
{ CountryIdentifier.Gabon, new Gabon() },
8788
{ CountryIdentifier.Iraq, new Iraq() },
8889
{ CountryIdentifier.Ireland, new Ireland() },
8990
{ CountryIdentifier.Israel, new Israel() },

0 commit comments

Comments
 (0)