From e6a4051a3df8370b4a0735d0ef5a52d6df542657 Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 18 Dec 2025 17:57:54 +0100 Subject: [PATCH 1/3] Nigeria, Niue, NorkfolkIsland, NorthernMarina, North Korea, North Macedonia, Norway --- .../Countries/NigeriaTest.cs | 78 +++++++++++++++++++ src/World.Net.UnitTests/Countries/NiueTest.cs | 56 +++++++++++++ .../Countries/NorfolkIslandTest.cs | 53 +++++++++++++ .../Countries/NorthKoreaTest.cs | 55 +++++++++++++ .../Countries/NorthMacedoniaTest.cs | 49 ++++++++++++ .../Countries/NorthernMarianaIslandsTest.cs | 45 +++++++++++ .../Countries/NorwayTest.cs | 52 +++++++++++++ src/World.Net/Countries/Nigeria.cs | 73 +++++++++++++++++ src/World.Net/Countries/Niue.cs | 51 ++++++++++++ src/World.Net/Countries/NorfolkIsland.cs | 47 +++++++++++ src/World.Net/Countries/NorthKorea.cs | 51 ++++++++++++ src/World.Net/Countries/NorthMacedonia.cs | 45 +++++++++++ .../Countries/NorthernMarianaIslands.cs | 40 ++++++++++ src/World.Net/Countries/Norway.cs | 48 ++++++++++++ 14 files changed, 743 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/NigeriaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NiueTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NorfolkIslandTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NorthKoreaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NorthMacedoniaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NorthernMarianaIslandsTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NorwayTest.cs create mode 100644 src/World.Net/Countries/Nigeria.cs create mode 100644 src/World.Net/Countries/Niue.cs create mode 100644 src/World.Net/Countries/NorfolkIsland.cs create mode 100644 src/World.Net/Countries/NorthKorea.cs create mode 100644 src/World.Net/Countries/NorthMacedonia.cs create mode 100644 src/World.Net/Countries/NorthernMarianaIslands.cs create mode 100644 src/World.Net/Countries/Norway.cs diff --git a/src/World.Net.UnitTests/Countries/NigeriaTest.cs b/src/World.Net.UnitTests/Countries/NigeriaTest.cs new file mode 100644 index 0000000..2e35f4c --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NigeriaTest.cs @@ -0,0 +1,78 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NigeriaTest : AssertCountryTestBase +{ + private const string NIGERIA_COUNTRY_NAME = "Nigeria"; + private const string NIGERIA_NATIVE_NAME = "Nigeria"; + private const string NIGERIA_CAPITAL = "Abuja"; + private const string NIGERIA_OFFICIAL_NAME = "Federal Republic of Nigeria"; + private const string NIGERIA_ISO2_CODE = "NG"; + private const string NIGERIA_ISO3_CODE = "NGA"; + private const int NIGERIA_NUMERIC_CODE = 566; + private readonly string[] NIGERIA_CALLING_CODE = ["+234"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Nigeria; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Abia", "NG-AB", "State"), + new("Adamawa", "NG-AD", "State"), + new("Akwa Ibom", "NG-AK", "State"), + new("Anambra", "NG-AN", "State"), + new("Bauchi", "NG-BA", "State"), + new("Bayelsa", "NG-BY", "State"), + new("Benue", "NG-BE", "State"), + new("Borno", "NG-BO", "State"), + new("Cross River", "NG-CR", "State"), + new("Delta", "NG-DE", "State"), + new("Ebonyi", "NG-EB", "State"), + new("Edo", "NG-ED", "State"), + new("Ekiti", "NG-EK", "State"), + new("Enugu", "NG-EN", "State"), + new("Gombe", "NG-GO", "State"), + new("Imo", "NG-IM", "State"), + new("Jigawa", "NG-JI", "State"), + new("Kaduna", "NG-KD", "State"), + new("Kano", "NG-KN", "State"), + new("Katsina", "NG-KT", "State"), + new("Kebbi", "NG-KE", "State"), + new("Kogi", "NG-KO", "State"), + new("Kwara", "NG-KW", "State"), + new("Lagos", "NG-LA", "State"), + new("Nasarawa", "NG-NA", "State"), + new("Niger", "NG-NI", "State"), + new("Ogun", "NG-OG", "State"), + new("Ondo", "NG-ON", "State"), + new("Osun", "NG-OS", "State"), + new("Oyo", "NG-OY", "State"), + new("Plateau", "NG-PL", "State"), + new("Rivers", "NG-RI", "State"), + new("Sokoto", "NG-SO", "State"), + new("Taraba", "NG-TA", "State"), + new("Yobe", "NG-YO", "State"), + new("Zamfara", "NG-ZA", "State"), + new("Federal Capital Territory", "NG-FC", "Federal Capital Territory") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNigeria() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NIGERIA_COUNTRY_NAME, + NIGERIA_OFFICIAL_NAME, + NIGERIA_NATIVE_NAME, + NIGERIA_CAPITAL, + NIGERIA_NUMERIC_CODE, + NIGERIA_ISO2_CODE, + NIGERIA_ISO3_CODE, + NIGERIA_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NiueTest.cs b/src/World.Net.UnitTests/Countries/NiueTest.cs new file mode 100644 index 0000000..44b91d5 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NiueTest.cs @@ -0,0 +1,56 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NiueTest : AssertCountryTestBase +{ + private const string NIUE_COUNTRY_NAME = "Niue"; + private const string NIUE_NATIVE_NAME = "Niuē"; + private const string NIUE_CAPITAL = "Alofi"; + private const string NIUE_OFFICIAL_NAME = "Niue"; + private const string NIUE_ISO2_CODE = "NU"; + private const string NIUE_ISO3_CODE = "NIU"; + private const int NIUE_NUMERIC_CODE = 570; + private readonly string[] NIUE_CALLING_CODE = ["+683"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Niue; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Alofi North", "NU-01", "Village"), + new("Alofi South", "NU-02", "Village"), + new("Avatele", "NU-03", "Village"), + new("Hakupu", "NU-04", "Village"), + new("Hikutavake", "NU-05", "Village"), + new("Lakepa", "NU-06", "Village"), + new("Liku", "NU-07", "Village"), + new("Makefu", "NU-08", "Village"), + new("Mutalau", "NU-09", "Village"), + new("Namukulu", "NU-10", "Village"), + new("Talava", "NU-11", "Village"), + new("Toi", "NU-12", "Village"), + new("Tufukia", "NU-13", "Village"), + new("Vaiea", "NU-14", "Village") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNiue() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NIUE_COUNTRY_NAME, + NIUE_OFFICIAL_NAME, + NIUE_NATIVE_NAME, + NIUE_CAPITAL, + NIUE_NUMERIC_CODE, + NIUE_ISO2_CODE, + NIUE_ISO3_CODE, + NIUE_CALLING_CODE, + EXPECTED_STATES + ); + } +} + diff --git a/src/World.Net.UnitTests/Countries/NorfolkIslandTest.cs b/src/World.Net.UnitTests/Countries/NorfolkIslandTest.cs new file mode 100644 index 0000000..b551696 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NorfolkIslandTest.cs @@ -0,0 +1,53 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NorfolkIslandTest : AssertCountryTestBase +{ + private const string NORFOLK_ISLAND_COUNTRY_NAME = "Norfolk Island"; + private const string NORFOLK_ISLAND_NATIVE_NAME = "Norfolk Island"; + private const string NORFOLK_ISLAND_CAPITAL = "Kingston"; + private const string NORFOLK_ISLAND_OFFICIAL_NAME = "Territory of Norfolk Island"; + private const string NORFOLK_ISLAND_ISO2_CODE = "NF"; + private const string NORFOLK_ISLAND_ISO3_CODE = "NFK"; + private const int NORFOLK_ISLAND_NUMERIC_CODE = 574; + private readonly string[] NORFOLK_ISLAND_CALLING_CODE = ["+672"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.NorfolkIsland; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Anson Bay", "NF-01", "Settlement"), + new("Ball Bay", "NF-02", "Settlement"), + new("Bicentennial", "NF-03", "Settlement"), + new("Burnt Pine", "NF-04", "Settlement"), + new("Cascade", "NF-05", "Settlement"), + new("Kingston", "NF-06", "Settlement"), + new("Longridge", "NF-07", "Settlement"), + new("Mount Pitt", "NF-08", "Settlement"), + new("Queen Elizabeth", "NF-09", "Settlement"), + new("Royal", "NF-10", "Settlement"), + new("Suffolk", "NF-11", "Settlement") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNorfolkIsland() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NORFOLK_ISLAND_COUNTRY_NAME, + NORFOLK_ISLAND_OFFICIAL_NAME, + NORFOLK_ISLAND_NATIVE_NAME, + NORFOLK_ISLAND_CAPITAL, + NORFOLK_ISLAND_NUMERIC_CODE, + NORFOLK_ISLAND_ISO2_CODE, + NORFOLK_ISLAND_ISO3_CODE, + NORFOLK_ISLAND_CALLING_CODE, + EXPECTED_STATES + ); + } +} + diff --git a/src/World.Net.UnitTests/Countries/NorthKoreaTest.cs b/src/World.Net.UnitTests/Countries/NorthKoreaTest.cs new file mode 100644 index 0000000..303e1e5 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NorthKoreaTest.cs @@ -0,0 +1,55 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NorthKoreaTest : AssertCountryTestBase +{ + private const string NORTH_KOREA_COUNTRY_NAME = "North Korea"; + private const string NORTH_KOREA_NATIVE_NAME = "조선민주주의인민공화국"; + private const string NORTH_KOREA_CAPITAL = "Pyongyang"; + private const string NORTH_KOREA_OFFICIAL_NAME = "Democratic People's Republic of Korea"; + private const string NORTH_KOREA_ISO2_CODE = "KP"; + private const string NORTH_KOREA_ISO3_CODE = "PRK"; + private const int NORTH_KOREA_NUMERIC_CODE = 408; + private readonly string[] NORTH_KOREA_CALLING_CODE = ["+850"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.NorthKorea; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Chagang", "KP-CHA", "Province"), + new("North Hamgyong", "KP-HAMN", "Province"), + new("South Hamgyong", "KP-HAMS", "Province"), + new("North Hwanghae", "KP-HWAN", "Province"), + new("South Hwanghae", "KP-HWAS", "Province"), + new("Kangwon", "KP-KAN", "Province"), + new("North Pyongan", "KP-PYON", "Province"), + new("South Pyongan", "KP-PYOS", "Province"), + new("Ryanggang", "KP-RYA", "Province"), + new("Kaesong", "KP-KA", "Special City"), + new("Nampo", "KP-NAM", "Special City"), + new("Pyongyang", "KP-PY", "Directly Governed City"), + new("Rason", "KP-RAS", "Directly Governed City"), + new("Sinuiju", "KP-SIN", "Special City") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNorthKorea() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NORTH_KOREA_COUNTRY_NAME, + NORTH_KOREA_OFFICIAL_NAME, + NORTH_KOREA_NATIVE_NAME, + NORTH_KOREA_CAPITAL, + NORTH_KOREA_NUMERIC_CODE, + NORTH_KOREA_ISO2_CODE, + NORTH_KOREA_ISO3_CODE, + NORTH_KOREA_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NorthMacedoniaTest.cs b/src/World.Net.UnitTests/Countries/NorthMacedoniaTest.cs new file mode 100644 index 0000000..ae16818 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NorthMacedoniaTest.cs @@ -0,0 +1,49 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NorthMacedoniaTest : AssertCountryTestBase +{ + private const string NORTH_MACEDONIA_COUNTRY_NAME = "North Macedonia"; + private const string NORTH_MACEDONIA_NATIVE_NAME = "Северна Македонија"; + private const string NORTH_MACEDONIA_CAPITAL = "Skopje"; + private const string NORTH_MACEDONIA_OFFICIAL_NAME = "Republic of North Macedonia"; + private const string NORTH_MACEDONIA_ISO2_CODE = "MK"; + private const string NORTH_MACEDONIA_ISO3_CODE = "MKD"; + private const int NORTH_MACEDONIA_NUMERIC_CODE = 807; + private readonly string[] NORTH_MACEDONIA_CALLING_CODE = ["+389"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.NorthMacedonia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Eastern", "MK-01", "Region"), + new("North Eastern", "MK-02", "Region"), + new("Skopje", "MK-03", "Region"), + new("Pelagonia", "MK-04", "Region"), + new("Polog", "MK-05", "Region"), + new("South Eastern", "MK-06", "Region"), + new("South Western", "MK-07", "Region"), + new("Vardar", "MK-08", "Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNorthMacedonia() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NORTH_MACEDONIA_COUNTRY_NAME, + NORTH_MACEDONIA_OFFICIAL_NAME, + NORTH_MACEDONIA_NATIVE_NAME, + NORTH_MACEDONIA_CAPITAL, + NORTH_MACEDONIA_NUMERIC_CODE, + NORTH_MACEDONIA_ISO2_CODE, + NORTH_MACEDONIA_ISO3_CODE, + NORTH_MACEDONIA_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NorthernMarianaIslandsTest.cs b/src/World.Net.UnitTests/Countries/NorthernMarianaIslandsTest.cs new file mode 100644 index 0000000..1846b82 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NorthernMarianaIslandsTest.cs @@ -0,0 +1,45 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NorthernMarianaIslandsTest : AssertCountryTestBase +{ + private const string NORTHERN_MARIANA_ISLANDS_COUNTRY_NAME = "Northern Mariana Islands"; + private const string NORTHERN_MARIANA_ISLANDS_NATIVE_NAME = "Northern Mariana Islands"; + private const string NORTHERN_MARIANA_ISLANDS_CAPITAL = "Saipan"; + private const string NORTHERN_MARIANA_ISLANDS_OFFICIAL_NAME = "Commonwealth of the Northern Mariana Islands"; + private const string NORTHERN_MARIANA_ISLANDS_ISO2_CODE = "MP"; + private const string NORTHERN_MARIANA_ISLANDS_ISO3_CODE = "MNP"; + private const int NORTHERN_MARIANA_ISLANDS_NUMERIC_CODE = 580; + private readonly string[] NORTHERN_MARIANA_ISLANDS_CALLING_CODE = ["+1-670"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.NorthernMarianaIslands; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Saipan", "MP-SA", "Municipality"), + new("Tinian", "MP-TI", "Municipality"), + new("Rota", "MP-RO", "Municipality"), + new("Northern Islands", "MP-NI", "Municipality") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNorthernMarianaIslands() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NORTHERN_MARIANA_ISLANDS_COUNTRY_NAME, + NORTHERN_MARIANA_ISLANDS_OFFICIAL_NAME, + NORTHERN_MARIANA_ISLANDS_NATIVE_NAME, + NORTHERN_MARIANA_ISLANDS_CAPITAL, + NORTHERN_MARIANA_ISLANDS_NUMERIC_CODE, + NORTHERN_MARIANA_ISLANDS_ISO2_CODE, + NORTHERN_MARIANA_ISLANDS_ISO3_CODE, + NORTHERN_MARIANA_ISLANDS_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NorwayTest.cs b/src/World.Net.UnitTests/Countries/NorwayTest.cs new file mode 100644 index 0000000..eff752c --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NorwayTest.cs @@ -0,0 +1,52 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NorwayTest : AssertCountryTestBase +{ + private const string NORWAY_COUNTRY_NAME = "Norway"; + private const string NORWAY_NATIVE_NAME = "Norge"; + private const string NORWAY_CAPITAL = "Oslo"; + private const string NORWAY_OFFICIAL_NAME = "Kingdom of Norway"; + private const string NORWAY_ISO2_CODE = "NO"; + private const string NORWAY_ISO3_CODE = "NOR"; + private const int NORWAY_NUMERIC_CODE = 578; + private readonly string[] NORWAY_CALLING_CODE = ["+47"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Norway; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Agder", "NO-01", "County"), + new("Innlandet", "NO-02", "County"), + new("Møre og Romsdal", "NO-03", "County"), + new("Nordland", "NO-04", "County"), + new("Oslo", "NO-05", "County"), + new("Rogaland", "NO-06", "County"), + new("Troms og Finnmark", "NO-07", "County"), + new("Trøndelag", "NO-08", "County"), + new("Vestfold og Telemark", "NO-09", "County"), + new("Vestland", "NO-10", "County"), + new("Viken", "NO-11", "County") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNorway() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + NORWAY_COUNTRY_NAME, + NORWAY_OFFICIAL_NAME, + NORWAY_NATIVE_NAME, + NORWAY_CAPITAL, + NORWAY_NUMERIC_CODE, + NORWAY_ISO2_CODE, + NORWAY_ISO3_CODE, + NORWAY_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net/Countries/Nigeria.cs b/src/World.Net/Countries/Nigeria.cs new file mode 100644 index 0000000..294e58d --- /dev/null +++ b/src/World.Net/Countries/Nigeria.cs @@ -0,0 +1,73 @@ +namespace World.Net.Countries; + +internal sealed class Nigeria : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Nigeria; + + // + public string Name { get; } = "Nigeria"; + + // + public string OfficialName { get; } = "Federal Republic of Nigeria"; + + // + public string NativeName => "Nigeria"; + + // + public string Capital { get; } = "Abuja"; + + // + public int NumericCode { get; } = 566; + + // + public string ISO2Code { get; } = "NG"; + + // + public string ISO3Code { get; } = "NGA"; + + // + public string[] CallingCode { get; } = ["+234"]; + + // + public IEnumerable States => + [ + new("Abia", "NG-AB", "State"), + new("Adamawa", "NG-AD", "State"), + new("Akwa Ibom", "NG-AK", "State"), + new("Anambra", "NG-AN", "State"), + new("Bauchi", "NG-BA", "State"), + new("Bayelsa", "NG-BY", "State"), + new("Benue", "NG-BE", "State"), + new("Borno", "NG-BO", "State"), + new("Cross River", "NG-CR", "State"), + new("Delta", "NG-DE", "State"), + new("Ebonyi", "NG-EB", "State"), + new("Edo", "NG-ED", "State"), + new("Ekiti", "NG-EK", "State"), + new("Enugu", "NG-EN", "State"), + new("Gombe", "NG-GO", "State"), + new("Imo", "NG-IM", "State"), + new("Jigawa", "NG-JI", "State"), + new("Kaduna", "NG-KD", "State"), + new("Kano", "NG-KN", "State"), + new("Katsina", "NG-KT", "State"), + new("Kebbi", "NG-KE", "State"), + new("Kogi", "NG-KO", "State"), + new("Kwara", "NG-KW", "State"), + new("Lagos", "NG-LA", "State"), + new("Nasarawa", "NG-NA", "State"), + new("Niger", "NG-NI", "State"), + new("Ogun", "NG-OG", "State"), + new("Ondo", "NG-ON", "State"), + new("Osun", "NG-OS", "State"), + new("Oyo", "NG-OY", "State"), + new("Plateau", "NG-PL", "State"), + new("Rivers", "NG-RI", "State"), + new("Sokoto", "NG-SO", "State"), + new("Taraba", "NG-TA", "State"), + new("Yobe", "NG-YO", "State"), + new("Zamfara", "NG-ZA", "State"), + new("Federal Capital Territory", "NG-FC", "Federal Capital Territory") + ]; +} diff --git a/src/World.Net/Countries/Niue.cs b/src/World.Net/Countries/Niue.cs new file mode 100644 index 0000000..3cb8df8 --- /dev/null +++ b/src/World.Net/Countries/Niue.cs @@ -0,0 +1,51 @@ +namespace World.Net.Countries; + +internal sealed class Niue : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Niue; + + // + public string Name { get; } = "Niue"; + + // + public string OfficialName { get; } = "Niue"; + + // + public string NativeName => "Niuē"; + + // + public string Capital { get; } = "Alofi"; + + // + public int NumericCode { get; } = 570; + + // + public string ISO2Code { get; } = "NU"; + + // + public string ISO3Code { get; } = "NIU"; + + // + public string[] CallingCode { get; } = ["+683"]; + + // + public IEnumerable States => + [ + new("Alofi North", "NU-01", "Village"), + new("Alofi South", "NU-02", "Village"), + new("Avatele", "NU-03", "Village"), + new("Hakupu", "NU-04", "Village"), + new("Hikutavake", "NU-05", "Village"), + new("Lakepa", "NU-06", "Village"), + new("Liku", "NU-07", "Village"), + new("Makefu", "NU-08", "Village"), + new("Mutalau", "NU-09", "Village"), + new("Namukulu", "NU-10", "Village"), + new("Talava", "NU-11", "Village"), + new("Toi", "NU-12", "Village"), + new("Tufukia", "NU-13", "Village"), + new("Vaiea", "NU-14", "Village") + ]; +} + diff --git a/src/World.Net/Countries/NorfolkIsland.cs b/src/World.Net/Countries/NorfolkIsland.cs new file mode 100644 index 0000000..bb2a7ab --- /dev/null +++ b/src/World.Net/Countries/NorfolkIsland.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries; + +internal sealed class NorfolkIsland : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.NorfolkIsland; + + // + public string Name { get; } = "Norfolk Island"; + + // + public string OfficialName { get; } = "Territory of Norfolk Island"; + + // + public string NativeName => "Norfolk Island"; + + // + public string Capital { get; } = "Kingston"; + + // + public int NumericCode { get; } = 574; + + // + public string ISO2Code { get; } = "NF"; + + // + public string ISO3Code { get; } = "NFK"; + + // + public string[] CallingCode { get; } = ["+672"]; + + // + public IEnumerable States => + [ + new("Anson Bay", "NF-01", "Settlement"), + new("Ball Bay", "NF-02", "Settlement"), + new("Bicentennial", "NF-03", "Settlement"), + new("Burnt Pine", "NF-04", "Settlement"), + new("Cascade", "NF-05", "Settlement"), + new("Kingston", "NF-06", "Settlement"), + new("Longridge", "NF-07", "Settlement"), + new("Mount Pitt", "NF-08", "Settlement"), + new("Queen Elizabeth", "NF-09", "Settlement"), + new("Royal", "NF-10", "Settlement"), + new("Suffolk", "NF-11", "Settlement") + ]; +} diff --git a/src/World.Net/Countries/NorthKorea.cs b/src/World.Net/Countries/NorthKorea.cs new file mode 100644 index 0000000..532aa35 --- /dev/null +++ b/src/World.Net/Countries/NorthKorea.cs @@ -0,0 +1,51 @@ +namespace World.Net.Countries; + +internal sealed class NorthKorea : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.NorthKorea; + + // + public string Name { get; } = "North Korea"; + + // + public string OfficialName { get; } = "Democratic People's Republic of Korea"; + + // + public string NativeName => "조선민주주의인민공화국"; + + // + public string Capital { get; } = "Pyongyang"; + + // + public int NumericCode { get; } = 408; + + // + public string ISO2Code { get; } = "KP"; + + // + public string ISO3Code { get; } = "PRK"; + + // + public string[] CallingCode { get; } = ["+850"]; + + // + public IEnumerable States => + [ + new("Chagang", "KP-CHA", "Province"), + new("North Hamgyong", "KP-HAMN", "Province"), + new("South Hamgyong", "KP-HAMS", "Province"), + new("North Hwanghae", "KP-HWAN", "Province"), + new("South Hwanghae", "KP-HWAS", "Province"), + new("Kangwon", "KP-KAN", "Province"), + new("North Pyongan", "KP-PYON", "Province"), + new("South Pyongan", "KP-PYOS", "Province"), + new("Ryanggang", "KP-RYA", "Province"), + new("Kaesong", "KP-KA", "Special City"), + new("Nampo", "KP-NAM", "Special City"), + new("Pyongyang", "KP-PY", "Directly Governed City"), + new("Rason", "KP-RAS", "Directly Governed City"), + new("Sinuiju", "KP-SIN", "Special City") + ]; +} + diff --git a/src/World.Net/Countries/NorthMacedonia.cs b/src/World.Net/Countries/NorthMacedonia.cs new file mode 100644 index 0000000..5d5368e --- /dev/null +++ b/src/World.Net/Countries/NorthMacedonia.cs @@ -0,0 +1,45 @@ +namespace World.Net.Countries; + +internal sealed class NorthMacedonia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.NorthMacedonia; + + // + public string Name { get; } = "North Macedonia"; + + // + public string OfficialName { get; } = "Republic of North Macedonia"; + + // + public string NativeName => "Северна Македонија"; + + // + public string Capital { get; } = "Skopje"; + + // + public int NumericCode { get; } = 807; + + // + public string ISO2Code { get; } = "MK"; + + // + public string ISO3Code { get; } = "MKD"; + + // + public string[] CallingCode { get; } = ["+389"]; + + // + public IEnumerable States => + [ + new("Eastern", "MK-01", "Region"), + new("North Eastern", "MK-02", "Region"), + new("Skopje", "MK-03", "Region"), + new("Pelagonia", "MK-04", "Region"), + new("Polog", "MK-05", "Region"), + new("South Eastern", "MK-06", "Region"), + new("South Western", "MK-07", "Region"), + new("Vardar", "MK-08", "Region") + ]; +} + diff --git a/src/World.Net/Countries/NorthernMarianaIslands.cs b/src/World.Net/Countries/NorthernMarianaIslands.cs new file mode 100644 index 0000000..b93086f --- /dev/null +++ b/src/World.Net/Countries/NorthernMarianaIslands.cs @@ -0,0 +1,40 @@ +namespace World.Net.Countries; + +internal sealed class NorthernMarianaIslands : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.NorthernMarianaIslands; + + // + public string Name { get; } = "Northern Mariana Islands"; + + // + public string OfficialName { get; } = "Commonwealth of the Northern Mariana Islands"; + + // + public string NativeName => "Northern Mariana Islands"; + + // + public string Capital { get; } = "Saipan"; + + // + public int NumericCode { get; } = 580; + + // + public string ISO2Code { get; } = "MP"; + + // + public string ISO3Code { get; } = "MNP"; + + // + public string[] CallingCode { get; } = ["+1-670"]; + + // + public IEnumerable States => + [ + new("Saipan", "MP-SA", "Municipality"), + new("Tinian", "MP-TI", "Municipality"), + new("Rota", "MP-RO", "Municipality"), + new("Northern Islands", "MP-NI", "Municipality") + ]; +} diff --git a/src/World.Net/Countries/Norway.cs b/src/World.Net/Countries/Norway.cs new file mode 100644 index 0000000..5c5d510 --- /dev/null +++ b/src/World.Net/Countries/Norway.cs @@ -0,0 +1,48 @@ +namespace World.Net.Countries; + +internal sealed class Norway : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Norway; + + // + public string Name { get; } = "Norway"; + + // + public string OfficialName { get; } = "Kingdom of Norway"; + + // + public string NativeName => "Norge"; + + // + public string Capital { get; } = "Oslo"; + + // + public int NumericCode { get; } = 578; + + // + public string ISO2Code { get; } = "NO"; + + // + public string ISO3Code { get; } = "NOR"; + + // + public string[] CallingCode { get; } = ["+47"]; + + // + public IEnumerable States => + [ + new("Agder", "NO-01", "County"), + new("Innlandet", "NO-02", "County"), + new("Møre og Romsdal", "NO-03", "County"), + new("Nordland", "NO-04", "County"), + new("Oslo", "NO-05", "County"), + new("Rogaland", "NO-06", "County"), + new("Troms og Finnmark", "NO-07", "County"), + new("Trøndelag", "NO-08", "County"), + new("Vestfold og Telemark", "NO-09", "County"), + new("Vestland", "NO-10", "County"), + new("Viken", "NO-11", "County") + ]; +} + From 6b84d3299b73a88a10c912a98f8c48d08e641720 Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 18 Dec 2025 18:04:18 +0100 Subject: [PATCH 2/3] country initializer updated --- src/World.Net/Helpers/CountryInitializer.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index f27693b..65d3f87 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -133,6 +133,13 @@ public static Dictionary Initialize() { CountryIdentifier.Luxembourg, new Luxembourg() }, { CountryIdentifier.MacauSAR, new MacauSAR() }, { CountryIdentifier.Madagascar, new Madagascar() }, + { CountryIdentifier.Nigeria, new Nigeria() }, + { CountryIdentifier.Niue, new Niue() }, + { CountryIdentifier.NorfolkIsland, new NorfolkIsland() }, + { CountryIdentifier.NorthKorea, new NorthKorea() }, + { CountryIdentifier.NorthMacedonia, new NorthMacedonia() }, + { CountryIdentifier.NorthernMarianaIslands, new NorthernMarianaIslands() }, + { CountryIdentifier.Norway, new Norway() }, // Future countries can be added here in the same format. }; From 5a799b48cd9f6aa2f3c94e0524330a35a67f76e3 Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 18 Dec 2025 18:43:29 +0100 Subject: [PATCH 3/3] 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. --- src/World.Net.UnitTests/Countries/OmanTest.cs | 52 +++++++++++++++ .../Countries/PakistanTest.cs | 48 ++++++++++++++ .../Countries/PalauTest.cs | 57 ++++++++++++++++ .../Countries/PalestineTest.cs | 43 ++++++++++++ .../Countries/PanamaTest.cs | 60 +++++++++++++++++ .../Countries/PapuaNewGuineaTest.cs | 63 ++++++++++++++++++ .../Countries/ParaguayTest.cs | 59 +++++++++++++++++ src/World.Net.UnitTests/Countries/PeruTest.cs | 66 +++++++++++++++++++ .../Countries/PhilippinesTest.cs | 58 ++++++++++++++++ .../Countries/PitcairnIslandsTest.cs | 50 ++++++++++++++ .../Countries/PolandTest.cs | 57 ++++++++++++++++ .../Countries/PortugalTest.cs | 61 +++++++++++++++++ .../Countries/PuertoRicoTest.cs | 50 ++++++++++++++ src/World.Net/Countries/Oman.cs | 47 +++++++++++++ src/World.Net/Countries/Pakistan.cs | 44 +++++++++++++ src/World.Net/Countries/Palau.cs | 52 +++++++++++++++ src/World.Net/Countries/Palestine.cs | 38 +++++++++++ src/World.Net/Countries/Panama.cs | 49 ++++++++++++++ src/World.Net/Countries/PapuaNewGuinea.cs | 59 +++++++++++++++++ src/World.Net/Countries/Paraguay.cs | 55 ++++++++++++++++ src/World.Net/Countries/Peru.cs | 62 +++++++++++++++++ src/World.Net/Countries/Philippines.cs | 54 +++++++++++++++ src/World.Net/Countries/PitcairnIslands.cs | 38 +++++++++++ src/World.Net/Countries/Poland.cs | 52 +++++++++++++++ src/World.Net/Countries/Portugal.cs | 56 ++++++++++++++++ src/World.Net/Countries/PuertoRico.cs | 38 +++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 17 ++++- 27 files changed, 1384 insertions(+), 1 deletion(-) create mode 100644 src/World.Net.UnitTests/Countries/OmanTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PakistanTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PalauTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PalestineTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PanamaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PapuaNewGuineaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/ParaguayTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PeruTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PhilippinesTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PitcairnIslandsTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PolandTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PortugalTest.cs create mode 100644 src/World.Net.UnitTests/Countries/PuertoRicoTest.cs create mode 100644 src/World.Net/Countries/Oman.cs create mode 100644 src/World.Net/Countries/Pakistan.cs create mode 100644 src/World.Net/Countries/Palau.cs create mode 100644 src/World.Net/Countries/Palestine.cs create mode 100644 src/World.Net/Countries/Panama.cs create mode 100644 src/World.Net/Countries/PapuaNewGuinea.cs create mode 100644 src/World.Net/Countries/Paraguay.cs create mode 100644 src/World.Net/Countries/Peru.cs create mode 100644 src/World.Net/Countries/Philippines.cs create mode 100644 src/World.Net/Countries/PitcairnIslands.cs create mode 100644 src/World.Net/Countries/Poland.cs create mode 100644 src/World.Net/Countries/Portugal.cs create mode 100644 src/World.Net/Countries/PuertoRico.cs diff --git a/src/World.Net.UnitTests/Countries/OmanTest.cs b/src/World.Net.UnitTests/Countries/OmanTest.cs new file mode 100644 index 0000000..7bf8bea --- /dev/null +++ b/src/World.Net.UnitTests/Countries/OmanTest.cs @@ -0,0 +1,52 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class OmanTest : AssertCountryTestBase +{ + private const string OMAN_COUNTRY_NAME = "Oman"; + private const string OMAN_NATIVE_NAME = "عُمان"; + private const string OMAN_CAPITAL = "Muscat"; + private const string OMAN_OFFICIAL_NAME = "Sultanate of Oman"; + private const string OMAN_ISO2_CODE = "OM"; + private const string OMAN_ISO3_CODE = "OMN"; + private const int OMAN_NUMERIC_CODE = 512; + private readonly string[] OMAN_CALLING_CODE = ["+968"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Oman; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Ad Dakhiliyah", "OM-DA", "Governorate"), + new("Ad Dhahirah", "OM-ZA", "Governorate"), + new("Al Batinah North", "OM-BN", "Governorate"), + new("Al Batinah South", "OM-BS", "Governorate"), + new("Al Wusta", "OM-WU", "Governorate"), + new("Ash Sharqiyah North", "OM-SH", "Governorate"), + new("Ash Sharqiyah South", "OM-SS", "Governorate"), + new("Dhofar", "OM-ZU", "Governorate"), + new("Muscat", "OM-MU", "Governorate"), + new("Musandam", "OM-MN", "Governorate"), + new("Al Buraimi", "OM-BR", "Governorate") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForOman() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + OMAN_COUNTRY_NAME, + OMAN_OFFICIAL_NAME, + OMAN_NATIVE_NAME, + OMAN_CAPITAL, + OMAN_NUMERIC_CODE, + OMAN_ISO2_CODE, + OMAN_ISO3_CODE, + OMAN_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PakistanTest.cs b/src/World.Net.UnitTests/Countries/PakistanTest.cs new file mode 100644 index 0000000..0abf9f9 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PakistanTest.cs @@ -0,0 +1,48 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PakistanTest : AssertCountryTestBase +{ + private const string PAKISTAN_COUNTRY_NAME = "Pakistan"; + private const string PAKISTAN_NATIVE_NAME = "پاکستان"; + private const string PAKISTAN_CAPITAL = "Islamabad"; + private const string PAKISTAN_OFFICIAL_NAME = "Islamic Republic of Pakistan"; + private const string PAKISTAN_ISO2_CODE = "PK"; + private const string PAKISTAN_ISO3_CODE = "PAK"; + private const int PAKISTAN_NUMERIC_CODE = 586; + private readonly string[] PAKISTAN_CALLING_CODE = ["+92"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Pakistan; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Balochistan", "PK-BA", "Province"), + new("Khyber Pakhtunkhwa", "PK-KP", "Province"), + new("Punjab", "PK-PB", "Province"), + new("Sindh", "PK-SD", "Province"), + new("Gilgit-Baltistan", "PK-GB", "Autonomous Territory"), + new("Azad Jammu and Kashmir", "PK-AJ", "Autonomous Territory"), + new("Islamabad Capital Territory", "PK-IS", "Federal Territory") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPakistan() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PAKISTAN_COUNTRY_NAME, + PAKISTAN_OFFICIAL_NAME, + PAKISTAN_NATIVE_NAME, + PAKISTAN_CAPITAL, + PAKISTAN_NUMERIC_CODE, + PAKISTAN_ISO2_CODE, + PAKISTAN_ISO3_CODE, + PAKISTAN_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PalauTest.cs b/src/World.Net.UnitTests/Countries/PalauTest.cs new file mode 100644 index 0000000..445a8ef --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PalauTest.cs @@ -0,0 +1,57 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PalauTest : AssertCountryTestBase +{ + private const string PALAU_COUNTRY_NAME = "Palau"; + private const string PALAU_NATIVE_NAME = "Belau"; + private const string PALAU_CAPITAL = "Ngerulmud"; + private const string PALAU_OFFICIAL_NAME = "Republic of Palau"; + private const string PALAU_ISO2_CODE = "PW"; + private const string PALAU_ISO3_CODE = "PLW"; + private const int PALAU_NUMERIC_CODE = 585; + private readonly string[] PALAU_CALLING_CODE = ["+680"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Palau; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Aimeliik", "PW-002", "State"), + new("Airai", "PW-004", "State"), + new("Angaur", "PW-010", "State"), + new("Hatohobei", "PW-050", "State"), + new("Kayangel", "PW-100", "State"), + new("Koror", "PW-150", "State"), + new("Melekeok", "PW-212", "State"), + new("Ngaraard", "PW-214", "State"), + new("Ngarchelong", "PW-218", "State"), + new("Ngardmau", "PW-222", "State"), + new("Ngatpang", "PW-224", "State"), + new("Ngchesar", "PW-226", "State"), + new("Ngeremlengui", "PW-227", "State"), + new("Ngiwal", "PW-228", "State"), + new("Peleliu", "PW-350", "State"), + new("Sonsorol", "PW-370", "State") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPalau() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PALAU_COUNTRY_NAME, + PALAU_OFFICIAL_NAME, + PALAU_NATIVE_NAME, + PALAU_CAPITAL, + PALAU_NUMERIC_CODE, + PALAU_ISO2_CODE, + PALAU_ISO3_CODE, + PALAU_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PalestineTest.cs b/src/World.Net.UnitTests/Countries/PalestineTest.cs new file mode 100644 index 0000000..3a0dad3 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PalestineTest.cs @@ -0,0 +1,43 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PalestineTest : AssertCountryTestBase +{ + private const string PALESTINE_COUNTRY_NAME = "Palestinian Territory, Occupied"; + private const string PALESTINE_NATIVE_NAME = "دولة فلسطين"; + private const string PALESTINE_CAPITAL = "Ramallah"; + private const string PALESTINE_OFFICIAL_NAME = "State of Palestine"; + private const string PALESTINE_ISO2_CODE = "PS"; + private const string PALESTINE_ISO3_CODE = "PSE"; + private const int PALESTINE_NUMERIC_CODE = 275; + private readonly string[] PALESTINE_CALLING_CODE = ["+970"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.PalestinianTerritoryOccupied; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Gaza", "PS-GA", "Governorate"), + new("West Bank", "PS-WB", "Governorate") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPalestine() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PALESTINE_COUNTRY_NAME, + PALESTINE_OFFICIAL_NAME, + PALESTINE_NATIVE_NAME, + PALESTINE_CAPITAL, + PALESTINE_NUMERIC_CODE, + PALESTINE_ISO2_CODE, + PALESTINE_ISO3_CODE, + PALESTINE_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PanamaTest.cs b/src/World.Net.UnitTests/Countries/PanamaTest.cs new file mode 100644 index 0000000..e2390e2 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PanamaTest.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries; + +public sealed class PanamaTest : AssertCountryTestBase +{ + private const string PANAMA_COUNTRY_NAME = "Panama"; + private const string PANAMA_NATIVE_NAME = "República de Panamá"; + private const string PANAMA_CAPITAL = "Panama City"; + private const string PANAMA_OFFICIAL_NAME = "Republic of Panama"; + private const string PANAMA_ISO2_CODE = "PA"; + private const string PANAMA_ISO3_CODE = "PAN"; + private const int PANAMA_NUMERIC_CODE = 591; + private readonly string[] PANAMA_CALLING_CODE = ["+507"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Panama; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Bocas del Toro", "PA-1", "Province"), + new("Chiriquí", "PA-4", "Province"), + new("Coclé", "PA-2", "Province"), + new("Colón", "PA-3", "Province"), + new("Darién", "PA-5", "Province"), + new("Herrera", "PA-6", "Province"), + new("Los Santos", "PA-7", "Province"), + new("Panamá", "PA-8", "Province"), + new("Veraguas", "PA-9", "Province"), + new("Panamá Oeste", "PA-10", "Province"), + new("Kuna Yala", "PA-KY", "Indigenous Region"), + new("Ngäbe-Buglé", "PA-NB", "Indigenous Region"), + new("Emberá-Wounaan", "PA-EM", "Indigenous Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPanama() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PANAMA_COUNTRY_NAME, + PANAMA_OFFICIAL_NAME, + PANAMA_NATIVE_NAME, + PANAMA_CAPITAL, + PANAMA_NUMERIC_CODE, + PANAMA_ISO2_CODE, + PANAMA_ISO3_CODE, + PANAMA_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PapuaNewGuineaTest.cs b/src/World.Net.UnitTests/Countries/PapuaNewGuineaTest.cs new file mode 100644 index 0000000..39d517f --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PapuaNewGuineaTest.cs @@ -0,0 +1,63 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PapuaNewGuineaTest : AssertCountryTestBase +{ + private const string PNG_COUNTRY_NAME = "Papua New Guinea"; + private const string PNG_NATIVE_NAME = "Papua Niugini"; + private const string PNG_CAPITAL = "Port Moresby"; + private const string PNG_OFFICIAL_NAME = "Independent State of Papua New Guinea"; + private const string PNG_ISO2_CODE = "PG"; + private const string PNG_ISO3_CODE = "PNG"; + private const int PNG_NUMERIC_CODE = 598; + private readonly string[] PNG_CALLING_CODE = ["+675"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.PapuaNewGuinea; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Central", "PG-CN", "Province"), + new("Gulf", "PG-GL", "Province"), + new("Milne Bay", "PG-MB", "Province"), + new("Northern", "PG-NB", "Province"), + new("Southern Highlands", "PG-SH", "Province"), + new("Western", "PG-WP", "Province"), + new("Western Highlands", "PG-WH", "Province"), + new("Enga", "PG-EN", "Province"), + new("Eastern Highlands", "PG-EH", "Province"), + new("Hela", "PG-HE", "Province"), + new("Morobe", "PG-MO", "Province"), + new("Madang", "PG-MD", "Province"), + new("New Ireland", "PG-NI", "Province"), + new("East New Britain", "PG-EB", "Province"), + new("West New Britain", "PG-WB", "Province"), + new("Manus", "PG-MA", "Province"), + new("Bougainville", "PG-BA", "Autonomous Region"), + new("Chimbu", "PG-CP", "Province"), + new("Oro", "PG-OR", "Province"), + new("Sandaun", "PG-SO", "Province"), + new("Central", "PG-CE", "Province"), + new("National Capital District", "PG-NCD", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPapuaNewGuinea() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PNG_COUNTRY_NAME, + PNG_OFFICIAL_NAME, + PNG_NATIVE_NAME, + PNG_CAPITAL, + PNG_NUMERIC_CODE, + PNG_ISO2_CODE, + PNG_ISO3_CODE, + PNG_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/ParaguayTest.cs b/src/World.Net.UnitTests/Countries/ParaguayTest.cs new file mode 100644 index 0000000..ff98ee3 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/ParaguayTest.cs @@ -0,0 +1,59 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class ParaguayTest : AssertCountryTestBase +{ + private const string PARAGUAY_COUNTRY_NAME = "Paraguay"; + private const string PARAGUAY_NATIVE_NAME = "República del Paraguay"; + private const string PARAGUAY_CAPITAL = "Asunción"; + private const string PARAGUAY_OFFICIAL_NAME = "Republic of Paraguay"; + private const string PARAGUAY_ISO2_CODE = "PY"; + private const string PARAGUAY_ISO3_CODE = "PRY"; + private const int PARAGUAY_NUMERIC_CODE = 600; + private readonly string[] PARAGUAY_CALLING_CODE = ["+595"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Paraguay; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Alto Paraguay", "PY-16", "Department"), + new("Alto Paraná", "PY-10", "Department"), + new("Amambay", "PY-13", "Department"), + new("Asunción", "PY-ASU", "Capital District"), + new("Boquerón", "PY-19", "Department"), + new("Caaguazú", "PY-5", "Department"), + new("Caazapá", "PY-6", "Department"), + new("Canindeyú", "PY-11", "Department"), + new("Central", "PY-15", "Department"), + new("Concepción", "PY-1", "Department"), + new("Cordillera", "PY-3", "Department"), + new("Guairá", "PY-4", "Department"), + new("Itapúa", "PY-7", "Department"), + new("Misiones", "PY-8", "Department"), + new("Ñeembucú", "PY-12", "Department"), + new("Paraguarí", "PY-9", "Department"), + new("Presidente Hayes", "PY-17", "Department"), + new("San Pedro", "PY-2", "Department") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForParaguay() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PARAGUAY_COUNTRY_NAME, + PARAGUAY_OFFICIAL_NAME, + PARAGUAY_NATIVE_NAME, + PARAGUAY_CAPITAL, + PARAGUAY_NUMERIC_CODE, + PARAGUAY_ISO2_CODE, + PARAGUAY_ISO3_CODE, + PARAGUAY_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PeruTest.cs b/src/World.Net.UnitTests/Countries/PeruTest.cs new file mode 100644 index 0000000..082efed --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PeruTest.cs @@ -0,0 +1,66 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PeruTest : AssertCountryTestBase +{ + private const string PERU_COUNTRY_NAME = "Peru"; + private const string PERU_NATIVE_NAME = "República del Perú"; + private const string PERU_CAPITAL = "Lima"; + private const string PERU_OFFICIAL_NAME = "Republic of Peru"; + private const string PERU_ISO2_CODE = "PE"; + private const string PERU_ISO3_CODE = "PER"; + private const int PERU_NUMERIC_CODE = 604; + private readonly string[] PERU_CALLING_CODE = ["+51"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Peru; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Amazonas", "PE-AMA", "Region"), + new("Áncash", "PE-ANC", "Region"), + new("Apurímac", "PE-APU", "Region"), + new("Arequipa", "PE-ARE", "Region"), + new("Ayacucho", "PE-AYA", "Region"), + new("Cajamarca", "PE-CAJ", "Region"), + new("Callao", "PE-CAL", "Constitutional Province"), + new("Cusco", "PE-CUS", "Region"), + new("Huancavelica", "PE-HUV", "Region"), + new("Huánuco", "PE-HUC", "Region"), + new("Ica", "PE-ICA", "Region"), + new("Junín", "PE-JUN", "Region"), + new("La Libertad", "PE-LAL", "Region"), + new("Lambayeque", "PE-LAM", "Region"), + new("Lima", "PE-LIM", "Region"), + new("Loreto", "PE-LOR", "Region"), + new("Madre de Dios", "PE-MDD", "Region"), + new("Moquegua", "PE-MOQ", "Region"), + new("Pasco", "PE-PAS", "Region"), + new("Piura", "PE-PIU", "Region"), + new("Puno", "PE-PUN", "Region"), + new("San Martín", "PE-SAM", "Region"), + new("Tacna", "PE-TAC", "Region"), + new("Tumbes", "PE-TUM", "Region"), + new("Ucayali", "PE-UCA", "Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPeru() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PERU_COUNTRY_NAME, + PERU_OFFICIAL_NAME, + PERU_NATIVE_NAME, + PERU_CAPITAL, + PERU_NUMERIC_CODE, + PERU_ISO2_CODE, + PERU_ISO3_CODE, + PERU_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PhilippinesTest.cs b/src/World.Net.UnitTests/Countries/PhilippinesTest.cs new file mode 100644 index 0000000..976d2f6 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PhilippinesTest.cs @@ -0,0 +1,58 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PhilippinesTest : AssertCountryTestBase +{ + private const string PH_COUNTRY_NAME = "Philippines"; + private const string PH_NATIVE_NAME = "Republika ng Pilipinas"; + private const string PH_CAPITAL = "Manila"; + private const string PH_OFFICIAL_NAME = "Republic of the Philippines"; + private const string PH_ISO2_CODE = "PH"; + private const string PH_ISO3_CODE = "PHL"; + private const int PH_NUMERIC_CODE = 608; + private readonly string[] PH_CALLING_CODE = ["+63"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Philippines; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Ilocos Region", "PH-01", "Region"), + new("Cagayan Valley", "PH-02", "Region"), + new("Central Luzon", "PH-03", "Region"), + new("CALABARZON", "PH-04", "Region"), + new("MIMAROPA", "PH-05", "Region"), + new("Bicol Region", "PH-06", "Region"), + new("Western Visayas", "PH-07", "Region"), + new("Central Visayas", "PH-08", "Region"), + new("Eastern Visayas", "PH-09", "Region"), + new("Zamboanga Peninsula", "PH-10", "Region"), + new("Northern Mindanao", "PH-11", "Region"), + new("Davao Region", "PH-12", "Region"), + new("SOCCSKSARGEN", "PH-13", "Region"), + new("Caraga", "PH-14", "Region"), + new("Bangsamoro Autonomous Region in Muslim Mindanao", "PH-15", "Autonomous Region"), + new("Cordillera Administrative Region", "PH-16", "Region"), + new("National Capital Region", "PH-NCR", "Capital Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPhilippines() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PH_COUNTRY_NAME, + PH_OFFICIAL_NAME, + PH_NATIVE_NAME, + PH_CAPITAL, + PH_NUMERIC_CODE, + PH_ISO2_CODE, + PH_ISO3_CODE, + PH_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PitcairnIslandsTest.cs b/src/World.Net.UnitTests/Countries/PitcairnIslandsTest.cs new file mode 100644 index 0000000..60c1ccb --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PitcairnIslandsTest.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class PitcairnIslandsTest : AssertCountryTestBase + { + private const string PITCAIRN_COUNTRY_NAME = "Pitcairn Islands"; + private const string PITCAIRN_NATIVE_NAME = "Pitcairn Islands"; + private const string PITCAIRN_CAPITAL = "Adamstown"; + private const string PITCAIRN_OFFICIAL_NAME = "Pitcairn, Henderson, Ducie and Oeno Islands"; + private const string PITCAIRN_ISO2_CODE = "PN"; + private const string PITCAIRN_ISO3_CODE = "PCN"; + private const int PITCAIRN_NUMERIC_CODE = 612; + private readonly string[] PITCAIRN_CALLING_CODE = ["+64"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.PitcairnIsland; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Pitcairn Island", "PN-PI", "Island") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPitcairnIslands() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PITCAIRN_COUNTRY_NAME, + PITCAIRN_OFFICIAL_NAME, + PITCAIRN_NATIVE_NAME, + PITCAIRN_CAPITAL, + PITCAIRN_NUMERIC_CODE, + PITCAIRN_ISO2_CODE, + PITCAIRN_ISO3_CODE, + PITCAIRN_CALLING_CODE, + EXPECTED_STATES + ); + } + } + +} diff --git a/src/World.Net.UnitTests/Countries/PolandTest.cs b/src/World.Net.UnitTests/Countries/PolandTest.cs new file mode 100644 index 0000000..970fd0a --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PolandTest.cs @@ -0,0 +1,57 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PolandTest : AssertCountryTestBase +{ + private const string POLAND_COUNTRY_NAME = "Poland"; + private const string POLAND_NATIVE_NAME = "Rzeczpospolita Polska"; + private const string POLAND_CAPITAL = "Warsaw"; + private const string POLAND_OFFICIAL_NAME = "Republic of Poland"; + private const string POLAND_ISO2_CODE = "PL"; + private const string POLAND_ISO3_CODE = "POL"; + private const int POLAND_NUMERIC_CODE = 616; + private readonly string[] POLAND_CALLING_CODE = ["+48"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Poland; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Greater Poland", "PL-WP", "Voivodeship"), + new("Kuyavian-Pomeranian", "PL-KP", "Voivodeship"), + new("Lesser Poland", "PL-MA", "Voivodeship"), + new("Łódź", "PL-LD", "Voivodeship"), + new("Lower Silesian", "PL-DS", "Voivodeship"), + new("Lublin", "PL-LU", "Voivodeship"), + new("Lubusz", "PL-LB", "Voivodeship"), + new("Masovian", "PL-MZ", "Voivodeship"), + new("Opole", "PL-OP", "Voivodeship"), + new("Podlaskie", "PL-PD", "Voivodeship"), + new("Pomeranian", "PL-PM", "Voivodeship"), + new("Silesian", "PL-SL", "Voivodeship"), + new("Subcarpathian", "PL-PK", "Voivodeship"), + new("Świętokrzyskie", "PL-SK", "Voivodeship"), + new("Warmian-Masurian", "PL-WN", "Voivodeship"), + new("West Pomeranian", "PL-ZP", "Voivodeship") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPoland() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + POLAND_COUNTRY_NAME, + POLAND_OFFICIAL_NAME, + POLAND_NATIVE_NAME, + POLAND_CAPITAL, + POLAND_NUMERIC_CODE, + POLAND_ISO2_CODE, + POLAND_ISO3_CODE, + POLAND_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PortugalTest.cs b/src/World.Net.UnitTests/Countries/PortugalTest.cs new file mode 100644 index 0000000..99e140b --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PortugalTest.cs @@ -0,0 +1,61 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class PortugalTest : AssertCountryTestBase +{ + private const string PORTUGAL_COUNTRY_NAME = "Portugal"; + private const string PORTUGAL_NATIVE_NAME = "República Portuguesa"; + private const string PORTUGAL_CAPITAL = "Lisbon"; + private const string PORTUGAL_OFFICIAL_NAME = "Portuguese Republic"; + private const string PORTUGAL_ISO2_CODE = "PT"; + private const string PORTUGAL_ISO3_CODE = "PRT"; + private const int PORTUGAL_NUMERIC_CODE = 620; + private readonly string[] PORTUGAL_CALLING_CODE = ["+351"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Portugal; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Aveiro", "PT-01", "District"), + new("Beja", "PT-02", "District"), + new("Braga", "PT-03", "District"), + new("Bragança", "PT-04", "District"), + new("Castelo Branco", "PT-05", "District"), + new("Coimbra", "PT-06", "District"), + new("Évora", "PT-07", "District"), + new("Faro", "PT-08", "District"), + new("Guarda", "PT-09", "District"), + new("Leiria", "PT-10", "District"), + new("Lisbon", "PT-11", "District"), + new("Portalegre", "PT-12", "District"), + new("Porto", "PT-13", "District"), + new("Santarém", "PT-14", "District"), + new("Setúbal", "PT-15", "District"), + new("Viana do Castelo", "PT-16", "District"), + new("Vila Real", "PT-17", "District"), + new("Viseu", "PT-18", "District"), + new("Azores", "PT-20", "Autonomous Region"), + new("Madeira", "PT-30", "Autonomous Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPortugal() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PORTUGAL_COUNTRY_NAME, + PORTUGAL_OFFICIAL_NAME, + PORTUGAL_NATIVE_NAME, + PORTUGAL_CAPITAL, + PORTUGAL_NUMERIC_CODE, + PORTUGAL_ISO2_CODE, + PORTUGAL_ISO3_CODE, + PORTUGAL_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/PuertoRicoTest.cs b/src/World.Net.UnitTests/Countries/PuertoRicoTest.cs new file mode 100644 index 0000000..e6dd730 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/PuertoRicoTest.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class PuertoRicoTest : AssertCountryTestBase + { + private const string PR_COUNTRY_NAME = "Puerto Rico"; + private const string PR_NATIVE_NAME = "Puerto Rico"; + private const string PR_CAPITAL = "San Juan"; + private const string PR_OFFICIAL_NAME = "Commonwealth of Puerto Rico"; + private const string PR_ISO2_CODE = "PR"; + private const string PR_ISO3_CODE = "PRI"; + private const int PR_NUMERIC_CODE = 630; + private readonly string[] PR_CALLING_CODE = ["+1-787", "+1-939"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.PuertoRico; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Puerto Rico", "PR-PR", "Territory") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForPuertoRico() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + PR_COUNTRY_NAME, + PR_OFFICIAL_NAME, + PR_NATIVE_NAME, + PR_CAPITAL, + PR_NUMERIC_CODE, + PR_ISO2_CODE, + PR_ISO3_CODE, + PR_CALLING_CODE, + EXPECTED_STATES + ); + } + } + +} diff --git a/src/World.Net/Countries/Oman.cs b/src/World.Net/Countries/Oman.cs new file mode 100644 index 0000000..c10d379 --- /dev/null +++ b/src/World.Net/Countries/Oman.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries; + +internal sealed class Oman : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Oman; + + // + public string Name { get; } = "Oman"; + + // + public string OfficialName { get; } = "Sultanate of Oman"; + + // + public string NativeName => "عُمان"; + + // + public string Capital { get; } = "Muscat"; + + // + public int NumericCode { get; } = 512; + + // + public string ISO2Code { get; } = "OM"; + + // + public string ISO3Code { get; } = "OMN"; + + // + public string[] CallingCode { get; } = ["+968"]; + + // + public IEnumerable States => + [ + new("Ad Dakhiliyah", "OM-DA", "Governorate"), + new("Ad Dhahirah", "OM-ZA", "Governorate"), + new("Al Batinah North", "OM-BN", "Governorate"), + new("Al Batinah South", "OM-BS", "Governorate"), + new("Al Wusta", "OM-WU", "Governorate"), + new("Ash Sharqiyah North", "OM-SH", "Governorate"), + new("Ash Sharqiyah South", "OM-SS", "Governorate"), + new("Dhofar", "OM-ZU", "Governorate"), + new("Muscat", "OM-MU", "Governorate"), + new("Musandam", "OM-MN", "Governorate"), + new("Al Buraimi", "OM-BR", "Governorate") + ]; +} diff --git a/src/World.Net/Countries/Pakistan.cs b/src/World.Net/Countries/Pakistan.cs new file mode 100644 index 0000000..71c8fb9 --- /dev/null +++ b/src/World.Net/Countries/Pakistan.cs @@ -0,0 +1,44 @@ +namespace World.Net.Countries; + +internal sealed class Pakistan : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Pakistan; + + // + public string Name { get; } = "Pakistan"; + + // + public string OfficialName { get; } = "Islamic Republic of Pakistan"; + + // + public string NativeName => "پاکستان"; + + // + public string Capital { get; } = "Islamabad"; + + // + public int NumericCode { get; } = 586; + + // + public string ISO2Code { get; } = "PK"; + + // + public string ISO3Code { get; } = "PAK"; + + // + public string[] CallingCode { get; } = ["+92"]; + + // + public IEnumerable States => + [ + new("Balochistan", "PK-BA", "Province"), + new("Khyber Pakhtunkhwa", "PK-KP", "Province"), + new("Punjab", "PK-PB", "Province"), + new("Sindh", "PK-SD", "Province"), + new("Gilgit-Baltistan", "PK-GB", "Autonomous Territory"), + new("Azad Jammu and Kashmir", "PK-AJ", "Autonomous Territory"), + new("Islamabad Capital Territory", "PK-IS", "Federal Territory") + ]; +} + diff --git a/src/World.Net/Countries/Palau.cs b/src/World.Net/Countries/Palau.cs new file mode 100644 index 0000000..6b8be98 --- /dev/null +++ b/src/World.Net/Countries/Palau.cs @@ -0,0 +1,52 @@ +namespace World.Net.Countries; + +internal sealed class Palau : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Palau; + + // + public string Name { get; } = "Palau"; + + // + public string OfficialName { get; } = "Republic of Palau"; + + // + public string NativeName => "Belau"; + + // + public string Capital { get; } = "Ngerulmud"; + + // + public int NumericCode { get; } = 585; + + // + public string ISO2Code { get; } = "PW"; + + // + public string ISO3Code { get; } = "PLW"; + + // + public string[] CallingCode { get; } = ["+680"]; + + // + public IEnumerable States => + [ + new("Aimeliik", "PW-002", "State"), + new("Airai", "PW-004", "State"), + new("Angaur", "PW-010", "State"), + new("Hatohobei", "PW-050", "State"), + new("Kayangel", "PW-100", "State"), + new("Koror", "PW-150", "State"), + new("Melekeok", "PW-212", "State"), + new("Ngaraard", "PW-214", "State"), + new("Ngarchelong", "PW-218", "State"), + new("Ngardmau", "PW-222", "State"), + new("Ngatpang", "PW-224", "State"), + new("Ngchesar", "PW-226", "State"), + new("Ngeremlengui", "PW-227", "State"), + new("Ngiwal", "PW-228", "State"), + new("Peleliu", "PW-350", "State"), + new("Sonsorol", "PW-370", "State") + ]; +} diff --git a/src/World.Net/Countries/Palestine.cs b/src/World.Net/Countries/Palestine.cs new file mode 100644 index 0000000..ca178eb --- /dev/null +++ b/src/World.Net/Countries/Palestine.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries; + +internal sealed class Palestine : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.PalestinianTerritoryOccupied; + + // + public string Name { get; } = "Palestinian Territory, Occupied"; + + // + public string OfficialName { get; } = "State of Palestine"; + + // + public string NativeName => "دولة فلسطين"; + + // + public string Capital { get; } = "Ramallah"; + + // + public int NumericCode { get; } = 275; + + // + public string ISO2Code { get; } = "PS"; + + // + public string ISO3Code { get; } = "PSE"; + + // + public string[] CallingCode { get; } = ["+970"]; + + // + public IEnumerable States => + [ + new("Gaza", "PS-GA", "Governorate"), + new("West Bank", "PS-WB", "Governorate") + ]; +} diff --git a/src/World.Net/Countries/Panama.cs b/src/World.Net/Countries/Panama.cs new file mode 100644 index 0000000..40e794c --- /dev/null +++ b/src/World.Net/Countries/Panama.cs @@ -0,0 +1,49 @@ +namespace World.Net.Countries; + +internal sealed class Panama : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Panama; + + // + public string Name { get; } = "Panama"; + + // + public string OfficialName { get; } = "Republic of Panama"; + + // + public string NativeName => "República de Panamá"; + + // + public string Capital { get; } = "Panama City"; + + // + public int NumericCode { get; } = 591; + + // + public string ISO2Code { get; } = "PA"; + + // + public string ISO3Code { get; } = "PAN"; + + // + public string[] CallingCode { get; } = ["+507"]; + + // + public IEnumerable States => + [ + new("Bocas del Toro", "PA-1", "Province"), + new("Chiriquí", "PA-4", "Province"), + new("Coclé", "PA-2", "Province"), + new("Colón", "PA-3", "Province"), + new("Darién", "PA-5", "Province"), + new("Herrera", "PA-6", "Province"), + new("Los Santos", "PA-7", "Province"), + new("Panamá", "PA-8", "Province"), + new("Veraguas", "PA-9", "Province"), + new("Panamá Oeste", "PA-10", "Province"), + new("Kuna Yala", "PA-KY", "Indigenous Region"), + new("Ngäbe-Buglé", "PA-NB", "Indigenous Region"), + new("Emberá-Wounaan", "PA-EM", "Indigenous Region") + ]; +} diff --git a/src/World.Net/Countries/PapuaNewGuinea.cs b/src/World.Net/Countries/PapuaNewGuinea.cs new file mode 100644 index 0000000..77fa44f --- /dev/null +++ b/src/World.Net/Countries/PapuaNewGuinea.cs @@ -0,0 +1,59 @@ +namespace World.Net.Countries; + +internal sealed class PapuaNewGuinea : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.PapuaNewGuinea; + + // + public string Name { get; } = "Papua New Guinea"; + + // + public string OfficialName { get; } = "Independent State of Papua New Guinea"; + + // + public string NativeName => "Papua Niugini"; + + // + public string Capital { get; } = "Port Moresby"; + + // + public int NumericCode { get; } = 598; + + // + public string ISO2Code { get; } = "PG"; + + // + public string ISO3Code { get; } = "PNG"; + + // + public string[] CallingCode { get; } = ["+675"]; + + // + public IEnumerable States => + [ + new("Central", "PG-CN", "Province"), + new("Gulf", "PG-GL", "Province"), + new("Milne Bay", "PG-MB", "Province"), + new("Northern", "PG-NB", "Province"), + new("Southern Highlands", "PG-SH", "Province"), + new("Western", "PG-WP", "Province"), + new("Western Highlands", "PG-WH", "Province"), + new("Enga", "PG-EN", "Province"), + new("Eastern Highlands", "PG-EH", "Province"), + new("Hela", "PG-HE", "Province"), + new("Morobe", "PG-MO", "Province"), + new("Madang", "PG-MD", "Province"), + new("New Ireland", "PG-NI", "Province"), + new("East New Britain", "PG-EB", "Province"), + new("West New Britain", "PG-WB", "Province"), + new("Manus", "PG-MA", "Province"), + new("Bougainville", "PG-BA", "Autonomous Region"), + new("Chimbu", "PG-CP", "Province"), + new("Oro", "PG-OR", "Province"), + new("Sandaun", "PG-SO", "Province"), + new("Central", "PG-CE", "Province"), + new("National Capital District", "PG-NCD", "District") + ]; +} + diff --git a/src/World.Net/Countries/Paraguay.cs b/src/World.Net/Countries/Paraguay.cs new file mode 100644 index 0000000..1be424d --- /dev/null +++ b/src/World.Net/Countries/Paraguay.cs @@ -0,0 +1,55 @@ +namespace World.Net.Countries; + +internal sealed class Paraguay : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Paraguay; + + // + public string Name { get; } = "Paraguay"; + + // + public string OfficialName { get; } = "Republic of Paraguay"; + + // + public string NativeName => "República del Paraguay"; + + // + public string Capital { get; } = "Asunción"; + + // + public int NumericCode { get; } = 600; + + // + public string ISO2Code { get; } = "PY"; + + // + public string ISO3Code { get; } = "PRY"; + + // + public string[] CallingCode { get; } = ["+595"]; + + // + public IEnumerable States => + [ + new("Alto Paraguay", "PY-16", "Department"), + new("Alto Paraná", "PY-10", "Department"), + new("Amambay", "PY-13", "Department"), + new("Asunción", "PY-ASU", "Capital District"), + new("Boquerón", "PY-19", "Department"), + new("Caaguazú", "PY-5", "Department"), + new("Caazapá", "PY-6", "Department"), + new("Canindeyú", "PY-11", "Department"), + new("Central", "PY-15", "Department"), + new("Concepción", "PY-1", "Department"), + new("Cordillera", "PY-3", "Department"), + new("Guairá", "PY-4", "Department"), + new("Itapúa", "PY-7", "Department"), + new("Misiones", "PY-8", "Department"), + new("Ñeembucú", "PY-12", "Department"), + new("Paraguarí", "PY-9", "Department"), + new("Presidente Hayes", "PY-17", "Department"), + new("San Pedro", "PY-2", "Department") + ]; +} + diff --git a/src/World.Net/Countries/Peru.cs b/src/World.Net/Countries/Peru.cs new file mode 100644 index 0000000..0b0529e --- /dev/null +++ b/src/World.Net/Countries/Peru.cs @@ -0,0 +1,62 @@ +namespace World.Net.Countries; + +internal sealed class Peru : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Peru; + + // + public string Name { get; } = "Peru"; + + // + public string OfficialName { get; } = "Republic of Peru"; + + // + public string NativeName => "República del Perú"; + + // + public string Capital { get; } = "Lima"; + + // + public int NumericCode { get; } = 604; + + // + public string ISO2Code { get; } = "PE"; + + // + public string ISO3Code { get; } = "PER"; + + // + public string[] CallingCode { get; } = ["+51"]; + + // + public IEnumerable States => + [ + new("Amazonas", "PE-AMA", "Region"), + new("Áncash", "PE-ANC", "Region"), + new("Apurímac", "PE-APU", "Region"), + new("Arequipa", "PE-ARE", "Region"), + new("Ayacucho", "PE-AYA", "Region"), + new("Cajamarca", "PE-CAJ", "Region"), + new("Callao", "PE-CAL", "Constitutional Province"), + new("Cusco", "PE-CUS", "Region"), + new("Huancavelica", "PE-HUV", "Region"), + new("Huánuco", "PE-HUC", "Region"), + new("Ica", "PE-ICA", "Region"), + new("Junín", "PE-JUN", "Region"), + new("La Libertad", "PE-LAL", "Region"), + new("Lambayeque", "PE-LAM", "Region"), + new("Lima", "PE-LIM", "Region"), + new("Loreto", "PE-LOR", "Region"), + new("Madre de Dios", "PE-MDD", "Region"), + new("Moquegua", "PE-MOQ", "Region"), + new("Pasco", "PE-PAS", "Region"), + new("Piura", "PE-PIU", "Region"), + new("Puno", "PE-PUN", "Region"), + new("San Martín", "PE-SAM", "Region"), + new("Tacna", "PE-TAC", "Region"), + new("Tumbes", "PE-TUM", "Region"), + new("Ucayali", "PE-UCA", "Region") + ]; +} + diff --git a/src/World.Net/Countries/Philippines.cs b/src/World.Net/Countries/Philippines.cs new file mode 100644 index 0000000..4cb4825 --- /dev/null +++ b/src/World.Net/Countries/Philippines.cs @@ -0,0 +1,54 @@ +namespace World.Net.Countries; + +internal sealed class Philippines : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Philippines; + + // + public string Name { get; } = "Philippines"; + + // + public string OfficialName { get; } = "Republic of the Philippines"; + + // + public string NativeName => "Republika ng Pilipinas"; + + // + public string Capital { get; } = "Manila"; + + // + public int NumericCode { get; } = 608; + + // + public string ISO2Code { get; } = "PH"; + + // + public string ISO3Code { get; } = "PHL"; + + // + public string[] CallingCode { get; } = ["+63"]; + + // + public IEnumerable States => + [ + new("Ilocos Region", "PH-01", "Region"), + new("Cagayan Valley", "PH-02", "Region"), + new("Central Luzon", "PH-03", "Region"), + new("CALABARZON", "PH-04", "Region"), + new("MIMAROPA", "PH-05", "Region"), + new("Bicol Region", "PH-06", "Region"), + new("Western Visayas", "PH-07", "Region"), + new("Central Visayas", "PH-08", "Region"), + new("Eastern Visayas", "PH-09", "Region"), + new("Zamboanga Peninsula", "PH-10", "Region"), + new("Northern Mindanao", "PH-11", "Region"), + new("Davao Region", "PH-12", "Region"), + new("SOCCSKSARGEN", "PH-13", "Region"), + new("Caraga", "PH-14", "Region"), + new("Bangsamoro Autonomous Region in Muslim Mindanao", "PH-15", "Autonomous Region"), + new("Cordillera Administrative Region", "PH-16", "Region"), + new("National Capital Region", "PH-NCR", "Capital Region") + ]; +} + diff --git a/src/World.Net/Countries/PitcairnIslands.cs b/src/World.Net/Countries/PitcairnIslands.cs new file mode 100644 index 0000000..83d8563 --- /dev/null +++ b/src/World.Net/Countries/PitcairnIslands.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries; + +internal sealed class PitcairnIslands : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.PitcairnIsland; + + // + public string Name { get; } = "Pitcairn Islands"; + + // + public string OfficialName { get; } = "Pitcairn, Henderson, Ducie and Oeno Islands"; + + // + public string NativeName => "Pitcairn Islands"; + + // + public string Capital { get; } = "Adamstown"; + + // + public int NumericCode { get; } = 612; + + // + public string ISO2Code { get; } = "PN"; + + // + public string ISO3Code { get; } = "PCN"; + + // + public string[] CallingCode { get; } = ["+64"]; + + // + public IEnumerable States => + [ + new("Pitcairn Island", "PN-PI", "Island") + ]; +} + diff --git a/src/World.Net/Countries/Poland.cs b/src/World.Net/Countries/Poland.cs new file mode 100644 index 0000000..5fb66b9 --- /dev/null +++ b/src/World.Net/Countries/Poland.cs @@ -0,0 +1,52 @@ +namespace World.Net.Countries; + +internal sealed class Poland : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Poland; + + // + public string Name { get; } = "Poland"; + + // + public string OfficialName { get; } = "Republic of Poland"; + + // + public string NativeName => "Rzeczpospolita Polska"; + + // + public string Capital { get; } = "Warsaw"; + + // + public int NumericCode { get; } = 616; + + // + public string ISO2Code { get; } = "PL"; + + // + public string ISO3Code { get; } = "POL"; + + // + public string[] CallingCode { get; } = ["+48"]; + + // + public IEnumerable States => + [ + new("Greater Poland", "PL-WP", "Voivodeship"), + new("Kuyavian-Pomeranian", "PL-KP", "Voivodeship"), + new("Lesser Poland", "PL-MA", "Voivodeship"), + new("Łódź", "PL-LD", "Voivodeship"), + new("Lower Silesian", "PL-DS", "Voivodeship"), + new("Lublin", "PL-LU", "Voivodeship"), + new("Lubusz", "PL-LB", "Voivodeship"), + new("Masovian", "PL-MZ", "Voivodeship"), + new("Opole", "PL-OP", "Voivodeship"), + new("Podlaskie", "PL-PD", "Voivodeship"), + new("Pomeranian", "PL-PM", "Voivodeship"), + new("Silesian", "PL-SL", "Voivodeship"), + new("Subcarpathian", "PL-PK", "Voivodeship"), + new("Świętokrzyskie", "PL-SK", "Voivodeship"), + new("Warmian-Masurian", "PL-WN", "Voivodeship"), + new("West Pomeranian", "PL-ZP", "Voivodeship") + ]; +} diff --git a/src/World.Net/Countries/Portugal.cs b/src/World.Net/Countries/Portugal.cs new file mode 100644 index 0000000..f6c4229 --- /dev/null +++ b/src/World.Net/Countries/Portugal.cs @@ -0,0 +1,56 @@ +namespace World.Net.Countries; + +internal sealed class Portugal : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Portugal; + + // + public string Name { get; } = "Portugal"; + + // + public string OfficialName { get; } = "Portuguese Republic"; + + // + public string NativeName => "República Portuguesa"; + + // + public string Capital { get; } = "Lisbon"; + + // + public int NumericCode { get; } = 620; + + // + public string ISO2Code { get; } = "PT"; + + // + public string ISO3Code { get; } = "PRT"; + + // + public string[] CallingCode { get; } = ["+351"]; + + // + public IEnumerable States => + [ + new("Aveiro", "PT-01", "District"), + new("Beja", "PT-02", "District"), + new("Braga", "PT-03", "District"), + new("Bragança", "PT-04", "District"), + new("Castelo Branco", "PT-05", "District"), + new("Coimbra", "PT-06", "District"), + new("Évora", "PT-07", "District"), + new("Faro", "PT-08", "District"), + new("Guarda", "PT-09", "District"), + new("Leiria", "PT-10", "District"), + new("Lisbon", "PT-11", "District"), + new("Portalegre", "PT-12", "District"), + new("Porto", "PT-13", "District"), + new("Santarém", "PT-14", "District"), + new("Setúbal", "PT-15", "District"), + new("Viana do Castelo", "PT-16", "District"), + new("Vila Real", "PT-17", "District"), + new("Viseu", "PT-18", "District"), + new("Azores", "PT-20", "Autonomous Region"), + new("Madeira", "PT-30", "Autonomous Region") + ]; +} diff --git a/src/World.Net/Countries/PuertoRico.cs b/src/World.Net/Countries/PuertoRico.cs new file mode 100644 index 0000000..db43e54 --- /dev/null +++ b/src/World.Net/Countries/PuertoRico.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries; + +internal sealed class PuertoRico : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.PuertoRico; + + // + public string Name { get; } = "Puerto Rico"; + + // + public string OfficialName { get; } = "Commonwealth of Puerto Rico"; + + // + public string NativeName => "Puerto Rico"; + + // + public string Capital { get; } = "San Juan"; + + // + public int NumericCode { get; } = 630; + + // + public string ISO2Code { get; } = "PR"; + + // + public string ISO3Code { get; } = "PRI"; + + // + public string[] CallingCode { get; } = ["+1-787", "+1-939"]; + + // + public IEnumerable States => + [ + new("Puerto Rico", "PR-PR", "Territory") + ]; +} + diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 65d3f87..fa2cfe5 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -1,4 +1,6 @@ -namespace World.Net.Helpers; +using World.Net.Countries; + +namespace World.Net.Helpers; internal sealed class CountryInitializer { @@ -140,6 +142,19 @@ public static Dictionary Initialize() { CountryIdentifier.NorthMacedonia, new NorthMacedonia() }, { CountryIdentifier.NorthernMarianaIslands, new NorthernMarianaIslands() }, { CountryIdentifier.Norway, new Norway() }, + { CountryIdentifier.Oman, new Oman() }, + { CountryIdentifier.Pakistan, new Pakistan() }, + { CountryIdentifier.Palau, new Palau() }, + { CountryIdentifier.PalestinianTerritoryOccupied, new Palestine() }, + { CountryIdentifier.Panama, new Panama() }, + { CountryIdentifier.PapuaNewGuinea, new PapuaNewGuinea() }, + { CountryIdentifier.Paraguay, new Paraguay() }, + { CountryIdentifier.Peru, new Peru() }, + { CountryIdentifier.Philippines, new Philippines() }, + { CountryIdentifier.PitcairnIsland, new PitcairnIslands() }, + { CountryIdentifier.Poland, new Poland() }, + { CountryIdentifier.Portugal, new Portugal() }, + { CountryIdentifier.PuertoRico, new PuertoRico() }, // Future countries can be added here in the same format. };