From 13b04528e2f483aa8d1591e5dc0591a1fe5351cd Mon Sep 17 00:00:00 2001 From: IDAM Date: Sat, 20 Dec 2025 07:33:00 +0100 Subject: [PATCH 1/2] added details for more countries --- .../Countries/MonacoTest.cs | 36 +++++++++++ .../Countries/MongoliaTest.cs | 61 +++++++++++++++++++ .../Countries/MontenegroTest.cs | 60 ++++++++++++++++++ .../Countries/MontserratTest.cs | 36 +++++++++++ .../Countries/MoroccoTest.cs | 50 +++++++++++++++ .../Countries/MozambiqueTest.cs | 49 +++++++++++++++ .../Countries/MyanmarTest.cs | 53 ++++++++++++++++ .../Countries/NamibiaTest.cs | 51 ++++++++++++++++ .../Countries/NauruTest.cs | 52 ++++++++++++++++ .../Countries/NepalTest.cs | 45 ++++++++++++++ .../Countries/NetherlandsTest.cs | 50 +++++++++++++++ .../Countries/NewCaledoniaTest.cs | 41 +++++++++++++ .../Countries/NewZealandTest.cs | 55 +++++++++++++++++ .../Countries/NicaraguaTest.cs | 55 +++++++++++++++++ .../Countries/NigerTest.cs | 46 ++++++++++++++ src/World.Net/Countries/Monaco.cs | 25 ++++++++ src/World.Net/Countries/Mongolia.cs | 49 +++++++++++++++ src/World.Net/Countries/Montenegro.cs | 48 +++++++++++++++ src/World.Net/Countries/Montserrat.cs | 25 ++++++++ src/World.Net/Countries/Morocco.cs | 39 ++++++++++++ src/World.Net/Countries/Mozambique.cs | 38 ++++++++++++ src/World.Net/Countries/Myanmar.cs | 42 +++++++++++++ src/World.Net/Countries/Namibia.cs | 40 ++++++++++++ src/World.Net/Countries/Nauru.cs | 41 +++++++++++++ src/World.Net/Countries/Nepal.cs | 33 ++++++++++ src/World.Net/Countries/Netherlands.cs | 39 ++++++++++++ src/World.Net/Countries/NewCaledonia.cs | 29 +++++++++ src/World.Net/Countries/NewZealand.cs | 44 +++++++++++++ src/World.Net/Countries/Nicaragua.cs | 44 +++++++++++++ src/World.Net/Countries/Niger.cs | 35 +++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 15 +++++ 31 files changed, 1326 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/MonacoTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MongoliaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MontenegroTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MontserratTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MoroccoTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MozambiqueTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MyanmarTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NamibiaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NauruTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NepalTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NetherlandsTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NewCaledoniaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NewZealandTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NicaraguaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/NigerTest.cs create mode 100644 src/World.Net/Countries/Monaco.cs create mode 100644 src/World.Net/Countries/Mongolia.cs create mode 100644 src/World.Net/Countries/Montenegro.cs create mode 100644 src/World.Net/Countries/Montserrat.cs create mode 100644 src/World.Net/Countries/Morocco.cs create mode 100644 src/World.Net/Countries/Mozambique.cs create mode 100644 src/World.Net/Countries/Myanmar.cs create mode 100644 src/World.Net/Countries/Namibia.cs create mode 100644 src/World.Net/Countries/Nauru.cs create mode 100644 src/World.Net/Countries/Nepal.cs create mode 100644 src/World.Net/Countries/Netherlands.cs create mode 100644 src/World.Net/Countries/NewCaledonia.cs create mode 100644 src/World.Net/Countries/NewZealand.cs create mode 100644 src/World.Net/Countries/Nicaragua.cs create mode 100644 src/World.Net/Countries/Niger.cs diff --git a/src/World.Net.UnitTests/Countries/MonacoTest.cs b/src/World.Net.UnitTests/Countries/MonacoTest.cs new file mode 100644 index 0000000..371f46c --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MonacoTest.cs @@ -0,0 +1,36 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MonacoTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Monaco"; + private const string OFFICIAL_NAME = "Principality of Monaco"; + private const string NATIVE_NAME = "Principauté de Monaco"; + private const string CAPITAL = "Monaco"; + private const string ISO2_CODE = "MC"; + private const string ISO3_CODE = "MCO"; + private const int NUMERIC_CODE = 492; + private readonly string[] CALLING_CODE = ["+377"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Monaco; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMonaco() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MongoliaTest.cs b/src/World.Net.UnitTests/Countries/MongoliaTest.cs new file mode 100644 index 0000000..6648804 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MongoliaTest.cs @@ -0,0 +1,61 @@ + +namespace World.Net.UnitTests.Countries; + +public sealed class MongoliaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Mongolia"; + private const string OFFICIAL_NAME = "Mongolia"; + private const string NATIVE_NAME = "Монгол Улс"; + private const string CAPITAL = "Ulaanbaatar"; + private const string ISO2_CODE = "MN"; + private const string ISO3_CODE = "MNG"; + private const int NUMERIC_CODE = 496; + private readonly string[] CALLING_CODE = ["+976"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mongolia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Arkhangai", "MN-073", "Province"), + ("Bayan-Ölgii", "MN-071", "Province"), + ("Bayankhongor", "MN-069", "Province"), + ("Bulgan", "MN-067", "Province"), + ("Darkhan-Uul", "MN-037", "Province"), + ("Dornod", "MN-061", "Province"), + ("Dornogovi", "MN-063", "Province"), + ("Dundgovi", "MN-059", "Province"), + ("Govi-Altai", "MN-065", "Province"), + ("Govisümber", "MN-064", "Province"), + ("Khentii", "MN-039", "Province"), + ("Khovd", "MN-043", "Province"), + ("Khövsgöl", "MN-041", "Province"), + ("Ömnögovi", "MN-053", "Province"), + ("Orkhon", "MN-035", "Province"), + ("Övörkhangai", "MN-055", "Province"), + ("Selenge", "MN-049", "Province"), + ("Sükhbaatar", "MN-051", "Province"), + ("Töv", "MN-047", "Province"), + ("Uvs", "MN-046", "Province"), + ("Zavkhan", "MN-057", "Province"), + ("Ulaanbaatar", "MN-1", "Municipality") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMongolia() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MontenegroTest.cs b/src/World.Net.UnitTests/Countries/MontenegroTest.cs new file mode 100644 index 0000000..38c230b --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MontenegroTest.cs @@ -0,0 +1,60 @@ +using System; +namespace World.Net.UnitTests.Countries; + +public sealed class MontenegroTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Montenegro"; + private const string OFFICIAL_NAME = "Montenegro"; + private const string NATIVE_NAME = "Crna Gora"; + private const string CAPITAL = "Podgorica"; + private const string ISO2_CODE = "ME"; + private const string ISO3_CODE = "MNE"; + private const int NUMERIC_CODE = 499; + private readonly string[] CALLING_CODE = ["+382"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Montenegro; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Andrijevica", "ME-01", "Municipality"), + ("Bar", "ME-02", "Municipality"), + ("Berane", "ME-03", "Municipality"), + ("Bijelo Polje", "ME-04", "Municipality"), + ("Budva", "ME-05", "Municipality"), + ("Cetinje", "ME-06", "Municipality"), + ("Danilovgrad", "ME-07", "Municipality"), + ("Herceg Novi", "ME-08", "Municipality"), + ("Kolašin", "ME-09", "Municipality"), + ("Kotor", "ME-10", "Municipality"), + ("Mojkovac", "ME-11", "Municipality"), + ("Nikšić", "ME-12", "Municipality"), + ("Plav", "ME-13", "Municipality"), + ("Pljevlja", "ME-14", "Municipality"), + ("Plužine", "ME-15", "Municipality"), + ("Podgorica", "ME-16", "Municipality"), + ("Rožaje", "ME-17", "Municipality"), + ("Šavnik", "ME-18", "Municipality"), + ("Tivat", "ME-19", "Municipality"), + ("Ulcinj", "ME-20", "Municipality"), + ("Žabljak", "ME-21", "Municipality") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMontenegro() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MontserratTest.cs b/src/World.Net.UnitTests/Countries/MontserratTest.cs new file mode 100644 index 0000000..5cd55da --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MontserratTest.cs @@ -0,0 +1,36 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MontserratTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Montserrat"; + private const string OFFICIAL_NAME = "Montserrat"; + private const string NATIVE_NAME = "Montserrat"; + private const string CAPITAL = "Plymouth"; + private const string ISO2_CODE = "MS"; + private const string ISO3_CODE = "MSR"; + private const int NUMERIC_CODE = 500; + private readonly string[] CALLING_CODE = ["+1-664"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Montserrat; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMontserrat() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MoroccoTest.cs b/src/World.Net.UnitTests/Countries/MoroccoTest.cs new file mode 100644 index 0000000..61700d4 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MoroccoTest.cs @@ -0,0 +1,50 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MoroccoTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Morocco"; + private const string OFFICIAL_NAME = "Kingdom of Morocco"; + private const string NATIVE_NAME = "المغرب"; + private const string CAPITAL = "Rabat"; + private const string ISO2_CODE = "MA"; + private const string ISO3_CODE = "MAR"; + private const int NUMERIC_CODE = 504; + private readonly string[] CALLING_CODE = ["+212"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Morocco; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Tanger-Tetouan-Al Hoceima", "MA-01", "Region"), + ("Oriental", "MA-02", "Region"), + ("Fes-Meknes", "MA-03", "Region"), + ("Rabat-Sale-Kenitra", "MA-04", "Region"), + ("Beni Mellal-Khenifra", "MA-05", "Region"), + ("Casablanca-Settat", "MA-06", "Region"), + ("Marrakesh-Safi", "MA-07", "Region"), + ("Draa-Tafilalet", "MA-08", "Region"), + ("Souss-Massa", "MA-09", "Region"), + ("Guelmim-Oued Noun", "MA-10", "Region"), + ("Laayoune-Sakia El Hamra", "MA-11", "Region"), + ("Dakhla-Oued Ed-Dahab", "MA-12", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMorocco() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MozambiqueTest.cs b/src/World.Net.UnitTests/Countries/MozambiqueTest.cs new file mode 100644 index 0000000..cb6e744 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MozambiqueTest.cs @@ -0,0 +1,49 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MozambiqueTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Mozambique"; + private const string OFFICIAL_NAME = "Republic of Mozambique"; + private const string NATIVE_NAME = "Moçambique"; + private const string CAPITAL = "Maputo"; + private const string ISO2_CODE = "MZ"; + private const string ISO3_CODE = "MOZ"; + private const int NUMERIC_CODE = 508; + private readonly string[] CALLING_CODE = ["+258"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mozambique; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Cabo Delgado", "MZ-P", "Province"), + ("Gaza", "MZ-G", "Province"), + ("Inhambane", "MZ-I", "Province"), + ("Manica", "MZ-B", "Province"), + ("Maputo Province", "MZ-L", "Province"), + ("Maputo City", "MZ-MPM", "City"), + ("Nampula", "MZ-N", "Province"), + ("Niassa", "MZ-A", "Province"), + ("Sofala", "MZ-S", "Province"), + ("Tete", "MZ-T", "Province"), + ("Zambezia", "MZ-Q", "Province") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMozambique() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MyanmarTest.cs b/src/World.Net.UnitTests/Countries/MyanmarTest.cs new file mode 100644 index 0000000..a3b01f6 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MyanmarTest.cs @@ -0,0 +1,53 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MyanmarTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Myanmar"; + private const string OFFICIAL_NAME = "Republic of the Union of Myanmar"; + private const string NATIVE_NAME = "မြန်မာ"; + private const string CAPITAL = "Naypyidaw"; + private const string ISO2_CODE = "MM"; + private const string ISO3_CODE = "MMR"; + private const int NUMERIC_CODE = 104; + private readonly string[] CALLING_CODE = ["+95"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Myanmar; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Ayeyarwady", "MM-07", "Region"), + ("Bago", "MM-02", "Region"), + ("Chin", "MM-14", "State"), + ("Kachin", "MM-11", "State"), + ("Kayah", "MM-12", "State"), + ("Kayin", "MM-13", "State"), + ("Magway", "MM-03", "Region"), + ("Mandalay", "MM-04", "Region"), + ("Mon", "MM-15", "State"), + ("Naypyidaw", "MM-18", "Union Territory"), + ("Rakhine", "MM-16", "State"), + ("Sagaing", "MM-01", "Region"), + ("Shan", "MM-17", "State"), + ("Tanintharyi", "MM-05", "Region"), + ("Yangon", "MM-06", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMyanmar() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NamibiaTest.cs b/src/World.Net.UnitTests/Countries/NamibiaTest.cs new file mode 100644 index 0000000..f5859a2 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NamibiaTest.cs @@ -0,0 +1,51 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NamibiaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Namibia"; + private const string OFFICIAL_NAME = "Republic of Namibia"; + private const string NATIVE_NAME = "Namibia"; + private const string CAPITAL = "Windhoek"; + private const string ISO2_CODE = "NA"; + private const string ISO3_CODE = "NAM"; + private const int NUMERIC_CODE = 516; + private readonly string[] CALLING_CODE = ["+264"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Namibia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Erongo", "NA-ER", "Region"), + ("Hardap", "NA-HA", "Region"), + ("Kavango East", "NA-KE", "Region"), + ("Kavango West", "NA-KW", "Region"), + ("Khomas", "NA-KH", "Region"), + ("Kunene", "NA-KU", "Region"), + ("Ohangwena", "NA-OW", "Region"), + ("Omaheke", "NA-OH", "Region"), + ("Omusati", "NA-OS", "Region"), + ("Oshana", "NA-ON", "Region"), + ("Oshikoto", "NA-OT", "Region"), + ("Otjozondjupa", "NA-OD", "Region"), + ("Zambezi", "NA-CA", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNamibia() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NauruTest.cs b/src/World.Net.UnitTests/Countries/NauruTest.cs new file mode 100644 index 0000000..59c7c3d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NauruTest.cs @@ -0,0 +1,52 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NauruTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Nauru"; + private const string OFFICIAL_NAME = "Republic of Nauru"; + private const string NATIVE_NAME = "Nauru"; + private const string CAPITAL = "Yaren"; + private const string ISO2_CODE = "NR"; + private const string ISO3_CODE = "NRU"; + private const int NUMERIC_CODE = 520; + private readonly string[] CALLING_CODE = ["+674"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Nauru; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Aiwo", "NR-01", "District"), + ("Anabar", "NR-02", "District"), + ("Anetan", "NR-03", "District"), + ("Anibare", "NR-04", "District"), + ("Baiti", "NR-05", "District"), + ("Boe", "NR-06", "District"), + ("Buada", "NR-07", "District"), + ("Denigomodu", "NR-08", "District"), + ("Ewa", "NR-09", "District"), + ("Ijuw", "NR-10", "District"), + ("Meneng", "NR-11", "District"), + ("Nibok", "NR-12", "District"), + ("Uaboe", "NR-13", "District"), + ("Yaren", "NR-14", "District") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNauru() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NepalTest.cs b/src/World.Net.UnitTests/Countries/NepalTest.cs new file mode 100644 index 0000000..ef96ef1 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NepalTest.cs @@ -0,0 +1,45 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NepalTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Nepal"; + private const string OFFICIAL_NAME = "Federal Democratic Republic of Nepal"; + private const string NATIVE_NAME = "नेपाल"; + private const string CAPITAL = "Kathmandu"; + private const string ISO2_CODE = "NP"; + private const string ISO3_CODE = "NPL"; + private const int NUMERIC_CODE = 524; + private readonly string[] CALLING_CODE = ["+977"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Nepal; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Koshi", "NP-P1", "Province"), + ("Madhesh", "NP-P2", "Province"), + ("Bagmati", "NP-P3", "Province"), + ("Gandaki", "NP-P4", "Province"), + ("Lumbini", "NP-P5", "Province"), + ("Karnali", "NP-P6", "Province"), + ("Sudurpashchim", "NP-P7", "Province") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNepal() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NetherlandsTest.cs b/src/World.Net.UnitTests/Countries/NetherlandsTest.cs new file mode 100644 index 0000000..2235fab --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NetherlandsTest.cs @@ -0,0 +1,50 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NetherlandsTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Netherlands"; + private const string OFFICIAL_NAME = "Kingdom of the Netherlands"; + private const string NATIVE_NAME = "Nederland"; + private const string CAPITAL = "Amsterdam"; + private const string ISO2_CODE = "NL"; + private const string ISO3_CODE = "NLD"; + private const int NUMERIC_CODE = 528; + private readonly string[] CALLING_CODE = ["+31"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Netherlands; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Drenthe", "NL-DR", "Province"), + ("Flevoland", "NL-FL", "Province"), + ("Friesland", "NL-FR", "Province"), + ("Gelderland", "NL-GE", "Province"), + ("Groningen", "NL-GR", "Province"), + ("Limburg", "NL-LI", "Province"), + ("North Brabant", "NL-NB", "Province"), + ("North Holland", "NL-NH", "Province"), + ("Overijssel", "NL-OV", "Province"), + ("South Holland", "NL-ZH", "Province"), + ("Utrecht", "NL-UT", "Province"), + ("Zeeland", "NL-ZE", "Province") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNetherlands() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NewCaledoniaTest.cs b/src/World.Net.UnitTests/Countries/NewCaledoniaTest.cs new file mode 100644 index 0000000..ae95722 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NewCaledoniaTest.cs @@ -0,0 +1,41 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NewCaledoniaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "New Caledonia"; + private const string OFFICIAL_NAME = "New Caledonia"; + private const string NATIVE_NAME = "Nouvelle-Calédonie"; + private const string CAPITAL = "Nouméa"; + private const string ISO2_CODE = "NC"; + private const string ISO3_CODE = "NCL"; + private const int NUMERIC_CODE = 540; + private readonly string[] CALLING_CODE = ["+687"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.NewCaledonia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("North Province", "NC-N", "Province"), + ("South Province", "NC-S", "Province"), + ("Loyalty Islands Province", "NC-L", "Province") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNewCaledonia() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NewZealandTest.cs b/src/World.Net.UnitTests/Countries/NewZealandTest.cs new file mode 100644 index 0000000..6ef0c37 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NewZealandTest.cs @@ -0,0 +1,55 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NewZealandTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "New Zealand"; + private const string OFFICIAL_NAME = "New Zealand"; + private const string NATIVE_NAME = "Aotearoa"; + private const string CAPITAL = "Wellington"; + private const string ISO2_CODE = "NZ"; + private const string ISO3_CODE = "NZL"; + private const int NUMERIC_CODE = 554; + private readonly string[] CALLING_CODE = ["+64"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.NewZealand; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Auckland", "NZ-AUK", "Region"), + ("Bay of Plenty", "NZ-BOP", "Region"), + ("Canterbury", "NZ-CAN", "Region"), + ("Chatham Islands Territory", "NZ-CIT", "Territory"), + ("Gisborne", "NZ-GIS", "Region"), + ("Hawke's Bay", "NZ-HKB", "Region"), + ("Manawatu-Whanganui", "NZ-MWT", "Region"), + ("Marlborough", "NZ-MBH", "Region"), + ("Nelson", "NZ-NSN", "Region"), + ("Northland", "NZ-NTL", "Region"), + ("Otago", "NZ-OTA", "Region"), + ("Southland", "NZ-STL", "Region"), + ("Taranaki", "NZ-TKI", "Region"), + ("Tasman", "NZ-TAS", "Region"), + ("Waikato", "NZ-WKO", "Region"), + ("Wellington", "NZ-WGN", "Region"), + ("West Coast", "NZ-WTC", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNewZealand() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NicaraguaTest.cs b/src/World.Net.UnitTests/Countries/NicaraguaTest.cs new file mode 100644 index 0000000..c4433b2 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NicaraguaTest.cs @@ -0,0 +1,55 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NicaraguaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Nicaragua"; + private const string OFFICIAL_NAME = "Republic of Nicaragua"; + private const string NATIVE_NAME = "Nicaragua"; + private const string CAPITAL = "Managua"; + private const string ISO2_CODE = "NI"; + private const string ISO3_CODE = "NIC"; + private const int NUMERIC_CODE = 558; + private readonly string[] CALLING_CODE = ["+505"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Nicaragua; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Boaco", "NI-BO", "Department"), + ("Carazo", "NI-CA", "Department"), + ("Chinandega", "NI-CI", "Department"), + ("Chontales", "NI-CO", "Department"), + ("Estelí", "NI-ES", "Department"), + ("Granada", "NI-GR", "Department"), + ("Jinotega", "NI-JI", "Department"), + ("León", "NI-LE", "Department"), + ("Madriz", "NI-MD", "Department"), + ("Managua", "NI-MN", "Department"), + ("Masaya", "NI-MS", "Department"), + ("Matagalpa", "NI-MT", "Department"), + ("North Caribbean Coast", "NI-AN", "Autonomous Region"), + ("South Caribbean Coast", "NI-AS", "Autonomous Region"), + ("Nueva Segovia", "NI-NS", "Department"), + ("Rivas", "NI-RI", "Department"), + ("Río San Juan", "NI-SJ", "Department") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNicaragua() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/NigerTest.cs b/src/World.Net.UnitTests/Countries/NigerTest.cs new file mode 100644 index 0000000..0b53aa8 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/NigerTest.cs @@ -0,0 +1,46 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class NigerTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Niger"; + private const string OFFICIAL_NAME = "Republic of the Niger"; + private const string NATIVE_NAME = "Niger"; + private const string CAPITAL = "Niamey"; + private const string ISO2_CODE = "NE"; + private const string ISO3_CODE = "NER"; + private const int NUMERIC_CODE = 562; + private readonly string[] CALLING_CODE = ["+227"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Niger; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Agadez", "NE-1", "Region"), + ("Diffa", "NE-2", "Region"), + ("Dosso", "NE-3", "Region"), + ("Maradi", "NE-4", "Region"), + ("Tahoua", "NE-5", "Region"), + ("Tillabéri", "NE-6", "Region"), + ("Zinder", "NE-7", "Region"), + ("Niamey", "NE-8", "Capital District") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForNiger() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net/Countries/Monaco.cs b/src/World.Net/Countries/Monaco.cs new file mode 100644 index 0000000..8f9c6ab --- /dev/null +++ b/src/World.Net/Countries/Monaco.cs @@ -0,0 +1,25 @@ +namespace World.Net.Countries; + +internal sealed class Monaco : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Monaco; + + public string Name { get; } = "Monaco"; + + public string OfficialName { get; } = "Principality of Monaco"; + + public string NativeName => "Principauté de Monaco"; + + public string Capital { get; } = "Monaco"; + + public int NumericCode { get; } = 492; + + public string ISO2Code { get; } = "MC"; + + public string ISO3Code { get; } = "MCO"; + + public string[] CallingCode { get; } = ["+377"]; + + public IEnumerable States => Array.Empty(); +} + diff --git a/src/World.Net/Countries/Mongolia.cs b/src/World.Net/Countries/Mongolia.cs new file mode 100644 index 0000000..41fb274 --- /dev/null +++ b/src/World.Net/Countries/Mongolia.cs @@ -0,0 +1,49 @@ +namespace World.Net.Countries; + +internal sealed class Mongolia : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mongolia; + + public string Name { get; } = "Mongolia"; + + public string OfficialName { get; } = "Mongolia"; + + public string NativeName => "Монгол Улс"; + + public string Capital { get; } = "Ulaanbaatar"; + + public int NumericCode { get; } = 496; + + public string ISO2Code { get; } = "MN"; + + public string ISO3Code { get; } = "MNG"; + + public string[] CallingCode { get; } = ["+976"]; + + public IEnumerable States => new[] + { + new State("Arkhangai", "MN-073", "Province"), + new State("Bayan-Ölgii", "MN-071", "Province"), + new State("Bayankhongor", "MN-069", "Province"), + new State("Bulgan", "MN-067", "Province"), + new State("Darkhan-Uul", "MN-037", "Province"), + new State("Dornod", "MN-061", "Province"), + new State("Dornogovi", "MN-063", "Province"), + new State("Dundgovi", "MN-059", "Province"), + new State("Govi-Altai", "MN-065", "Province"), + new State("Govisümber", "MN-064", "Province"), + new State("Khentii", "MN-039", "Province"), + new State("Khovd", "MN-043", "Province"), + new State("Khövsgöl", "MN-041", "Province"), + new State("Ömnögovi", "MN-053", "Province"), + new State("Orkhon", "MN-035", "Province"), + new State("Övörkhangai", "MN-055", "Province"), + new State("Selenge", "MN-049", "Province"), + new State("Sükhbaatar", "MN-051", "Province"), + new State("Töv", "MN-047", "Province"), + new State("Uvs", "MN-046", "Province"), + new State("Zavkhan", "MN-057", "Province"), + new State("Ulaanbaatar", "MN-1", "Municipality") + }; +} + diff --git a/src/World.Net/Countries/Montenegro.cs b/src/World.Net/Countries/Montenegro.cs new file mode 100644 index 0000000..c6aaf09 --- /dev/null +++ b/src/World.Net/Countries/Montenegro.cs @@ -0,0 +1,48 @@ +namespace World.Net.Countries; + +internal sealed class Montenegro : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Montenegro; + + public string Name { get; } = "Montenegro"; + + public string OfficialName { get; } = "Montenegro"; + + public string NativeName => "Crna Gora"; + + public string Capital { get; } = "Podgorica"; + + public int NumericCode { get; } = 499; + + public string ISO2Code { get; } = "ME"; + + public string ISO3Code { get; } = "MNE"; + + public string[] CallingCode { get; } = ["+382"]; + + public IEnumerable States => new[] + { + new State("Andrijevica", "ME-01", "Municipality"), + new State("Bar", "ME-02", "Municipality"), + new State("Berane", "ME-03", "Municipality"), + new State("Bijelo Polje", "ME-04", "Municipality"), + new State("Budva", "ME-05", "Municipality"), + new State("Cetinje", "ME-06", "Municipality"), + new State("Danilovgrad", "ME-07", "Municipality"), + new State("Herceg Novi", "ME-08", "Municipality"), + new State("Kolašin", "ME-09", "Municipality"), + new State("Kotor", "ME-10", "Municipality"), + new State("Mojkovac", "ME-11", "Municipality"), + new State("Nikšić", "ME-12", "Municipality"), + new State("Plav", "ME-13", "Municipality"), + new State("Pljevlja", "ME-14", "Municipality"), + new State("Plužine", "ME-15", "Municipality"), + new State("Podgorica", "ME-16", "Municipality"), + new State("Rožaje", "ME-17", "Municipality"), + new State("Šavnik", "ME-18", "Municipality"), + new State("Tivat", "ME-19", "Municipality"), + new State("Ulcinj", "ME-20", "Municipality"), + new State("Žabljak", "ME-21", "Municipality") + }; +} + diff --git a/src/World.Net/Countries/Montserrat.cs b/src/World.Net/Countries/Montserrat.cs new file mode 100644 index 0000000..74b34d9 --- /dev/null +++ b/src/World.Net/Countries/Montserrat.cs @@ -0,0 +1,25 @@ +namespace World.Net.Countries; + +internal sealed class Montserrat : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Montserrat; + + public string Name { get; } = "Montserrat"; + + public string OfficialName { get; } = "Montserrat"; + + public string NativeName => "Montserrat"; + + public string Capital { get; } = "Plymouth"; + + public int NumericCode { get; } = 500; + + public string ISO2Code { get; } = "MS"; + + public string ISO3Code { get; } = "MSR"; + + public string[] CallingCode { get; } = ["+1-664"]; + + public IEnumerable States => Array.Empty(); +} + diff --git a/src/World.Net/Countries/Morocco.cs b/src/World.Net/Countries/Morocco.cs new file mode 100644 index 0000000..c8c5a95 --- /dev/null +++ b/src/World.Net/Countries/Morocco.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries; + +internal sealed class Morocco : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Morocco; + + public string Name { get; } = "Morocco"; + + public string OfficialName { get; } = "Kingdom of Morocco"; + + public string NativeName => "المغرب"; + + public string Capital { get; } = "Rabat"; + + public int NumericCode { get; } = 504; + + public string ISO2Code { get; } = "MA"; + + public string ISO3Code { get; } = "MAR"; + + public string[] CallingCode { get; } = ["+212"]; + + public IEnumerable States => new[] + { + new State("Tanger-Tetouan-Al Hoceima", "MA-01", "Region"), + new State("Oriental", "MA-02", "Region"), + new State("Fes-Meknes", "MA-03", "Region"), + new State("Rabat-Sale-Kenitra", "MA-04", "Region"), + new State("Beni Mellal-Khenifra", "MA-05", "Region"), + new State("Casablanca-Settat", "MA-06", "Region"), + new State("Marrakesh-Safi", "MA-07", "Region"), + new State("Draa-Tafilalet", "MA-08", "Region"), + new State("Souss-Massa", "MA-09", "Region"), + new State("Guelmim-Oued Noun", "MA-10", "Region"), + new State("Laayoune-Sakia El Hamra", "MA-11", "Region"), + new State("Dakhla-Oued Ed-Dahab", "MA-12", "Region") + }; +} + diff --git a/src/World.Net/Countries/Mozambique.cs b/src/World.Net/Countries/Mozambique.cs new file mode 100644 index 0000000..8583d90 --- /dev/null +++ b/src/World.Net/Countries/Mozambique.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries; + +internal sealed class Mozambique : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mozambique; + + public string Name { get; } = "Mozambique"; + + public string OfficialName { get; } = "Republic of Mozambique"; + + public string NativeName => "Moçambique"; + + public string Capital { get; } = "Maputo"; + + public int NumericCode { get; } = 508; + + public string ISO2Code { get; } = "MZ"; + + public string ISO3Code { get; } = "MOZ"; + + public string[] CallingCode { get; } = ["+258"]; + + public IEnumerable States => new[] + { + new State("Cabo Delgado", "MZ-P", "Province"), + new State("Gaza", "MZ-G", "Province"), + new State("Inhambane", "MZ-I", "Province"), + new State("Manica", "MZ-B", "Province"), + new State("Maputo Province", "MZ-L", "Province"), + new State("Maputo City", "MZ-MPM", "City"), + new State("Nampula", "MZ-N", "Province"), + new State("Niassa", "MZ-A", "Province"), + new State("Sofala", "MZ-S", "Province"), + new State("Tete", "MZ-T", "Province"), + new State("Zambezia", "MZ-Q", "Province") + }; +} + diff --git a/src/World.Net/Countries/Myanmar.cs b/src/World.Net/Countries/Myanmar.cs new file mode 100644 index 0000000..4502b49 --- /dev/null +++ b/src/World.Net/Countries/Myanmar.cs @@ -0,0 +1,42 @@ +namespace World.Net.Countries; + +internal sealed class Myanmar : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Myanmar; + + public string Name { get; } = "Myanmar"; + + public string OfficialName { get; } = "Republic of the Union of Myanmar"; + + public string NativeName => "မြန်မာ"; + + public string Capital { get; } = "Naypyidaw"; + + public int NumericCode { get; } = 104; + + public string ISO2Code { get; } = "MM"; + + public string ISO3Code { get; } = "MMR"; + + public string[] CallingCode { get; } = ["+95"]; + + public IEnumerable States => new[] + { + new State("Ayeyarwady", "MM-07", "Region"), + new State("Bago", "MM-02", "Region"), + new State("Chin", "MM-14", "State"), + new State("Kachin", "MM-11", "State"), + new State("Kayah", "MM-12", "State"), + new State("Kayin", "MM-13", "State"), + new State("Magway", "MM-03", "Region"), + new State("Mandalay", "MM-04", "Region"), + new State("Mon", "MM-15", "State"), + new State("Naypyidaw", "MM-18", "Union Territory"), + new State("Rakhine", "MM-16", "State"), + new State("Sagaing", "MM-01", "Region"), + new State("Shan", "MM-17", "State"), + new State("Tanintharyi", "MM-05", "Region"), + new State("Yangon", "MM-06", "Region") + }; +} + diff --git a/src/World.Net/Countries/Namibia.cs b/src/World.Net/Countries/Namibia.cs new file mode 100644 index 0000000..64b84db --- /dev/null +++ b/src/World.Net/Countries/Namibia.cs @@ -0,0 +1,40 @@ +namespace World.Net.Countries; + +internal sealed class Namibia : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Namibia; + + public string Name { get; } = "Namibia"; + + public string OfficialName { get; } = "Republic of Namibia"; + + public string NativeName => "Namibia"; + + public string Capital { get; } = "Windhoek"; + + public int NumericCode { get; } = 516; + + public string ISO2Code { get; } = "NA"; + + public string ISO3Code { get; } = "NAM"; + + public string[] CallingCode { get; } = ["+264"]; + + public IEnumerable States => new[] + { + new State("Erongo", "NA-ER", "Region"), + new State("Hardap", "NA-HA", "Region"), + new State("Kavango East", "NA-KE", "Region"), + new State("Kavango West", "NA-KW", "Region"), + new State("Khomas", "NA-KH", "Region"), + new State("Kunene", "NA-KU", "Region"), + new State("Ohangwena", "NA-OW", "Region"), + new State("Omaheke", "NA-OH", "Region"), + new State("Omusati", "NA-OS", "Region"), + new State("Oshana", "NA-ON", "Region"), + new State("Oshikoto", "NA-OT", "Region"), + new State("Otjozondjupa", "NA-OD", "Region"), + new State("Zambezi", "NA-CA", "Region") + }; +} + diff --git a/src/World.Net/Countries/Nauru.cs b/src/World.Net/Countries/Nauru.cs new file mode 100644 index 0000000..5628083 --- /dev/null +++ b/src/World.Net/Countries/Nauru.cs @@ -0,0 +1,41 @@ +namespace World.Net.Countries; + +internal sealed class Nauru : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Nauru; + + public string Name { get; } = "Nauru"; + + public string OfficialName { get; } = "Republic of Nauru"; + + public string NativeName => "Nauru"; + + public string Capital { get; } = "Yaren"; + + public int NumericCode { get; } = 520; + + public string ISO2Code { get; } = "NR"; + + public string ISO3Code { get; } = "NRU"; + + public string[] CallingCode { get; } = ["+674"]; + + public IEnumerable States => new[] + { + new State("Aiwo", "NR-01", "District"), + new State("Anabar", "NR-02", "District"), + new State("Anetan", "NR-03", "District"), + new State("Anibare", "NR-04", "District"), + new State("Baiti", "NR-05", "District"), + new State("Boe", "NR-06", "District"), + new State("Buada", "NR-07", "District"), + new State("Denigomodu", "NR-08", "District"), + new State("Ewa", "NR-09", "District"), + new State("Ijuw", "NR-10", "District"), + new State("Meneng", "NR-11", "District"), + new State("Nibok", "NR-12", "District"), + new State("Uaboe", "NR-13", "District"), + new State("Yaren", "NR-14", "District") + }; +} + diff --git a/src/World.Net/Countries/Nepal.cs b/src/World.Net/Countries/Nepal.cs new file mode 100644 index 0000000..6f74352 --- /dev/null +++ b/src/World.Net/Countries/Nepal.cs @@ -0,0 +1,33 @@ +namespace World.Net.Countries; + +internal sealed class Nepal : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Nepal; + + public string Name { get; } = "Nepal"; + + public string OfficialName { get; } = "Federal Democratic Republic of Nepal"; + + public string NativeName => "नेपाल"; + + public string Capital { get; } = "Kathmandu"; + + public int NumericCode { get; } = 524; + + public string ISO2Code { get; } = "NP"; + + public string ISO3Code { get; } = "NPL"; + + public string[] CallingCode { get; } = ["+977"]; + + public IEnumerable States => new[] + { + new State("Koshi", "NP-P1", "Province"), + new State("Madhesh", "NP-P2", "Province"), + new State("Bagmati", "NP-P3", "Province"), + new State("Gandaki", "NP-P4", "Province"), + new State("Lumbini", "NP-P5", "Province"), + new State("Karnali", "NP-P6", "Province"), + new State("Sudurpashchim", "NP-P7", "Province") + }; +} diff --git a/src/World.Net/Countries/Netherlands.cs b/src/World.Net/Countries/Netherlands.cs new file mode 100644 index 0000000..577a47e --- /dev/null +++ b/src/World.Net/Countries/Netherlands.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries; + +internal sealed class Netherlands : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Netherlands; + + public string Name { get; } = "Netherlands"; + + public string OfficialName { get; } = "Kingdom of the Netherlands"; + + public string NativeName => "Nederland"; + + public string Capital { get; } = "Amsterdam"; + + public int NumericCode { get; } = 528; + + public string ISO2Code { get; } = "NL"; + + public string ISO3Code { get; } = "NLD"; + + public string[] CallingCode { get; } = ["+31"]; + + public IEnumerable States => new[] + { + new State("Drenthe", "NL-DR", "Province"), + new State("Flevoland", "NL-FL", "Province"), + new State("Friesland", "NL-FR", "Province"), + new State("Gelderland", "NL-GE", "Province"), + new State("Groningen", "NL-GR", "Province"), + new State("Limburg", "NL-LI", "Province"), + new State("North Brabant", "NL-NB", "Province"), + new State("North Holland", "NL-NH", "Province"), + new State("Overijssel", "NL-OV", "Province"), + new State("South Holland", "NL-ZH", "Province"), + new State("Utrecht", "NL-UT", "Province"), + new State("Zeeland", "NL-ZE", "Province") + }; +} + diff --git a/src/World.Net/Countries/NewCaledonia.cs b/src/World.Net/Countries/NewCaledonia.cs new file mode 100644 index 0000000..85acbe0 --- /dev/null +++ b/src/World.Net/Countries/NewCaledonia.cs @@ -0,0 +1,29 @@ +namespace World.Net.Countries; + +internal sealed class NewCaledonia : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.NewCaledonia; + + public string Name { get; } = "New Caledonia"; + + public string OfficialName { get; } = "New Caledonia"; + + public string NativeName => "Nouvelle-Calédonie"; + + public string Capital { get; } = "Nouméa"; + + public int NumericCode { get; } = 540; + + public string ISO2Code { get; } = "NC"; + + public string ISO3Code { get; } = "NCL"; + + public string[] CallingCode { get; } = ["+687"]; + + public IEnumerable States => new[] + { + new State("North Province", "NC-N", "Province"), + new State("South Province", "NC-S", "Province"), + new State("Loyalty Islands Province", "NC-L", "Province") + }; +} diff --git a/src/World.Net/Countries/NewZealand.cs b/src/World.Net/Countries/NewZealand.cs new file mode 100644 index 0000000..fa83ce9 --- /dev/null +++ b/src/World.Net/Countries/NewZealand.cs @@ -0,0 +1,44 @@ +namespace World.Net.Countries; + +internal sealed class NewZealand : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.NewZealand; + + public string Name { get; } = "New Zealand"; + + public string OfficialName { get; } = "New Zealand"; + + public string NativeName => "Aotearoa"; + + public string Capital { get; } = "Wellington"; + + public int NumericCode { get; } = 554; + + public string ISO2Code { get; } = "NZ"; + + public string ISO3Code { get; } = "NZL"; + + public string[] CallingCode { get; } = ["+64"]; + + public IEnumerable States => new[] + { + new State("Auckland", "NZ-AUK", "Region"), + new State("Bay of Plenty", "NZ-BOP", "Region"), + new State("Canterbury", "NZ-CAN", "Region"), + new State("Chatham Islands Territory", "NZ-CIT", "Territory"), + new State("Gisborne", "NZ-GIS", "Region"), + new State("Hawke's Bay", "NZ-HKB", "Region"), + new State("Manawatu-Whanganui", "NZ-MWT", "Region"), + new State("Marlborough", "NZ-MBH", "Region"), + new State("Nelson", "NZ-NSN", "Region"), + new State("Northland", "NZ-NTL", "Region"), + new State("Otago", "NZ-OTA", "Region"), + new State("Southland", "NZ-STL", "Region"), + new State("Taranaki", "NZ-TKI", "Region"), + new State("Tasman", "NZ-TAS", "Region"), + new State("Waikato", "NZ-WKO", "Region"), + new State("Wellington", "NZ-WGN", "Region"), + new State("West Coast", "NZ-WTC", "Region") + }; +} + diff --git a/src/World.Net/Countries/Nicaragua.cs b/src/World.Net/Countries/Nicaragua.cs new file mode 100644 index 0000000..193f09f --- /dev/null +++ b/src/World.Net/Countries/Nicaragua.cs @@ -0,0 +1,44 @@ +namespace World.Net.Countries; + +internal sealed class Nicaragua : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Nicaragua; + + public string Name { get; } = "Nicaragua"; + + public string OfficialName { get; } = "Republic of Nicaragua"; + + public string NativeName => "Nicaragua"; + + public string Capital { get; } = "Managua"; + + public int NumericCode { get; } = 558; + + public string ISO2Code { get; } = "NI"; + + public string ISO3Code { get; } = "NIC"; + + public string[] CallingCode { get; } = ["+505"]; + + public IEnumerable States => new[] + { + new State("Boaco", "NI-BO", "Department"), + new State("Carazo", "NI-CA", "Department"), + new State("Chinandega", "NI-CI", "Department"), + new State("Chontales", "NI-CO", "Department"), + new State("Estelí", "NI-ES", "Department"), + new State("Granada", "NI-GR", "Department"), + new State("Jinotega", "NI-JI", "Department"), + new State("León", "NI-LE", "Department"), + new State("Madriz", "NI-MD", "Department"), + new State("Managua", "NI-MN", "Department"), + new State("Masaya", "NI-MS", "Department"), + new State("Matagalpa", "NI-MT", "Department"), + new State("North Caribbean Coast", "NI-AN", "Autonomous Region"), + new State("South Caribbean Coast", "NI-AS", "Autonomous Region"), + new State("Nueva Segovia", "NI-NS", "Department"), + new State("Rivas", "NI-RI", "Department"), + new State("Río San Juan", "NI-SJ", "Department") + }; +} + diff --git a/src/World.Net/Countries/Niger.cs b/src/World.Net/Countries/Niger.cs new file mode 100644 index 0000000..2b5c5c2 --- /dev/null +++ b/src/World.Net/Countries/Niger.cs @@ -0,0 +1,35 @@ +namespace World.Net.Countries; + +internal sealed class Niger : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Niger; + + public string Name { get; } = "Niger"; + + public string OfficialName { get; } = "Republic of the Niger"; + + public string NativeName => "Niger"; + + public string Capital { get; } = "Niamey"; + + public int NumericCode { get; } = 562; + + public string ISO2Code { get; } = "NE"; + + public string ISO3Code { get; } = "NER"; + + public string[] CallingCode { get; } = ["+227"]; + + public IEnumerable States => new[] + { + new State("Agadez", "NE-1", "Region"), + new State("Diffa", "NE-2", "Region"), + new State("Dosso", "NE-3", "Region"), + new State("Maradi", "NE-4", "Region"), + new State("Tahoua", "NE-5", "Region"), + new State("Tillabéri", "NE-6", "Region"), + new State("Zinder", "NE-7", "Region"), + new State("Niamey", "NE-8", "Capital District") + }; +} + diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 99434f3..a5d11fe 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -135,6 +135,21 @@ public static Dictionary Initialize() { CountryIdentifier.Luxembourg, new Luxembourg() }, { CountryIdentifier.MacauSAR, new MacauSAR() }, { CountryIdentifier.Madagascar, new Madagascar() }, + { CountryIdentifier.Monaco, new Monaco() }, + { CountryIdentifier.Mongolia, new Mongolia() }, + { CountryIdentifier.Montenegro, new Montenegro() }, + { CountryIdentifier.Montserrat, new Montserrat() }, + { CountryIdentifier.Morocco, new Morocco() }, + { CountryIdentifier.Mozambique, new Mozambique() }, + { CountryIdentifier.Myanmar, new Myanmar() }, + { CountryIdentifier.Namibia, new Namibia() }, + { CountryIdentifier.Nauru, new Nauru() }, + { CountryIdentifier.Nepal, new Nepal() }, + { CountryIdentifier.Netherlands, new Netherlands() }, + { CountryIdentifier.NewCaledonia, new NewCaledonia() }, + { CountryIdentifier.NewZealand, new NewZealand() }, + { CountryIdentifier.Nicaragua, new Nicaragua() }, + { CountryIdentifier.Niger, new Niger() }, { CountryIdentifier.Nigeria, new Nigeria() }, { CountryIdentifier.Niue, new Niue() }, { CountryIdentifier.NorfolkIsland, new NorfolkIsland() }, From 334376aa21e1a3b405f3b5cf9aecea93f050c0a0 Mon Sep 17 00:00:00 2001 From: IDAM Date: Sat, 20 Dec 2025 08:00:37 +0100 Subject: [PATCH 2/2] added details for more countries --- .../Countries/IsleOfManTest.cs | 44 +++++++++++ .../Countries/MalawiTest.cs | 41 +++++++++++ .../Countries/MalaysiaTest.cs | 54 ++++++++++++++ .../Countries/MaldivesTest.cs | 58 +++++++++++++++ src/World.Net.UnitTests/Countries/MaliTest.cs | 47 ++++++++++++ .../Countries/MaltaTest.cs | 44 +++++++++++ .../Countries/MarshallIslandsTest.cs | 60 +++++++++++++++ .../Countries/MartiniqueTest.cs | 36 +++++++++ .../Countries/MauritaniaTest.cs | 53 ++++++++++++++ .../Countries/MauritiusTest.cs | 47 ++++++++++++ .../Countries/MayotteTest.cs | 44 +++++++++++ .../Countries/MexicoTest.cs | 70 ++++++++++++++++++ .../Countries/MicronesiaTest.cs | 42 +++++++++++ .../Countries/MoldovaTest.cs | 73 +++++++++++++++++++ src/World.Net/Countries/IsleOfMan.cs | 33 +++++++++ src/World.Net/Countries/Malawi.cs | 30 ++++++++ src/World.Net/Countries/Malaysia.cs | 43 +++++++++++ src/World.Net/Countries/Maldives.cs | 47 ++++++++++++ src/World.Net/Countries/Mali.cs | 36 +++++++++ src/World.Net/Countries/Malta.cs | 33 +++++++++ src/World.Net/Countries/MarshallIslands.cs | 49 +++++++++++++ src/World.Net/Countries/Martinique.cs | 25 +++++++ src/World.Net/Countries/Mauritania.cs | 42 +++++++++++ src/World.Net/Countries/Mauritius.cs | 36 +++++++++ src/World.Net/Countries/Mayotte.cs | 25 +++++++ src/World.Net/Countries/Mexico.cs | 59 +++++++++++++++ src/World.Net/Countries/Micronesia.cs | 31 ++++++++ src/World.Net/Countries/Moldova.cs | 62 ++++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 14 ++++ 29 files changed, 1278 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/IsleOfManTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MalawiTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MalaysiaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MaldivesTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MaliTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MaltaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MarshallIslandsTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MartiniqueTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MauritaniaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MauritiusTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MayotteTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MexicoTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MicronesiaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/MoldovaTest.cs create mode 100644 src/World.Net/Countries/IsleOfMan.cs create mode 100644 src/World.Net/Countries/Malawi.cs create mode 100644 src/World.Net/Countries/Malaysia.cs create mode 100644 src/World.Net/Countries/Maldives.cs create mode 100644 src/World.Net/Countries/Mali.cs create mode 100644 src/World.Net/Countries/Malta.cs create mode 100644 src/World.Net/Countries/MarshallIslands.cs create mode 100644 src/World.Net/Countries/Martinique.cs create mode 100644 src/World.Net/Countries/Mauritania.cs create mode 100644 src/World.Net/Countries/Mauritius.cs create mode 100644 src/World.Net/Countries/Mayotte.cs create mode 100644 src/World.Net/Countries/Mexico.cs create mode 100644 src/World.Net/Countries/Micronesia.cs create mode 100644 src/World.Net/Countries/Moldova.cs diff --git a/src/World.Net.UnitTests/Countries/IsleOfManTest.cs b/src/World.Net.UnitTests/Countries/IsleOfManTest.cs new file mode 100644 index 0000000..926fe22 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/IsleOfManTest.cs @@ -0,0 +1,44 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class IsleOfManTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Isle of Man"; + private const string OFFICIAL_NAME = "Isle of Man"; + private const string NATIVE_NAME = "Ellan Vannin"; + private const string CAPITAL = "Douglas"; + private const string ISO2_CODE = "IM"; + private const string ISO3_CODE = "IMN"; + private const int NUMERIC_CODE = 833; + private readonly string[] CALLING_CODE = ["+44"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.IsleOfMan; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Ayre", "IM-01", "Sheading"), + ("Garff", "IM-02", "Sheading"), + ("Glenfaba", "IM-03", "Sheading"), + ("Michael", "IM-04", "Sheading"), + ("Middle", "IM-05", "Sheading"), + ("Rushen", "IM-06", "Sheading") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForIsleOfMan() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MalawiTest.cs b/src/World.Net.UnitTests/Countries/MalawiTest.cs new file mode 100644 index 0000000..da793b6 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MalawiTest.cs @@ -0,0 +1,41 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MalawiTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Malawi"; + private const string OFFICIAL_NAME = "Republic of Malawi"; + private const string NATIVE_NAME = "Malawi"; + private const string CAPITAL = "Lilongwe"; + private const string ISO2_CODE = "MW"; + private const string ISO3_CODE = "MWI"; + private const int NUMERIC_CODE = 454; + private readonly string[] CALLING_CODE = ["+265"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Malawi; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Central Region", "MW-C", "Region"), + ("Northern Region", "MW-N", "Region"), + ("Southern Region", "MW-S", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMalawi() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MalaysiaTest.cs b/src/World.Net.UnitTests/Countries/MalaysiaTest.cs new file mode 100644 index 0000000..e3a264c --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MalaysiaTest.cs @@ -0,0 +1,54 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MalaysiaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Malaysia"; + private const string OFFICIAL_NAME = "Malaysia"; + private const string NATIVE_NAME = "Malaysia"; + private const string CAPITAL = "Kuala Lumpur"; + private const string ISO2_CODE = "MY"; + private const string ISO3_CODE = "MYS"; + private const int NUMERIC_CODE = 458; + private readonly string[] CALLING_CODE = ["+60"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Malaysia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Johor", "MY-01", "State"), + ("Kedah", "MY-02", "State"), + ("Kelantan", "MY-03", "State"), + ("Malacca", "MY-04", "State"), + ("Negeri Sembilan", "MY-05", "State"), + ("Pahang", "MY-06", "State"), + ("Penang", "MY-07", "State"), + ("Perak", "MY-08", "State"), + ("Perlis", "MY-09", "State"), + ("Selangor", "MY-10", "State"), + ("Terengganu", "MY-11", "State"), + ("Sabah", "MY-12", "State"), + ("Sarawak", "MY-13", "State"), + ("Kuala Lumpur", "MY-14", "Federal Territory"), + ("Labuan", "MY-15", "Federal Territory"), + ("Putrajaya", "MY-16", "Federal Territory") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMalaysia() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MaldivesTest.cs b/src/World.Net.UnitTests/Countries/MaldivesTest.cs new file mode 100644 index 0000000..75245e5 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MaldivesTest.cs @@ -0,0 +1,58 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MaldivesTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Maldives"; + private const string OFFICIAL_NAME = "Republic of Maldives"; + private const string NATIVE_NAME = "Dhivehi Raajje"; + private const string CAPITAL = "Malé"; + private const string ISO2_CODE = "MV"; + private const string ISO3_CODE = "MDV"; + private const int NUMERIC_CODE = 462; + private readonly string[] CALLING_CODE = ["+960"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Maldives; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Alif Alif", "MV-02", "Administrative Atoll"), + ("Alif Dhaal", "MV-00", "Administrative Atoll"), + ("Baa", "MV-20", "Administrative Atoll"), + ("Dhaalu", "MV-17", "Administrative Atoll"), + ("Faafu", "MV-14", "Administrative Atoll"), + ("Gaafu Alif", "MV-27", "Administrative Atoll"), + ("Gaafu Dhaalu", "MV-28", "Administrative Atoll"), + ("Gnaviyani", "MV-29", "Administrative Atoll"), + ("Haa Alif", "MV-07", "Administrative Atoll"), + ("Haa Dhaalu", "MV-23", "Administrative Atoll"), + ("Kaafu", "MV-26", "Administrative Atoll"), + ("Laamu", "MV-05", "Administrative Atoll"), + ("Lhaviyani", "MV-03", "Administrative Atoll"), + ("Meemu", "MV-12", "Administrative Atoll"), + ("Noonu", "MV-25", "Administrative Atoll"), + ("Raa", "MV-13", "Administrative Atoll"), + ("Shaviyani", "MV-24", "Administrative Atoll"), + ("Thaa", "MV-08", "Administrative Atoll"), + ("Vaavu", "MV-04", "Administrative Atoll"), + ("Malé", "MV-MLE", "City") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMaldives() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MaliTest.cs b/src/World.Net.UnitTests/Countries/MaliTest.cs new file mode 100644 index 0000000..5563b5a --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MaliTest.cs @@ -0,0 +1,47 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MaliTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Mali"; + private const string OFFICIAL_NAME = "Republic of Mali"; + private const string NATIVE_NAME = "Mali"; + private const string CAPITAL = "Bamako"; + private const string ISO2_CODE = "ML"; + private const string ISO3_CODE = "MLI"; + private const int NUMERIC_CODE = 466; + private readonly string[] CALLING_CODE = ["+223"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mali; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Bamako", "ML-BKO", "District"), + ("Gao", "ML-7", "Region"), + ("Kayes", "ML-1", "Region"), + ("Kidal", "ML-8", "Region"), + ("Koulikoro", "ML-2", "Region"), + ("Mopti", "ML-5", "Region"), + ("Ségou", "ML-4", "Region"), + ("Sikasso", "ML-3", "Region"), + ("Tombouctou", "ML-6", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMali() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MaltaTest.cs b/src/World.Net.UnitTests/Countries/MaltaTest.cs new file mode 100644 index 0000000..813bd48 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MaltaTest.cs @@ -0,0 +1,44 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MaltaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Malta"; + private const string OFFICIAL_NAME = "Republic of Malta"; + private const string NATIVE_NAME = "Malta"; + private const string CAPITAL = "Valletta"; + private const string ISO2_CODE = "MT"; + private const string ISO3_CODE = "MLT"; + private const int NUMERIC_CODE = 470; + private readonly string[] CALLING_CODE = ["+356"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Malta; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Gozo", "MT-45", "Region"), + ("Northern Harbour", "MT-48", "Region"), + ("Northern", "MT-51", "Region"), + ("South Eastern", "MT-52", "Region"), + ("Southern Harbour", "MT-53", "Region"), + ("Western", "MT-55", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMalta() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MarshallIslandsTest.cs b/src/World.Net.UnitTests/Countries/MarshallIslandsTest.cs new file mode 100644 index 0000000..c542e08 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MarshallIslandsTest.cs @@ -0,0 +1,60 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MarshallIslandsTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Marshall Islands"; + private const string OFFICIAL_NAME = "Republic of the Marshall Islands"; + private const string NATIVE_NAME = "Aelōn̄ in M̧ajeļ"; + private const string CAPITAL = "Majuro"; + private const string ISO2_CODE = "MH"; + private const string ISO3_CODE = "MHL"; + private const int NUMERIC_CODE = 584; + private readonly string[] CALLING_CODE = ["+692"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.MarshallIslands; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Ailinglaplap", "MH-ALL", "Municipality"), + ("Arno", "MH-ARN", "Municipality"), + ("Aur", "MH-AUR", "Municipality"), + ("Ebeye", "MH-EBN", "Municipality"), + ("Enewetak", "MH-ENI", "Municipality"), + ("Jabat", "MH-JAB", "Municipality"), + ("Jaluit", "MH-JAL", "Municipality"), + ("Kwajalein", "MH-KWA", "Municipality"), + ("Lae", "MH-LAE", "Municipality"), + ("Lib", "MH-LIB", "Municipality"), + ("Likiep", "MH-LIK", "Municipality"), + ("Majuro", "MH-MAJ", "Municipality"), + ("Maloelap", "MH-MAL", "Municipality"), + ("Mejit", "MH-MEJ", "Municipality"), + ("Mili", "MH-MIL", "Municipality"), + ("Namdrik", "MH-NMK", "Municipality"), + ("Namu", "MH-NMU", "Municipality"), + ("Rongelap", "MH-RON", "Municipality"), + ("Ujae", "MH-UJA", "Municipality"), + ("Utrik", "MH-UTI", "Municipality"), + ("Wotho", "MH-WTH", "Municipality"), + ("Wotje", "MH-WTJ", "Municipality") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMarshallIslands() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MartiniqueTest.cs b/src/World.Net.UnitTests/Countries/MartiniqueTest.cs new file mode 100644 index 0000000..d135d18 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MartiniqueTest.cs @@ -0,0 +1,36 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MartiniqueTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Martinique"; + private const string OFFICIAL_NAME = "Martinique"; + private const string NATIVE_NAME = "Martinique"; + private const string CAPITAL = "Fort-de-France"; + private const string ISO2_CODE = "MQ"; + private const string ISO3_CODE = "MTQ"; + private const int NUMERIC_CODE = 474; + private readonly string[] CALLING_CODE = ["+596"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Martinique; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = Array.Empty<(string, string, string)>(); + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMartinique() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MauritaniaTest.cs b/src/World.Net.UnitTests/Countries/MauritaniaTest.cs new file mode 100644 index 0000000..11c0766 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MauritaniaTest.cs @@ -0,0 +1,53 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MauritaniaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Mauritania"; + private const string OFFICIAL_NAME = "Islamic Republic of Mauritania"; + private const string NATIVE_NAME = "الجمهورية الإسلامية الموريتانية"; + private const string CAPITAL = "Nouakchott"; + private const string ISO2_CODE = "MR"; + private const string ISO3_CODE = "MRT"; + private const int NUMERIC_CODE = 478; + private readonly string[] CALLING_CODE = ["+222"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mauritania; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Adrar", "MR-07", "Region"), + ("Assaba", "MR-03", "Region"), + ("Brakna", "MR-05", "Region"), + ("Dakhlet Nouadhibou", "MR-08", "Region"), + ("Gorgol", "MR-04", "Region"), + ("Guidimaka", "MR-10", "Region"), + ("Hodh Ech Chargui", "MR-01", "Region"), + ("Hodh El Gharbi", "MR-02", "Region"), + ("Inchiri", "MR-12", "Region"), + ("Nouakchott Nord", "MR-14", "Region"), + ("Nouakchott Ouest", "MR-13", "Region"), + ("Nouakchott Sud", "MR-15", "Region"), + ("Tagant", "MR-09", "Region"), + ("Tiris Zemmour", "MR-11", "Region"), + ("Trarza", "MR-06", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMauritania() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MauritiusTest.cs b/src/World.Net.UnitTests/Countries/MauritiusTest.cs new file mode 100644 index 0000000..67cec15 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MauritiusTest.cs @@ -0,0 +1,47 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MauritiusTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Mauritius"; + private const string OFFICIAL_NAME = "Republic of Mauritius"; + private const string NATIVE_NAME = "Maurice"; + private const string CAPITAL = "Port Louis"; + private const string ISO2_CODE = "MU"; + private const string ISO3_CODE = "MUS"; + private const int NUMERIC_CODE = 480; + private readonly string[] CALLING_CODE = ["+230"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mauritius; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Black River", "MU-BL", "District"), + ("Flacq", "MU-FL", "District"), + ("Grand Port", "MU-GP", "District"), + ("Moka", "MU-MO", "District"), + ("Pamplemousses", "MU-PA", "District"), + ("Plaines Wilhems", "MU-PW", "District"), + ("Port Louis", "MU-PL", "District"), + ("Rivière du Rempart", "MU-RR", "District"), + ("Savanne", "MU-SA", "District") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMauritius() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MayotteTest.cs b/src/World.Net.UnitTests/Countries/MayotteTest.cs new file mode 100644 index 0000000..b3bce14 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MayotteTest.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class MayotteTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Mayotte"; + private const string OFFICIAL_NAME = "Department of Mayotte"; + private const string NATIVE_NAME = "Mayotte"; + private const string CAPITAL = "Mamoudzou"; + private const string ISO2_CODE = "YT"; + private const string ISO3_CODE = "MYT"; + private const int NUMERIC_CODE = 175; + private readonly string[] CALLING_CODE = ["+262"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mayotte; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = Array.Empty<(string, string, string)>(); + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMayotte() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } + } + +} diff --git a/src/World.Net.UnitTests/Countries/MexicoTest.cs b/src/World.Net.UnitTests/Countries/MexicoTest.cs new file mode 100644 index 0000000..854f2fe --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MexicoTest.cs @@ -0,0 +1,70 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MexicoTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Mexico"; + private const string OFFICIAL_NAME = "United Mexican States"; + private const string NATIVE_NAME = "México"; + private const string CAPITAL = "Mexico City"; + private const string ISO2_CODE = "MX"; + private const string ISO3_CODE = "MEX"; + private const int NUMERIC_CODE = 484; + private readonly string[] CALLING_CODE = ["+52"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Mexico; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Aguascalientes", "MX-AGU", "State"), + ("Baja California", "MX-BCN", "State"), + ("Baja California Sur", "MX-BCS", "State"), + ("Campeche", "MX-CAM", "State"), + ("Chiapas", "MX-CHP", "State"), + ("Chihuahua", "MX-CHH", "State"), + ("Coahuila", "MX-COA", "State"), + ("Colima", "MX-COL", "State"), + ("Durango", "MX-DUR", "State"), + ("Guanajuato", "MX-GUA", "State"), + ("Guerrero", "MX-GRO", "State"), + ("Hidalgo", "MX-HID", "State"), + ("Jalisco", "MX-JAL", "State"), + ("Mexico City", "MX-CMX", "Federal District"), + ("México", "MX-MEX", "State"), + ("Michoacán", "MX-MIC", "State"), + ("Morelos", "MX-MOR", "State"), + ("Nayarit", "MX-NAY", "State"), + ("Nuevo León", "MX-NLE", "State"), + ("Oaxaca", "MX-OAX", "State"), + ("Puebla", "MX-PUE", "State"), + ("Querétaro", "MX-QUE", "State"), + ("Quintana Roo", "MX-ROO", "State"), + ("San Luis Potosí", "MX-SLP", "State"), + ("Sinaloa", "MX-SIN", "State"), + ("Sonora", "MX-SON", "State"), + ("Tabasco", "MX-TAB", "State"), + ("Tamaulipas", "MX-TAM", "State"), + ("Tlaxcala", "MX-TLA", "State"), + ("Veracruz", "MX-VER", "State"), + ("Yucatán", "MX-YUC", "State"), + ("Zacatecas", "MX-ZAC", "State") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMexico() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MicronesiaTest.cs b/src/World.Net.UnitTests/Countries/MicronesiaTest.cs new file mode 100644 index 0000000..83bf8b3 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MicronesiaTest.cs @@ -0,0 +1,42 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MicronesiaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Micronesia"; + private const string OFFICIAL_NAME = "Federated States of Micronesia"; + private const string NATIVE_NAME = "Federated States of Micronesia"; + private const string CAPITAL = "Palikir"; + private const string ISO2_CODE = "FM"; + private const string ISO3_CODE = "FSM"; + private const int NUMERIC_CODE = 583; + private readonly string[] CALLING_CODE = ["+691"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Micronesia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Chuuk", "FM-TRK", "State"), + ("Kosrae", "FM-KSA", "State"), + ("Pohnpei", "FM-PNI", "State"), + ("Yap", "FM-YAP", "State") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMicronesia() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/MoldovaTest.cs b/src/World.Net.UnitTests/Countries/MoldovaTest.cs new file mode 100644 index 0000000..5ae87a5 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MoldovaTest.cs @@ -0,0 +1,73 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class MoldovaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Moldova"; + private const string OFFICIAL_NAME = "Republic of Moldova"; + private const string NATIVE_NAME = "Republica Moldova"; + private const string CAPITAL = "Chișinău"; + private const string ISO2_CODE = "MD"; + private const string ISO3_CODE = "MDA"; + private const int NUMERIC_CODE = 498; + private readonly string[] CALLING_CODE = ["+373"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Moldova; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Bălți", "MD-BA", "City"), + ("Bender", "MD-BD", "City"), + ("Chișinău", "MD-CU", "City"), + ("Anenii Noi", "MD-AN", "District"), + ("Basarabeasca", "MD-BS", "District"), + ("Briceni", "MD-BR", "District"), + ("Cahul", "MD-CA", "District"), + ("Cantemir", "MD-CT", "District"), + ("Călărași", "MD-CL", "District"), + ("Cimișlia", "MD-CM", "District"), + ("Criuleni", "MD-CR", "District"), + ("Dondușeni", "MD-DO", "District"), + ("Drochia", "MD-DR", "District"), + ("Dubăsari", "MD-DU", "District"), + ("Edineț", "MD-ED", "District"), + ("Fălești", "MD-FA", "District"), + ("Florești", "MD-FL", "District"), + ("Glodeni", "MD-GL", "District"), + ("Hîncești", "MD-HI", "District"), + ("Ialoveni", "MD-IA", "District"), + ("Leova", "MD-LE", "District"), + ("Nisporeni", "MD-NI", "District"), + ("Ocnița", "MD-OC", "District"), + ("Orhei", "MD-OR", "District"), + ("Rezina", "MD-RE", "District"), + ("Rîșcani", "MD-RI", "District"), + ("Sîngerei", "MD-SI", "District"), + ("Soroca", "MD-SO", "District"), + ("Strășeni", "MD-ST", "District"), + ("Șoldănești", "MD-SD", "District"), + ("Ștefan Vodă", "MD-SV", "District"), + ("Taraclia", "MD-TA", "District"), + ("Telenești", "MD-TE", "District"), + ("Ungheni", "MD-UN", "District"), + ("Gagauzia", "MD-GA", "Autonomous Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMoldova() + { + var country = CountryProvider.GetCountry(EXPECTEDID); + + AssertCorrectInformation( + country, + EXPECTEDID, + COUNTRY_NAME, + OFFICIAL_NAME, + NATIVE_NAME, + CAPITAL, + NUMERIC_CODE, + ISO2_CODE, + ISO3_CODE, + CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net/Countries/IsleOfMan.cs b/src/World.Net/Countries/IsleOfMan.cs new file mode 100644 index 0000000..d7c5903 --- /dev/null +++ b/src/World.Net/Countries/IsleOfMan.cs @@ -0,0 +1,33 @@ +namespace World.Net.Countries; + +internal sealed class IsleOfMan : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.IsleOfMan; + + public string Name { get; } = "Isle of Man"; + + public string OfficialName { get; } = "Isle of Man"; + + public string NativeName => "Ellan Vannin"; + + public string Capital { get; } = "Douglas"; + + public int NumericCode { get; } = 833; + + public string ISO2Code { get; } = "IM"; + + public string ISO3Code { get; } = "IMN"; + + public string[] CallingCode { get; } = ["+44"]; + + public IEnumerable States => new[] + { + new State("Ayre", "IM-01", "Sheading"), + new State("Garff", "IM-02", "Sheading"), + new State("Glenfaba", "IM-03", "Sheading"), + new State("Michael", "IM-04", "Sheading"), + new State("Middle", "IM-05", "Sheading"), + new State("Rushen", "IM-06", "Sheading") + }; +} + diff --git a/src/World.Net/Countries/Malawi.cs b/src/World.Net/Countries/Malawi.cs new file mode 100644 index 0000000..4cf0965 --- /dev/null +++ b/src/World.Net/Countries/Malawi.cs @@ -0,0 +1,30 @@ +namespace World.Net.Countries; + +internal sealed class Malawi : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Malawi; + + public string Name { get; } = "Malawi"; + + public string OfficialName { get; } = "Republic of Malawi"; + + public string NativeName => "Malawi"; + + public string Capital { get; } = "Lilongwe"; + + public int NumericCode { get; } = 454; + + public string ISO2Code { get; } = "MW"; + + public string ISO3Code { get; } = "MWI"; + + public string[] CallingCode { get; } = ["+265"]; + + public IEnumerable States => new[] + { + new State("Central Region", "MW-C", "Region"), + new State("Northern Region", "MW-N", "Region"), + new State("Southern Region", "MW-S", "Region") + }; +} + diff --git a/src/World.Net/Countries/Malaysia.cs b/src/World.Net/Countries/Malaysia.cs new file mode 100644 index 0000000..2d078ee --- /dev/null +++ b/src/World.Net/Countries/Malaysia.cs @@ -0,0 +1,43 @@ +namespace World.Net.Countries; + +internal sealed class Malaysia : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Malaysia; + + public string Name { get; } = "Malaysia"; + + public string OfficialName { get; } = "Malaysia"; + + public string NativeName => "Malaysia"; + + public string Capital { get; } = "Kuala Lumpur"; + + public int NumericCode { get; } = 458; + + public string ISO2Code { get; } = "MY"; + + public string ISO3Code { get; } = "MYS"; + + public string[] CallingCode { get; } = ["+60"]; + + public IEnumerable States => new[] + { + new State("Johor", "MY-01", "State"), + new State("Kedah", "MY-02", "State"), + new State("Kelantan", "MY-03", "State"), + new State("Malacca", "MY-04", "State"), + new State("Negeri Sembilan", "MY-05", "State"), + new State("Pahang", "MY-06", "State"), + new State("Penang", "MY-07", "State"), + new State("Perak", "MY-08", "State"), + new State("Perlis", "MY-09", "State"), + new State("Selangor", "MY-10", "State"), + new State("Terengganu", "MY-11", "State"), + new State("Sabah", "MY-12", "State"), + new State("Sarawak", "MY-13", "State"), + new State("Kuala Lumpur", "MY-14", "Federal Territory"), + new State("Labuan", "MY-15", "Federal Territory"), + new State("Putrajaya", "MY-16", "Federal Territory") + }; +} + diff --git a/src/World.Net/Countries/Maldives.cs b/src/World.Net/Countries/Maldives.cs new file mode 100644 index 0000000..90e6b6a --- /dev/null +++ b/src/World.Net/Countries/Maldives.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries; + +internal sealed class Maldives : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Maldives; + + public string Name { get; } = "Maldives"; + + public string OfficialName { get; } = "Republic of Maldives"; + + public string NativeName => "Dhivehi Raajje"; + + public string Capital { get; } = "Malé"; + + public int NumericCode { get; } = 462; + + public string ISO2Code { get; } = "MV"; + + public string ISO3Code { get; } = "MDV"; + + public string[] CallingCode { get; } = ["+960"]; + + public IEnumerable States => new[] + { + new State("Alif Alif", "MV-02", "Administrative Atoll"), + new State("Alif Dhaal", "MV-00", "Administrative Atoll"), + new State("Baa", "MV-20", "Administrative Atoll"), + new State("Dhaalu", "MV-17", "Administrative Atoll"), + new State("Faafu", "MV-14", "Administrative Atoll"), + new State("Gaafu Alif", "MV-27", "Administrative Atoll"), + new State("Gaafu Dhaalu", "MV-28", "Administrative Atoll"), + new State("Gnaviyani", "MV-29", "Administrative Atoll"), + new State("Haa Alif", "MV-07", "Administrative Atoll"), + new State("Haa Dhaalu", "MV-23", "Administrative Atoll"), + new State("Kaafu", "MV-26", "Administrative Atoll"), + new State("Laamu", "MV-05", "Administrative Atoll"), + new State("Lhaviyani", "MV-03", "Administrative Atoll"), + new State("Meemu", "MV-12", "Administrative Atoll"), + new State("Noonu", "MV-25", "Administrative Atoll"), + new State("Raa", "MV-13", "Administrative Atoll"), + new State("Shaviyani", "MV-24", "Administrative Atoll"), + new State("Thaa", "MV-08", "Administrative Atoll"), + new State("Vaavu", "MV-04", "Administrative Atoll"), + new State("Malé", "MV-MLE", "City") + }; +} + diff --git a/src/World.Net/Countries/Mali.cs b/src/World.Net/Countries/Mali.cs new file mode 100644 index 0000000..73fdf9c --- /dev/null +++ b/src/World.Net/Countries/Mali.cs @@ -0,0 +1,36 @@ +namespace World.Net.Countries; + +internal sealed class Mali : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mali; + + public string Name { get; } = "Mali"; + + public string OfficialName { get; } = "Republic of Mali"; + + public string NativeName => "Mali"; + + public string Capital { get; } = "Bamako"; + + public int NumericCode { get; } = 466; + + public string ISO2Code { get; } = "ML"; + + public string ISO3Code { get; } = "MLI"; + + public string[] CallingCode { get; } = ["+223"]; + + public IEnumerable States => new[] + { + new State("Bamako", "ML-BKO", "District"), + new State("Gao", "ML-7", "Region"), + new State("Kayes", "ML-1", "Region"), + new State("Kidal", "ML-8", "Region"), + new State("Koulikoro", "ML-2", "Region"), + new State("Mopti", "ML-5", "Region"), + new State("Ségou", "ML-4", "Region"), + new State("Sikasso", "ML-3", "Region"), + new State("Tombouctou", "ML-6", "Region") + }; +} + diff --git a/src/World.Net/Countries/Malta.cs b/src/World.Net/Countries/Malta.cs new file mode 100644 index 0000000..45d6c6b --- /dev/null +++ b/src/World.Net/Countries/Malta.cs @@ -0,0 +1,33 @@ +namespace World.Net.Countries; + +internal sealed class Malta : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Malta; + + public string Name { get; } = "Malta"; + + public string OfficialName { get; } = "Republic of Malta"; + + public string NativeName => "Malta"; + + public string Capital { get; } = "Valletta"; + + public int NumericCode { get; } = 470; + + public string ISO2Code { get; } = "MT"; + + public string ISO3Code { get; } = "MLT"; + + public string[] CallingCode { get; } = ["+356"]; + + public IEnumerable States => new[] + { + new State("Gozo", "MT-45", "Region"), + new State("Northern Harbour", "MT-48", "Region"), + new State("Northern", "MT-51", "Region"), + new State("South Eastern", "MT-52", "Region"), + new State("Southern Harbour", "MT-53", "Region"), + new State("Western", "MT-55", "Region") + }; +} + diff --git a/src/World.Net/Countries/MarshallIslands.cs b/src/World.Net/Countries/MarshallIslands.cs new file mode 100644 index 0000000..fed232c --- /dev/null +++ b/src/World.Net/Countries/MarshallIslands.cs @@ -0,0 +1,49 @@ +namespace World.Net.Countries; + +internal sealed class MarshallIslands : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.MarshallIslands; + + public string Name { get; } = "Marshall Islands"; + + public string OfficialName { get; } = "Republic of the Marshall Islands"; + + public string NativeName => "Aelōn̄ in M̧ajeļ"; + + public string Capital { get; } = "Majuro"; + + public int NumericCode { get; } = 584; + + public string ISO2Code { get; } = "MH"; + + public string ISO3Code { get; } = "MHL"; + + public string[] CallingCode { get; } = ["+692"]; + + public IEnumerable States => new[] + { + new State("Ailinglaplap", "MH-ALL", "Municipality"), + new State("Arno", "MH-ARN", "Municipality"), + new State("Aur", "MH-AUR", "Municipality"), + new State("Ebeye", "MH-EBN", "Municipality"), + new State("Enewetak", "MH-ENI", "Municipality"), + new State("Jabat", "MH-JAB", "Municipality"), + new State("Jaluit", "MH-JAL", "Municipality"), + new State("Kwajalein", "MH-KWA", "Municipality"), + new State("Lae", "MH-LAE", "Municipality"), + new State("Lib", "MH-LIB", "Municipality"), + new State("Likiep", "MH-LIK", "Municipality"), + new State("Majuro", "MH-MAJ", "Municipality"), + new State("Maloelap", "MH-MAL", "Municipality"), + new State("Mejit", "MH-MEJ", "Municipality"), + new State("Mili", "MH-MIL", "Municipality"), + new State("Namdrik", "MH-NMK", "Municipality"), + new State("Namu", "MH-NMU", "Municipality"), + new State("Rongelap", "MH-RON", "Municipality"), + new State("Ujae", "MH-UJA", "Municipality"), + new State("Utrik", "MH-UTI", "Municipality"), + new State("Wotho", "MH-WTH", "Municipality"), + new State("Wotje", "MH-WTJ", "Municipality") + }; +} + diff --git a/src/World.Net/Countries/Martinique.cs b/src/World.Net/Countries/Martinique.cs new file mode 100644 index 0000000..91d0c04 --- /dev/null +++ b/src/World.Net/Countries/Martinique.cs @@ -0,0 +1,25 @@ +namespace World.Net.Countries; + +internal sealed class Martinique : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Martinique; + + public string Name { get; } = "Martinique"; + + public string OfficialName { get; } = "Martinique"; + + public string NativeName => "Martinique"; + + public string Capital { get; } = "Fort-de-France"; + + public int NumericCode { get; } = 474; + + public string ISO2Code { get; } = "MQ"; + + public string ISO3Code { get; } = "MTQ"; + + public string[] CallingCode { get; } = ["+596"]; + + public IEnumerable States => Array.Empty(); +} + diff --git a/src/World.Net/Countries/Mauritania.cs b/src/World.Net/Countries/Mauritania.cs new file mode 100644 index 0000000..6619545 --- /dev/null +++ b/src/World.Net/Countries/Mauritania.cs @@ -0,0 +1,42 @@ +namespace World.Net.Countries; + +internal sealed class Mauritania : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mauritania; + + public string Name { get; } = "Mauritania"; + + public string OfficialName { get; } = "Islamic Republic of Mauritania"; + + public string NativeName => "الجمهورية الإسلامية الموريتانية"; + + public string Capital { get; } = "Nouakchott"; + + public int NumericCode { get; } = 478; + + public string ISO2Code { get; } = "MR"; + + public string ISO3Code { get; } = "MRT"; + + public string[] CallingCode { get; } = ["+222"]; + + public IEnumerable States => new[] + { + new State("Adrar", "MR-07", "Region"), + new State("Assaba", "MR-03", "Region"), + new State("Brakna", "MR-05", "Region"), + new State("Dakhlet Nouadhibou", "MR-08", "Region"), + new State("Gorgol", "MR-04", "Region"), + new State("Guidimaka", "MR-10", "Region"), + new State("Hodh Ech Chargui", "MR-01", "Region"), + new State("Hodh El Gharbi", "MR-02", "Region"), + new State("Inchiri", "MR-12", "Region"), + new State("Nouakchott Nord", "MR-14", "Region"), + new State("Nouakchott Ouest", "MR-13", "Region"), + new State("Nouakchott Sud", "MR-15", "Region"), + new State("Tagant", "MR-09", "Region"), + new State("Tiris Zemmour", "MR-11", "Region"), + new State("Trarza", "MR-06", "Region") + }; +} + diff --git a/src/World.Net/Countries/Mauritius.cs b/src/World.Net/Countries/Mauritius.cs new file mode 100644 index 0000000..72d71fe --- /dev/null +++ b/src/World.Net/Countries/Mauritius.cs @@ -0,0 +1,36 @@ +namespace World.Net.Countries; + +internal sealed class Mauritius : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mauritius; + + public string Name { get; } = "Mauritius"; + + public string OfficialName { get; } = "Republic of Mauritius"; + + public string NativeName => "Maurice"; + + public string Capital { get; } = "Port Louis"; + + public int NumericCode { get; } = 480; + + public string ISO2Code { get; } = "MU"; + + public string ISO3Code { get; } = "MUS"; + + public string[] CallingCode { get; } = ["+230"]; + + public IEnumerable States => new[] + { + new State("Black River", "MU-BL", "District"), + new State("Flacq", "MU-FL", "District"), + new State("Grand Port", "MU-GP", "District"), + new State("Moka", "MU-MO", "District"), + new State("Pamplemousses", "MU-PA", "District"), + new State("Plaines Wilhems", "MU-PW", "District"), + new State("Port Louis", "MU-PL", "District"), + new State("Rivière du Rempart", "MU-RR", "District"), + new State("Savanne", "MU-SA", "District") + }; +} + diff --git a/src/World.Net/Countries/Mayotte.cs b/src/World.Net/Countries/Mayotte.cs new file mode 100644 index 0000000..9934e09 --- /dev/null +++ b/src/World.Net/Countries/Mayotte.cs @@ -0,0 +1,25 @@ +namespace World.Net.Countries; + +internal sealed class Mayotte : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mayotte; + + public string Name { get; } = "Mayotte"; + + public string OfficialName { get; } = "Department of Mayotte"; + + public string NativeName => "Mayotte"; + + public string Capital { get; } = "Mamoudzou"; + + public int NumericCode { get; } = 175; + + public string ISO2Code { get; } = "YT"; + + public string ISO3Code { get; } = "MYT"; + + public string[] CallingCode { get; } = ["+262"]; + + public IEnumerable States => Array.Empty(); +} + diff --git a/src/World.Net/Countries/Mexico.cs b/src/World.Net/Countries/Mexico.cs new file mode 100644 index 0000000..b146c2d --- /dev/null +++ b/src/World.Net/Countries/Mexico.cs @@ -0,0 +1,59 @@ +namespace World.Net.Countries; + +internal sealed class Mexico : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Mexico; + + public string Name { get; } = "Mexico"; + + public string OfficialName { get; } = "United Mexican States"; + + public string NativeName => "México"; + + public string Capital { get; } = "Mexico City"; + + public int NumericCode { get; } = 484; + + public string ISO2Code { get; } = "MX"; + + public string ISO3Code { get; } = "MEX"; + + public string[] CallingCode { get; } = ["+52"]; + + public IEnumerable States => new[] + { + new State("Aguascalientes", "MX-AGU", "State"), + new State("Baja California", "MX-BCN", "State"), + new State("Baja California Sur", "MX-BCS", "State"), + new State("Campeche", "MX-CAM", "State"), + new State("Chiapas", "MX-CHP", "State"), + new State("Chihuahua", "MX-CHH", "State"), + new State("Coahuila", "MX-COA", "State"), + new State("Colima", "MX-COL", "State"), + new State("Durango", "MX-DUR", "State"), + new State("Guanajuato", "MX-GUA", "State"), + new State("Guerrero", "MX-GRO", "State"), + new State("Hidalgo", "MX-HID", "State"), + new State("Jalisco", "MX-JAL", "State"), + new State("Mexico City", "MX-CMX", "Federal District"), + new State("México", "MX-MEX", "State"), + new State("Michoacán", "MX-MIC", "State"), + new State("Morelos", "MX-MOR", "State"), + new State("Nayarit", "MX-NAY", "State"), + new State("Nuevo León", "MX-NLE", "State"), + new State("Oaxaca", "MX-OAX", "State"), + new State("Puebla", "MX-PUE", "State"), + new State("Querétaro", "MX-QUE", "State"), + new State("Quintana Roo", "MX-ROO", "State"), + new State("San Luis Potosí", "MX-SLP", "State"), + new State("Sinaloa", "MX-SIN", "State"), + new State("Sonora", "MX-SON", "State"), + new State("Tabasco", "MX-TAB", "State"), + new State("Tamaulipas", "MX-TAM", "State"), + new State("Tlaxcala", "MX-TLA", "State"), + new State("Veracruz", "MX-VER", "State"), + new State("Yucatán", "MX-YUC", "State"), + new State("Zacatecas", "MX-ZAC", "State") + }; +} + diff --git a/src/World.Net/Countries/Micronesia.cs b/src/World.Net/Countries/Micronesia.cs new file mode 100644 index 0000000..3a5682a --- /dev/null +++ b/src/World.Net/Countries/Micronesia.cs @@ -0,0 +1,31 @@ +namespace World.Net.Countries; + +internal sealed class Micronesia : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Micronesia; + + public string Name { get; } = "Micronesia"; + + public string OfficialName { get; } = "Federated States of Micronesia"; + + public string NativeName => "Federated States of Micronesia"; + + public string Capital { get; } = "Palikir"; + + public int NumericCode { get; } = 583; + + public string ISO2Code { get; } = "FM"; + + public string ISO3Code { get; } = "FSM"; + + public string[] CallingCode { get; } = ["+691"]; + + public IEnumerable States => new[] + { + new State("Chuuk", "FM-TRK", "State"), + new State("Kosrae", "FM-KSA", "State"), + new State("Pohnpei", "FM-PNI", "State"), + new State("Yap", "FM-YAP", "State") + }; +} + diff --git a/src/World.Net/Countries/Moldova.cs b/src/World.Net/Countries/Moldova.cs new file mode 100644 index 0000000..c469632 --- /dev/null +++ b/src/World.Net/Countries/Moldova.cs @@ -0,0 +1,62 @@ +namespace World.Net.Countries; + +internal sealed class Moldova : ICountry +{ + public CountryIdentifier Id => CountryIdentifier.Moldova; + + public string Name { get; } = "Moldova"; + + public string OfficialName { get; } = "Republic of Moldova"; + + public string NativeName => "Republica Moldova"; + + public string Capital { get; } = "Chișinău"; + + public int NumericCode { get; } = 498; + + public string ISO2Code { get; } = "MD"; + + public string ISO3Code { get; } = "MDA"; + + public string[] CallingCode { get; } = ["+373"]; + + public IEnumerable States => new[] + { + new State("Bălți", "MD-BA", "City"), + new State("Bender", "MD-BD", "City"), + new State("Chișinău", "MD-CU", "City"), + new State("Anenii Noi", "MD-AN", "District"), + new State("Basarabeasca", "MD-BS", "District"), + new State("Briceni", "MD-BR", "District"), + new State("Cahul", "MD-CA", "District"), + new State("Cantemir", "MD-CT", "District"), + new State("Călărași", "MD-CL", "District"), + new State("Cimișlia", "MD-CM", "District"), + new State("Criuleni", "MD-CR", "District"), + new State("Dondușeni", "MD-DO", "District"), + new State("Drochia", "MD-DR", "District"), + new State("Dubăsari", "MD-DU", "District"), + new State("Edineț", "MD-ED", "District"), + new State("Fălești", "MD-FA", "District"), + new State("Florești", "MD-FL", "District"), + new State("Glodeni", "MD-GL", "District"), + new State("Hîncești", "MD-HI", "District"), + new State("Ialoveni", "MD-IA", "District"), + new State("Leova", "MD-LE", "District"), + new State("Nisporeni", "MD-NI", "District"), + new State("Ocnița", "MD-OC", "District"), + new State("Orhei", "MD-OR", "District"), + new State("Rezina", "MD-RE", "District"), + new State("Rîșcani", "MD-RI", "District"), + new State("Sîngerei", "MD-SI", "District"), + new State("Soroca", "MD-SO", "District"), + new State("Strășeni", "MD-ST", "District"), + new State("Șoldănești", "MD-SD", "District"), + new State("Ștefan Vodă", "MD-SV", "District"), + new State("Taraclia", "MD-TA", "District"), + new State("Telenești", "MD-TE", "District"), + new State("Ungheni", "MD-UN", "District"), + new State("Gagauzia", "MD-GA", "Autonomous Region") + }; +} + diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index a5d11fe..7887310 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -112,6 +112,7 @@ public static Dictionary Initialize() { CountryIdentifier.Iran, new Iran() }, { CountryIdentifier.Iraq, new Iraq() }, { CountryIdentifier.Ireland, new Ireland() }, + { CountryIdentifier.IsleOfMan, new IsleOfMan() }, { CountryIdentifier.Israel, new Israel() }, { CountryIdentifier.Italy, new Italy() }, { CountryIdentifier.Jamaica, new Jamaica() }, @@ -135,6 +136,19 @@ public static Dictionary Initialize() { CountryIdentifier.Luxembourg, new Luxembourg() }, { CountryIdentifier.MacauSAR, new MacauSAR() }, { CountryIdentifier.Madagascar, new Madagascar() }, + { CountryIdentifier.Malawi, new Malawi() }, + { CountryIdentifier.Malaysia, new Malaysia() }, + { CountryIdentifier.Maldives, new Maldives() }, + { CountryIdentifier.Mali, new Mali() }, + { CountryIdentifier.Malta, new Malta() }, + { CountryIdentifier.MarshallIslands, new MarshallIslands() }, + { CountryIdentifier.Martinique, new Martinique() }, + { CountryIdentifier.Mauritania, new Mauritania() }, + { CountryIdentifier.Mauritius, new Mauritius() }, + { CountryIdentifier.Mayotte, new Mayotte() }, + { CountryIdentifier.Mexico, new Mexico() }, + { CountryIdentifier.Micronesia, new Micronesia() }, + { CountryIdentifier.Moldova, new Moldova() }, { CountryIdentifier.Monaco, new Monaco() }, { CountryIdentifier.Mongolia, new Mongolia() }, { CountryIdentifier.Montenegro, new Montenegro() },