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
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/DominicanRepublicTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class DominicanRepublicTest
{
private const string DOMINICANREPUBLIC_COUNTRY_NAME = "Dominican Republic";
private const string DOMINICANREPUBLIC_NATIVE_NAME = "República Dominicana";
private const string DOMINICANREPUBLIC_CAPITAL = "Santo Domingo";
private const string DOMINICANREPUBLIC_OFFICIAL_NAME = "Dominican Republic";
private const string DOMINICANREPUBLIC_ISO2_CODE = "DO";
private const string DOMINICANREPUBLIC_ISO3_CODE = "DOM";
private const int DOMINICANREPUBLIC_NUMERIC_CODE = 214;
private readonly string[] DOMINICANREPUBLIC_CALLING_CODE = ["+1-809", "+1-829", "+1-849"];
private const int DOMINICANREPUBLIC_STATE_COUNT = 32; // 31 provinces + 1 National District
private static readonly string[] VALID_STATE_TYPES = { "Province", "National District" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForDominicanRepublic()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.DominicanRepublic;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(DOMINICANREPUBLIC_COUNTRY_NAME, country.Name);
Assert.Equal(DOMINICANREPUBLIC_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(DOMINICANREPUBLIC_NATIVE_NAME, country.NativeName);
Assert.Equal(DOMINICANREPUBLIC_CAPITAL, country.Capital);
Assert.Equal(DOMINICANREPUBLIC_NUMERIC_CODE, country.NumericCode);
Assert.Equal(DOMINICANREPUBLIC_ISO2_CODE, country.ISO2Code);
Assert.Equal(DOMINICANREPUBLIC_ISO3_CODE, country.ISO3Code);
Assert.Equal(DOMINICANREPUBLIC_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(DOMINICANREPUBLIC_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/EcuadorTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class EcuadorTest
{
private const string ECUADOR_COUNTRY_NAME = "Ecuador";
private const string ECUADOR_NATIVE_NAME = "República del Ecuador";
private const string ECUADOR_CAPITAL = "Quito";
private const string ECUADOR_OFFICIAL_NAME = "Republic of Ecuador";
private const string ECUADOR_ISO2_CODE = "EC";
private const string ECUADOR_ISO3_CODE = "ECU";
private const int ECUADOR_NUMERIC_CODE = 218;
private readonly string[] ECUADOR_CALLING_CODE = ["+593"];
private const int ECUADOR_STATE_COUNT = 24; // 24 provinces
private static readonly string[] VALID_STATE_TYPES = { "Province" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForEcuador()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Ecuador;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(ECUADOR_COUNTRY_NAME, country.Name);
Assert.Equal(ECUADOR_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(ECUADOR_NATIVE_NAME, country.NativeName);
Assert.Equal(ECUADOR_CAPITAL, country.Capital);
Assert.Equal(ECUADOR_NUMERIC_CODE, country.NumericCode);
Assert.Equal(ECUADOR_ISO2_CODE, country.ISO2Code);
Assert.Equal(ECUADOR_ISO3_CODE, country.ISO3Code);
Assert.Equal(ECUADOR_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(ECUADOR_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/EgyptTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class EgyptTest
{
private const string EGYPT_COUNTRY_NAME = "Egypt";
private const string EGYPT_NATIVE_NAME = "جمهورية مصر العربية";
private const string EGYPT_CAPITAL = "Cairo";
private const string EGYPT_OFFICIAL_NAME = "Arab Republic of Egypt";
private const string EGYPT_ISO2_CODE = "EG";
private const string EGYPT_ISO3_CODE = "EGY";
private const int EGYPT_NUMERIC_CODE = 818;
private readonly string[] EGYPT_CALLING_CODE = ["+20"];
private const int EGYPT_STATE_COUNT = 27; // 27 Governorates
private static readonly string[] VALID_STATE_TYPES = { "Governorate" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForEgypt()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Egypt;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(EGYPT_COUNTRY_NAME, country.Name);
Assert.Equal(EGYPT_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(EGYPT_NATIVE_NAME, country.NativeName);
Assert.Equal(EGYPT_CAPITAL, country.Capital);
Assert.Equal(EGYPT_NUMERIC_CODE, country.NumericCode);
Assert.Equal(EGYPT_ISO2_CODE, country.ISO2Code);
Assert.Equal(EGYPT_ISO3_CODE, country.ISO3Code);
Assert.Equal(EGYPT_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(EGYPT_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/TimorLesteTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class TimorLesteTest
{
private const string TIMORLESTE_COUNTRY_NAME = "Timor-Leste";
private const string TIMORLESTE_NATIVE_NAME = "Repúblika Demokrátika Timór-Leste";
private const string TIMORLESTE_CAPITAL = "Dili";
private const string TIMORLESTE_OFFICIAL_NAME = "Democratic Republic of Timor-Leste";
private const string TIMORLESTE_ISO2_CODE = "TL";
private const string TIMORLESTE_ISO3_CODE = "TLS";
private const int TIMORLESTE_NUMERIC_CODE = 626;
private readonly string[] TIMORLESTE_CALLING_CODE = ["+670"];
private const int TIMORLESTE_STATE_COUNT = 13; // 12 municipalities + 1 special administrative region
private static readonly string[] VALID_STATE_TYPES = { "Municipality", "Special Administrative Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForTimorLeste()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.TimorLeste;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(TIMORLESTE_COUNTRY_NAME, country.Name);
Assert.Equal(TIMORLESTE_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(TIMORLESTE_NATIVE_NAME, country.NativeName);
Assert.Equal(TIMORLESTE_CAPITAL, country.Capital);
Assert.Equal(TIMORLESTE_NUMERIC_CODE, country.NumericCode);
Assert.Equal(TIMORLESTE_ISO2_CODE, country.ISO2Code);
Assert.Equal(TIMORLESTE_ISO3_CODE, country.ISO3Code);
Assert.Equal(TIMORLESTE_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(TIMORLESTE_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
69 changes: 69 additions & 0 deletions src/World.Net/Countries/DominicanRepublic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "República Dominicana";

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

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

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

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

//<inheritdoc/>
public string[] CallingCode { get; } = ["+1-809", "+1-829", "+1-849"];

//<inheritdoc/>
//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Azua", "DO-02"),
new("Bahoruco", "DO-03"),
new("Barahona", "DO-04"),
new("Dajabón", "DO-05"),
new("Distrito Nacional", "DO-01", "National District"),
new("Duarte", "DO-06"),
new("El Seibo", "DO-08"),
new("Elias Piña", "DO-07"),
new("Espaillat", "DO-09"),
new("Hato Mayor", "DO-30"),
new("Hermanas Mirabal", "DO-19"),
new("Independencia", "DO-10"),
new("La Altagracia", "DO-11"),
new("La Romana", "DO-12"),
new("La Vega", "DO-13"),
new("Maria Trinidad Sanchez", "DO-14"),
new("Monseñor Nouel", "DO-28"),
new("Monte Cristi", "DO-15"),
new("Monte Plata", "DO-29"),
new("Pedernales", "DO-16"),
new("Peravia", "DO-17"),
new("Puerto Plata", "DO-18"),
new("Samana", "DO-20"),
new("San Cristobal", "DO-21"),
new("San Jose de Ocoa", "DO-31"),
new("San Juan", "DO-22"),
new("San Pedro de Macoris", "DO-23"),
new("Sanchez Ramirez", "DO-24"),
new("Santiago", "DO-25"),
new("Santiago Rodriguez", "DO-26"),
new("Santo Domingo", "DO-32"),
new("Valverde", "DO-27")
];
}
60 changes: 60 additions & 0 deletions src/World.Net/Countries/Ecuador.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "República del Ecuador";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Azuay", "EC-A"),
new("Bolívar", "EC-B"),
new("Cañar", "EC-F"),
new("Carchi", "EC-C"),
new("Chimborazo", "EC-H"),
new("Cotopaxi", "EC-X"),
new("El Oro", "EC-O"),
new("Esmeraldas", "EC-E"),
new("Galápagos", "EC-W"),
new("Guayas", "EC-G"),
new("Imbabura", "EC-I"),
new("Loja", "EC-L"),
new("Los Ríos", "EC-R"),
new("Manabí", "EC-M"),
new("Morona Santiago", "EC-S"),
new("Napo", "EC-N"),
new("Orellana", "EC-D"),
new("Pastaza", "EC-Y"),
new("Pichincha", "EC-P"),
new("Santa Elena", "EC-SE"),
new("Santo Domingo de los Tsáchilas", "EC-SD"),
new("Sucumbíos", "EC-U"),
new("Tungurahua", "EC-T"),
new("Zamora Chinchipe", "EC-Z")
];
}
63 changes: 63 additions & 0 deletions src/World.Net/Countries/Egypt.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
namespace World.Net.Countries;

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

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

//<inheritdoc/>
public string OfficialName { get; } = "Arab Republic of Egypt";

//<inheritdoc/>
public string NativeName => "جمهورية مصر العربية";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Alexandria", "EG-ALX", "Governorate"),
new("Aswan", "EG-ASN", "Governorate"),
new("Asyut", "EG-AST", "Governorate"),
new("Beheira", "EG-BH", "Governorate"),
new("Beni Suef", "EG-BNS", "Governorate"),
new("Cairo", "EG-C", "Governorate"),
new("Dakahlia", "EG-DK", "Governorate"),
new("Damietta", "EG-DT", "Governorate"),
new("Faiyum", "EG-FYM", "Governorate"),
new("Gharbia", "EG-GH", "Governorate"),
new("Giza", "EG-GZ", "Governorate"),
new("Ismailia", "EG-IS", "Governorate"),
new("Kafr El Sheikh", "EG-KFS", "Governorate"),
new("Luxor", "EG-LX", "Governorate"),
new("Matrouh", "EG-MT", "Governorate"),
new("Minya", "EG-MN", "Governorate"),
new("Monufia", "EG-MNF", "Governorate"),
new("New Valley", "EG-WAD", "Governorate"),
new("North Sinai", "EG-SIN", "Governorate"),
new("Port Said", "EG-PTS", "Governorate"),
new("Qalyubia", "EG-KB", "Governorate"),
new("Qena", "EG-QN", "Governorate"),
new("Red Sea", "EG-BA", "Governorate"),
new("Sharqia", "EG-SHR", "Governorate"),
new("Sohag", "EG-SHG", "Governorate"),
new("South Sinai", "EG-JS", "Governorate"),
new("Suez", "EG-SUZ", "Governorate")
];
}
Loading