Skip to content

Commit c94553f

Browse files
authored
Oman - Puerto Rico (#94)
* Nigeria, Niue, NorkfolkIsland, NorthernMarina, North Korea, North Macedonia, Norway * country initializer updated * Add country classes and unit tests for multiple nations This commit introduces new country classes for Oman, Pakistan, Palau, Palestine, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Pitcairn Islands, Poland, Portugal, and Puerto Rico. Each class implements the `ICountry` interface, providing essential properties such as `Id`, `Name`, `OfficialName`, `NativeName`, `Capital`, `NumericCode`, `ISO2Code`, `ISO3Code`, `CallingCode`, and a list of `States`. Additionally, unit tests have been created to ensure the `CountryProvider.GetCountry` method returns accurate information for each country.
1 parent 6c6163b commit c94553f

27 files changed

Lines changed: 1384 additions & 1 deletion
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class OmanTest : AssertCountryTestBase
4+
{
5+
private const string OMAN_COUNTRY_NAME = "Oman";
6+
private const string OMAN_NATIVE_NAME = "عُمان";
7+
private const string OMAN_CAPITAL = "Muscat";
8+
private const string OMAN_OFFICIAL_NAME = "Sultanate of Oman";
9+
private const string OMAN_ISO2_CODE = "OM";
10+
private const string OMAN_ISO3_CODE = "OMN";
11+
private const int OMAN_NUMERIC_CODE = 512;
12+
private readonly string[] OMAN_CALLING_CODE = ["+968"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Oman;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Ad Dakhiliyah", "OM-DA", "Governorate"),
18+
new("Ad Dhahirah", "OM-ZA", "Governorate"),
19+
new("Al Batinah North", "OM-BN", "Governorate"),
20+
new("Al Batinah South", "OM-BS", "Governorate"),
21+
new("Al Wusta", "OM-WU", "Governorate"),
22+
new("Ash Sharqiyah North", "OM-SH", "Governorate"),
23+
new("Ash Sharqiyah South", "OM-SS", "Governorate"),
24+
new("Dhofar", "OM-ZU", "Governorate"),
25+
new("Muscat", "OM-MU", "Governorate"),
26+
new("Musandam", "OM-MN", "Governorate"),
27+
new("Al Buraimi", "OM-BR", "Governorate")
28+
];
29+
30+
[Fact]
31+
public void GetCountry_ReturnsCorrectInformation_ForOman()
32+
{
33+
// Arrange
34+
// Act
35+
var country = CountryProvider.GetCountry(EXPECTEDID);
36+
37+
// Assert
38+
AssertCorrectInformation(
39+
country,
40+
EXPECTEDID,
41+
OMAN_COUNTRY_NAME,
42+
OMAN_OFFICIAL_NAME,
43+
OMAN_NATIVE_NAME,
44+
OMAN_CAPITAL,
45+
OMAN_NUMERIC_CODE,
46+
OMAN_ISO2_CODE,
47+
OMAN_ISO3_CODE,
48+
OMAN_CALLING_CODE,
49+
EXPECTED_STATES
50+
);
51+
}
52+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class PakistanTest : AssertCountryTestBase
4+
{
5+
private const string PAKISTAN_COUNTRY_NAME = "Pakistan";
6+
private const string PAKISTAN_NATIVE_NAME = "پاکستان";
7+
private const string PAKISTAN_CAPITAL = "Islamabad";
8+
private const string PAKISTAN_OFFICIAL_NAME = "Islamic Republic of Pakistan";
9+
private const string PAKISTAN_ISO2_CODE = "PK";
10+
private const string PAKISTAN_ISO3_CODE = "PAK";
11+
private const int PAKISTAN_NUMERIC_CODE = 586;
12+
private readonly string[] PAKISTAN_CALLING_CODE = ["+92"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Pakistan;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Balochistan", "PK-BA", "Province"),
18+
new("Khyber Pakhtunkhwa", "PK-KP", "Province"),
19+
new("Punjab", "PK-PB", "Province"),
20+
new("Sindh", "PK-SD", "Province"),
21+
new("Gilgit-Baltistan", "PK-GB", "Autonomous Territory"),
22+
new("Azad Jammu and Kashmir", "PK-AJ", "Autonomous Territory"),
23+
new("Islamabad Capital Territory", "PK-IS", "Federal Territory")
24+
];
25+
26+
[Fact]
27+
public void GetCountry_ReturnsCorrectInformation_ForPakistan()
28+
{
29+
// Arrange
30+
// Act
31+
var country = CountryProvider.GetCountry(EXPECTEDID);
32+
33+
// Assert
34+
AssertCorrectInformation(
35+
country,
36+
EXPECTEDID,
37+
PAKISTAN_COUNTRY_NAME,
38+
PAKISTAN_OFFICIAL_NAME,
39+
PAKISTAN_NATIVE_NAME,
40+
PAKISTAN_CAPITAL,
41+
PAKISTAN_NUMERIC_CODE,
42+
PAKISTAN_ISO2_CODE,
43+
PAKISTAN_ISO3_CODE,
44+
PAKISTAN_CALLING_CODE,
45+
EXPECTED_STATES
46+
);
47+
}
48+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class PalauTest : AssertCountryTestBase
4+
{
5+
private const string PALAU_COUNTRY_NAME = "Palau";
6+
private const string PALAU_NATIVE_NAME = "Belau";
7+
private const string PALAU_CAPITAL = "Ngerulmud";
8+
private const string PALAU_OFFICIAL_NAME = "Republic of Palau";
9+
private const string PALAU_ISO2_CODE = "PW";
10+
private const string PALAU_ISO3_CODE = "PLW";
11+
private const int PALAU_NUMERIC_CODE = 585;
12+
private readonly string[] PALAU_CALLING_CODE = ["+680"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Palau;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Aimeliik", "PW-002", "State"),
18+
new("Airai", "PW-004", "State"),
19+
new("Angaur", "PW-010", "State"),
20+
new("Hatohobei", "PW-050", "State"),
21+
new("Kayangel", "PW-100", "State"),
22+
new("Koror", "PW-150", "State"),
23+
new("Melekeok", "PW-212", "State"),
24+
new("Ngaraard", "PW-214", "State"),
25+
new("Ngarchelong", "PW-218", "State"),
26+
new("Ngardmau", "PW-222", "State"),
27+
new("Ngatpang", "PW-224", "State"),
28+
new("Ngchesar", "PW-226", "State"),
29+
new("Ngeremlengui", "PW-227", "State"),
30+
new("Ngiwal", "PW-228", "State"),
31+
new("Peleliu", "PW-350", "State"),
32+
new("Sonsorol", "PW-370", "State")
33+
];
34+
35+
[Fact]
36+
public void GetCountry_ReturnsCorrectInformation_ForPalau()
37+
{
38+
// Arrange
39+
// Act
40+
var country = CountryProvider.GetCountry(EXPECTEDID);
41+
42+
// Assert
43+
AssertCorrectInformation(
44+
country,
45+
EXPECTEDID,
46+
PALAU_COUNTRY_NAME,
47+
PALAU_OFFICIAL_NAME,
48+
PALAU_NATIVE_NAME,
49+
PALAU_CAPITAL,
50+
PALAU_NUMERIC_CODE,
51+
PALAU_ISO2_CODE,
52+
PALAU_ISO3_CODE,
53+
PALAU_CALLING_CODE,
54+
EXPECTED_STATES
55+
);
56+
}
57+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class PalestineTest : AssertCountryTestBase
4+
{
5+
private const string PALESTINE_COUNTRY_NAME = "Palestinian Territory, Occupied";
6+
private const string PALESTINE_NATIVE_NAME = "دولة فلسطين";
7+
private const string PALESTINE_CAPITAL = "Ramallah";
8+
private const string PALESTINE_OFFICIAL_NAME = "State of Palestine";
9+
private const string PALESTINE_ISO2_CODE = "PS";
10+
private const string PALESTINE_ISO3_CODE = "PSE";
11+
private const int PALESTINE_NUMERIC_CODE = 275;
12+
private readonly string[] PALESTINE_CALLING_CODE = ["+970"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.PalestinianTerritoryOccupied;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Gaza", "PS-GA", "Governorate"),
18+
new("West Bank", "PS-WB", "Governorate")
19+
];
20+
21+
[Fact]
22+
public void GetCountry_ReturnsCorrectInformation_ForPalestine()
23+
{
24+
// Arrange
25+
// Act
26+
var country = CountryProvider.GetCountry(EXPECTEDID);
27+
28+
// Assert
29+
AssertCorrectInformation(
30+
country,
31+
EXPECTEDID,
32+
PALESTINE_COUNTRY_NAME,
33+
PALESTINE_OFFICIAL_NAME,
34+
PALESTINE_NATIVE_NAME,
35+
PALESTINE_CAPITAL,
36+
PALESTINE_NUMERIC_CODE,
37+
PALESTINE_ISO2_CODE,
38+
PALESTINE_ISO3_CODE,
39+
PALESTINE_CALLING_CODE,
40+
EXPECTED_STATES
41+
);
42+
}
43+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace World.Net.UnitTests.Countries;
8+
9+
public sealed class PanamaTest : AssertCountryTestBase
10+
{
11+
private const string PANAMA_COUNTRY_NAME = "Panama";
12+
private const string PANAMA_NATIVE_NAME = "República de Panamá";
13+
private const string PANAMA_CAPITAL = "Panama City";
14+
private const string PANAMA_OFFICIAL_NAME = "Republic of Panama";
15+
private const string PANAMA_ISO2_CODE = "PA";
16+
private const string PANAMA_ISO3_CODE = "PAN";
17+
private const int PANAMA_NUMERIC_CODE = 591;
18+
private readonly string[] PANAMA_CALLING_CODE = ["+507"];
19+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Panama;
20+
21+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
22+
[
23+
new("Bocas del Toro", "PA-1", "Province"),
24+
new("Chiriquí", "PA-4", "Province"),
25+
new("Coclé", "PA-2", "Province"),
26+
new("Colón", "PA-3", "Province"),
27+
new("Darién", "PA-5", "Province"),
28+
new("Herrera", "PA-6", "Province"),
29+
new("Los Santos", "PA-7", "Province"),
30+
new("Panamá", "PA-8", "Province"),
31+
new("Veraguas", "PA-9", "Province"),
32+
new("Panamá Oeste", "PA-10", "Province"),
33+
new("Kuna Yala", "PA-KY", "Indigenous Region"),
34+
new("Ngäbe-Buglé", "PA-NB", "Indigenous Region"),
35+
new("Emberá-Wounaan", "PA-EM", "Indigenous Region")
36+
];
37+
38+
[Fact]
39+
public void GetCountry_ReturnsCorrectInformation_ForPanama()
40+
{
41+
// Arrange
42+
// Act
43+
var country = CountryProvider.GetCountry(EXPECTEDID);
44+
45+
// Assert
46+
AssertCorrectInformation(
47+
country,
48+
EXPECTEDID,
49+
PANAMA_COUNTRY_NAME,
50+
PANAMA_OFFICIAL_NAME,
51+
PANAMA_NATIVE_NAME,
52+
PANAMA_CAPITAL,
53+
PANAMA_NUMERIC_CODE,
54+
PANAMA_ISO2_CODE,
55+
PANAMA_ISO3_CODE,
56+
PANAMA_CALLING_CODE,
57+
EXPECTED_STATES
58+
);
59+
}
60+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class PapuaNewGuineaTest : AssertCountryTestBase
4+
{
5+
private const string PNG_COUNTRY_NAME = "Papua New Guinea";
6+
private const string PNG_NATIVE_NAME = "Papua Niugini";
7+
private const string PNG_CAPITAL = "Port Moresby";
8+
private const string PNG_OFFICIAL_NAME = "Independent State of Papua New Guinea";
9+
private const string PNG_ISO2_CODE = "PG";
10+
private const string PNG_ISO3_CODE = "PNG";
11+
private const int PNG_NUMERIC_CODE = 598;
12+
private readonly string[] PNG_CALLING_CODE = ["+675"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.PapuaNewGuinea;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Central", "PG-CN", "Province"),
18+
new("Gulf", "PG-GL", "Province"),
19+
new("Milne Bay", "PG-MB", "Province"),
20+
new("Northern", "PG-NB", "Province"),
21+
new("Southern Highlands", "PG-SH", "Province"),
22+
new("Western", "PG-WP", "Province"),
23+
new("Western Highlands", "PG-WH", "Province"),
24+
new("Enga", "PG-EN", "Province"),
25+
new("Eastern Highlands", "PG-EH", "Province"),
26+
new("Hela", "PG-HE", "Province"),
27+
new("Morobe", "PG-MO", "Province"),
28+
new("Madang", "PG-MD", "Province"),
29+
new("New Ireland", "PG-NI", "Province"),
30+
new("East New Britain", "PG-EB", "Province"),
31+
new("West New Britain", "PG-WB", "Province"),
32+
new("Manus", "PG-MA", "Province"),
33+
new("Bougainville", "PG-BA", "Autonomous Region"),
34+
new("Chimbu", "PG-CP", "Province"),
35+
new("Oro", "PG-OR", "Province"),
36+
new("Sandaun", "PG-SO", "Province"),
37+
new("Central", "PG-CE", "Province"),
38+
new("National Capital District", "PG-NCD", "District")
39+
];
40+
41+
[Fact]
42+
public void GetCountry_ReturnsCorrectInformation_ForPapuaNewGuinea()
43+
{
44+
// Arrange
45+
// Act
46+
var country = CountryProvider.GetCountry(EXPECTEDID);
47+
48+
// Assert
49+
AssertCorrectInformation(
50+
country,
51+
EXPECTEDID,
52+
PNG_COUNTRY_NAME,
53+
PNG_OFFICIAL_NAME,
54+
PNG_NATIVE_NAME,
55+
PNG_CAPITAL,
56+
PNG_NUMERIC_CODE,
57+
PNG_ISO2_CODE,
58+
PNG_ISO3_CODE,
59+
PNG_CALLING_CODE,
60+
EXPECTED_STATES
61+
);
62+
}
63+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class ParaguayTest : AssertCountryTestBase
4+
{
5+
private const string PARAGUAY_COUNTRY_NAME = "Paraguay";
6+
private const string PARAGUAY_NATIVE_NAME = "República del Paraguay";
7+
private const string PARAGUAY_CAPITAL = "Asunción";
8+
private const string PARAGUAY_OFFICIAL_NAME = "Republic of Paraguay";
9+
private const string PARAGUAY_ISO2_CODE = "PY";
10+
private const string PARAGUAY_ISO3_CODE = "PRY";
11+
private const int PARAGUAY_NUMERIC_CODE = 600;
12+
private readonly string[] PARAGUAY_CALLING_CODE = ["+595"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Paraguay;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Alto Paraguay", "PY-16", "Department"),
18+
new("Alto Paraná", "PY-10", "Department"),
19+
new("Amambay", "PY-13", "Department"),
20+
new("Asunción", "PY-ASU", "Capital District"),
21+
new("Boquerón", "PY-19", "Department"),
22+
new("Caaguazú", "PY-5", "Department"),
23+
new("Caazapá", "PY-6", "Department"),
24+
new("Canindeyú", "PY-11", "Department"),
25+
new("Central", "PY-15", "Department"),
26+
new("Concepción", "PY-1", "Department"),
27+
new("Cordillera", "PY-3", "Department"),
28+
new("Guairá", "PY-4", "Department"),
29+
new("Itapúa", "PY-7", "Department"),
30+
new("Misiones", "PY-8", "Department"),
31+
new("Ñeembucú", "PY-12", "Department"),
32+
new("Paraguarí", "PY-9", "Department"),
33+
new("Presidente Hayes", "PY-17", "Department"),
34+
new("San Pedro", "PY-2", "Department")
35+
];
36+
37+
[Fact]
38+
public void GetCountry_ReturnsCorrectInformation_ForParaguay()
39+
{
40+
// Arrange
41+
// Act
42+
var country = CountryProvider.GetCountry(EXPECTEDID);
43+
44+
// Assert
45+
AssertCorrectInformation(
46+
country,
47+
EXPECTEDID,
48+
PARAGUAY_COUNTRY_NAME,
49+
PARAGUAY_OFFICIAL_NAME,
50+
PARAGUAY_NATIVE_NAME,
51+
PARAGUAY_CAPITAL,
52+
PARAGUAY_NUMERIC_CODE,
53+
PARAGUAY_ISO2_CODE,
54+
PARAGUAY_ISO3_CODE,
55+
PARAGUAY_CALLING_CODE,
56+
EXPECTED_STATES
57+
);
58+
}
59+
}

0 commit comments

Comments
 (0)