Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions src/World.Net.UnitTests/Countries/GabonTest.cs
Original file line number Diff line number Diff line change
@@ -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 = "Republique 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-Ogooue", "GA-2", "Province"),
new("Moyen-Ogooue", "GA-3", "Province"),
new("Ngounie", "GA-4", "Province"),
new("Nyanga", "GA-5", "Province"),
new("Ogooue-Ivindo", "GA-6", "Province"),
new("Ogooue-Lolo", "GA-7", "Province"),
new("Ogooue-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
);
}
}

45 changes: 45 additions & 0 deletions src/World.Net/Countries/Gabon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace World.Net.Countries;

internal sealed class Gabon : ICountry
{
//<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Gabon;

//<inheritdoc/>
public string Name { get; } = "Gabon";

//<inheritdoc/>
public string OfficialName { get; } = "Gabonese Republic";

//<inheritdoc/>
public string NativeName => "Republique gabonaise";

//<inheritdoc/>
public string Capital { get; } = "Libreville";

//<inheritdoc/>
public int NumericCode { get; } = 266;

//<inheritdoc/>
public string ISO2Code { get; } = "GA";

//<inheritdoc/>
public string ISO3Code { get; } = "GAB";

//<inheritdoc/>
public string[] CallingCode { get; } = ["+241"];

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Estuaire", "GA-1"),
new("Haut-Ogooue", "GA-2"),
new("Moyen-Ogooue", "GA-3"),
new("Ngounie", "GA-4"),
new("Nyanga", "GA-5"),
new("Ogooue-Ivindo", "GA-6"),
new("Ogooue-Lolo", "GA-7"),
new("Ogooue-Maritime", "GA-8"),
new("Woleu-Ntem", "GA-9")
];
}
1 change: 1 addition & 0 deletions src/World.Net/Helpers/CountryInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public static Dictionary<CountryIdentifier, ICountry> 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() },
Expand Down