From f56168c0d92aecf83355047c2e17a9b794b6178a Mon Sep 17 00:00:00 2001 From: IDAM Date: Fri, 19 Dec 2025 09:30:22 +0100 Subject: [PATCH] added details for more countries --- .../Countries/SintMaartenTest.cs | 39 +++++++++++ .../Countries/SlovakiaTest.cs | 49 ++++++++++++++ .../Countries/SloveniaTest.cs | 40 ++++++++++++ .../Countries/SolomonIslandsTest.cs | 51 +++++++++++++++ .../Countries/SomaliaTest.cs | 59 +++++++++++++++++ .../Countries/SouthAfricaTest.cs | 50 +++++++++++++++ ...thGeorgiaAndTheSouthSandwichIslandsTest.cs | 39 +++++++++++ .../Countries/SouthKoreaTest.cs | 58 +++++++++++++++++ .../Countries/SouthSudanTest.cs | 56 ++++++++++++++++ .../Countries/SpainTest.cs | 57 +++++++++++++++++ .../Countries/SriLankaTest.cs | 55 ++++++++++++++++ .../Countries/SudanTest.cs | 56 ++++++++++++++++ .../Countries/SurinameTest.cs | 48 ++++++++++++++ .../Countries/SvalbardAndJanMayenTest.cs | 36 +++++++++++ .../Countries/SwedenTest.cs | 59 +++++++++++++++++ .../Countries/SwitzerlandTest.cs | 64 +++++++++++++++++++ .../Countries/SyriaTest.cs | 52 +++++++++++++++ src/World.Net/Countries/SintMaarten.cs | 34 ++++++++++ src/World.Net/Countries/Slovakia.cs | 45 +++++++++++++ src/World.Net/Countries/Slovenia.cs | 34 ++++++++++ src/World.Net/Countries/SolomonIslands.cs | 47 ++++++++++++++ src/World.Net/Countries/Somalia.cs | 55 ++++++++++++++++ src/World.Net/Countries/SouthAfrica.cs | 45 +++++++++++++ .../SouthGeorgiaAndTheSouthSandwichIslands.cs | 34 ++++++++++ src/World.Net/Countries/SouthKorea.cs | 55 ++++++++++++++++ src/World.Net/Countries/SouthSudan.cs | 47 ++++++++++++++ src/World.Net/Countries/Spain.cs | 57 +++++++++++++++++ src/World.Net/Countries/SriLanka.cs | 45 +++++++++++++ src/World.Net/Countries/Sudan.cs | 55 ++++++++++++++++ src/World.Net/Countries/Suriname.cs | 46 +++++++++++++ .../Countries/SvalbardAndJanMayen.cs | 35 ++++++++++ src/World.Net/Countries/Sweden.cs | 58 +++++++++++++++++ src/World.Net/Countries/Switzerland.cs | 62 ++++++++++++++++++ src/World.Net/Countries/Syria.cs | 51 +++++++++++++++ src/World.Net/Helpers/CountryInitializer.cs | 17 +++++ 35 files changed, 1690 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/SintMaartenTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SlovakiaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SloveniaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SolomonIslandsTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SomaliaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SouthAfricaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SouthGeorgiaAndTheSouthSandwichIslandsTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SouthKoreaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SouthSudanTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SpainTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SriLankaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SudanTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SurinameTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SvalbardAndJanMayenTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SwedenTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SwitzerlandTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SyriaTest.cs create mode 100644 src/World.Net/Countries/SintMaarten.cs create mode 100644 src/World.Net/Countries/Slovakia.cs create mode 100644 src/World.Net/Countries/Slovenia.cs create mode 100644 src/World.Net/Countries/SolomonIslands.cs create mode 100644 src/World.Net/Countries/Somalia.cs create mode 100644 src/World.Net/Countries/SouthAfrica.cs create mode 100644 src/World.Net/Countries/SouthGeorgiaAndTheSouthSandwichIslands.cs create mode 100644 src/World.Net/Countries/SouthKorea.cs create mode 100644 src/World.Net/Countries/SouthSudan.cs create mode 100644 src/World.Net/Countries/Spain.cs create mode 100644 src/World.Net/Countries/SriLanka.cs create mode 100644 src/World.Net/Countries/Sudan.cs create mode 100644 src/World.Net/Countries/Suriname.cs create mode 100644 src/World.Net/Countries/SvalbardAndJanMayen.cs create mode 100644 src/World.Net/Countries/Sweden.cs create mode 100644 src/World.Net/Countries/Switzerland.cs create mode 100644 src/World.Net/Countries/Syria.cs diff --git a/src/World.Net.UnitTests/Countries/SintMaartenTest.cs b/src/World.Net.UnitTests/Countries/SintMaartenTest.cs new file mode 100644 index 0000000..f1001ea --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SintMaartenTest.cs @@ -0,0 +1,39 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SintMaartenTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Sint Maarten (Dutch part)"; + private const string NATIVE_NAME = "Sint Maarten"; + private const string CAPITAL = "Philipsburg"; + private const string OFFICIAL_NAME = "Sint Maarten"; + private const string ISO2_CODE = "SX"; + private const string ISO3_CODE = "SXM"; + private const int NUMERIC_CODE = 534; + private readonly string[] CALLING_CODE = ["+1-721"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SintMaartenDutchPart; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSintMaarten() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SlovakiaTest.cs b/src/World.Net.UnitTests/Countries/SlovakiaTest.cs new file mode 100644 index 0000000..e83e550 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SlovakiaTest.cs @@ -0,0 +1,49 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SlovakiaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Slovakia"; + private const string NATIVE_NAME = "Slovensko"; + private const string CAPITAL = "Bratislava"; + private const string OFFICIAL_NAME = "Slovak Republic"; + private const string ISO2_CODE = "SK"; + private const string ISO3_CODE = "SVK"; + private const int NUMERIC_CODE = 703; + private readonly string[] CALLING_CODE = ["+421"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Slovakia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Bratislava Region", "SK-BL", "Region"), + ("Trnava Region", "SK-TA", "Region"), + ("Trenčín Region", "SK-TC", "Region"), + ("Nitra Region", "SK-NI", "Region"), + ("Žilina Region", "SK-ZI", "Region"), + ("Banská Bystrica Region", "SK-BC", "Region"), + ("Prešov Region", "SK-PV", "Region"), + ("Košice Region", "SK-KI", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSlovakia() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SloveniaTest.cs b/src/World.Net.UnitTests/Countries/SloveniaTest.cs new file mode 100644 index 0000000..e05e408 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SloveniaTest.cs @@ -0,0 +1,40 @@ + +namespace World.Net.UnitTests.Countries; + +public sealed class SloveniaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Slovenia"; + private const string NATIVE_NAME = "Slovenija"; + private const string CAPITAL = "Ljubljana"; + private const string OFFICIAL_NAME = "Republic of Slovenia"; + private const string ISO2_CODE = "SI"; + private const string ISO3_CODE = "SVN"; + private const int NUMERIC_CODE = 705; + private readonly string[] CALLING_CODE = ["+386"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Slovenia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSlovenia() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SolomonIslandsTest.cs b/src/World.Net.UnitTests/Countries/SolomonIslandsTest.cs new file mode 100644 index 0000000..a78ee9d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SolomonIslandsTest.cs @@ -0,0 +1,51 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SolomonIslandsTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Solomon Islands"; + private const string NATIVE_NAME = "Solomon Islands"; + private const string CAPITAL = "Honiara"; + private const string OFFICIAL_NAME = "Solomon Islands"; + private const string ISO2_CODE = "SB"; + private const string ISO3_CODE = "SLB"; + private const int NUMERIC_CODE = 90; + private readonly string[] CALLING_CODE = ["+677"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SolomonIslands; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Central Province", "SB-CE", "Province"), + ("Choiseul Province", "SB-CH", "Province"), + ("Guadalcanal Province", "SB-GU", "Province"), + ("Isabel Province", "SB-IS", "Province"), + ("Makira-Ulawa Province", "SB-MK", "Province"), + ("Malaita Province", "SB-ML", "Province"), + ("Rennell and Bellona Province", "SB-RB", "Province"), + ("Temotu Province", "SB-TE", "Province"), + ("Western Province", "SB-WE", "Province"), + ("Capital Territory (Honiara)", "SB-CT", "Capital Territory") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSolomonIslands() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SomaliaTest.cs b/src/World.Net.UnitTests/Countries/SomaliaTest.cs new file mode 100644 index 0000000..8e51555 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SomaliaTest.cs @@ -0,0 +1,59 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SomaliaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Somalia"; + private const string NATIVE_NAME = "Soomaaliya"; + private const string CAPITAL = "Mogadishu"; + private const string OFFICIAL_NAME = "Federal Republic of Somalia"; + private const string ISO2_CODE = "SO"; + private const string ISO3_CODE = "SOM"; + private const int NUMERIC_CODE = 706; + private readonly string[] CALLING_CODE = ["+252"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Somalia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Awdal", "SO-AW", "Region"), + ("Bakool", "SO-BK", "Region"), + ("Banaadir", "SO-BN", "Region"), + ("Bari", "SO-BR", "Region"), + ("Bay", "SO-BY", "Region"), + ("Galguduud", "SO-GA", "Region"), + ("Gedo", "SO-GE", "Region"), + ("Hiran", "SO-HI", "Region"), + ("Lower Juba", "SO-JH", "Region"), + ("Middle Juba", "SO-JD", "Region"), + ("Mudug", "SO-MU", "Region"), + ("Nugal", "SO-NU", "Region"), + ("Sanaag", "SO-SA", "Region"), + ("Middle Shabelle", "SO-SD", "Region"), + ("Lower Shabelle", "SO-SH", "Region"), + ("Sool", "SO-SO", "Region"), + ("Togdheer", "SO-TO", "Region"), + ("Woqooyi Galbeed", "SO-WO", "Region") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSomalia() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SouthAfricaTest.cs b/src/World.Net.UnitTests/Countries/SouthAfricaTest.cs new file mode 100644 index 0000000..869db2f --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SouthAfricaTest.cs @@ -0,0 +1,50 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SouthAfricaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "South Africa"; + private const string NATIVE_NAME = "South Africa"; + private const string CAPITAL = "Pretoria"; + private const string OFFICIAL_NAME = "Republic of South Africa"; + private const string ISO2_CODE = "ZA"; + private const string ISO3_CODE = "ZAF"; + private const int NUMERIC_CODE = 710; + private readonly string[] CALLING_CODE = ["+27"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SouthAfrica; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Eastern Cape", "ZA-EC", "Province"), + ("Free State", "ZA-FS", "Province"), + ("Gauteng", "ZA-GT", "Province"), + ("KwaZulu-Natal", "ZA-KZN", "Province"), + ("Limpopo", "ZA-LP", "Province"), + ("Mpumalanga", "ZA-MP", "Province"), + ("North West", "ZA-NW", "Province"), + ("Northern Cape", "ZA-NC", "Province"), + ("Western Cape", "ZA-WC", "Province") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSouthAfrica() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SouthGeorgiaAndTheSouthSandwichIslandsTest.cs b/src/World.Net.UnitTests/Countries/SouthGeorgiaAndTheSouthSandwichIslandsTest.cs new file mode 100644 index 0000000..487938d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SouthGeorgiaAndTheSouthSandwichIslandsTest.cs @@ -0,0 +1,39 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SouthGeorgiaAndTheSouthSandwichIslandsTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "South Georgia and the South Sandwich Islands"; + private const string NATIVE_NAME = "South Georgia and the South Sandwich Islands"; + private const string CAPITAL = "King Edward Point"; + private const string OFFICIAL_NAME = "South Georgia and the South Sandwich Islands"; + private const string ISO2_CODE = "GS"; + private const string ISO3_CODE = "SGS"; + private const int NUMERIC_CODE = 239; + private readonly string[] CALLING_CODE = []; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SouthGeorgia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSouthGeorgiaAndTheSouthSandwichIslands() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SouthKoreaTest.cs b/src/World.Net.UnitTests/Countries/SouthKoreaTest.cs new file mode 100644 index 0000000..b0ad6ee --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SouthKoreaTest.cs @@ -0,0 +1,58 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SouthKoreaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "South Korea"; + private const string NATIVE_NAME = "대한민국"; + private const string CAPITAL = "Seoul"; + private const string OFFICIAL_NAME = "Republic of Korea"; + private const string ISO2_CODE = "KR"; + private const string ISO3_CODE = "KOR"; + private const int NUMERIC_CODE = 410; + private readonly string[] CALLING_CODE = ["+82"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SouthKorea; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Seoul", "KR-11", "Special City"), + ("Busan", "KR-26", "Metropolitan City"), + ("Daegu", "KR-27", "Metropolitan City"), + ("Incheon", "KR-28", "Metropolitan City"), + ("Gwangju", "KR-29", "Metropolitan City"), + ("Daejeon", "KR-30", "Metropolitan City"), + ("Ulsan", "KR-31", "Metropolitan City"), + ("Sejong", "KR-50", "Special Self-Governing City"), + ("Gyeonggi", "KR-41", "Province"), + ("Gangwon", "KR-42", "Province"), + ("North Chungcheong", "KR-43", "Province"), + ("South Chungcheong", "KR-44", "Province"), + ("North Jeolla", "KR-45", "Province"), + ("South Jeolla", "KR-46", "Province"), + ("North Gyeongsang", "KR-47", "Province"), + ("South Gyeongsang", "KR-48", "Province"), + ("Jeju", "KR-49", "Special Self-Governing Province") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSouthKorea() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + 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/SouthSudanTest.cs b/src/World.Net.UnitTests/Countries/SouthSudanTest.cs new file mode 100644 index 0000000..b7878e0 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SouthSudanTest.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SouthSudanTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "South Sudan"; + private const string NATIVE_NAME = "South Sudan"; + private const string CAPITAL = "Juba"; + private const string OFFICIAL_NAME = "Republic of South Sudan"; + private const string ISO2_CODE = "SS"; + private const string ISO3_CODE = "SSD"; + private const int NUMERIC_CODE = 728; + private readonly string[] CALLING_CODE = ["+211"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SouthSudan; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Central Equatoria", "SS-EC", "State"), + ("Eastern Equatoria", "SS-EE", "State"), + ("Jonglei", "SS-JG", "State"), + ("Lakes", "SS-LK", "State"), + ("Northern Bahr el Ghazal", "SS-BN", "State"), + ("Unity", "SS-UY", "State"), + ("Upper Nile", "SS-NU", "State"), + ("Warrap", "SS-WR", "State"), + ("Western Bahr el Ghazal", "SS-BW", "State"), + ("Western Equatoria", "SS-EW", "State") + }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSouthSudan() + { + 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/SpainTest.cs b/src/World.Net.UnitTests/Countries/SpainTest.cs new file mode 100644 index 0000000..3e09fc1 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SpainTest.cs @@ -0,0 +1,57 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SpainTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Spain"; + private const string NATIVE_NAME = "España"; + private const string CAPITAL = "Madrid"; + private const string OFFICIAL_NAME = "Kingdom of Spain"; + private const string ISO2_CODE = "ES"; + private const string ISO3_CODE = "ESP"; + private const int NUMERIC_CODE = 724; + private readonly string[] CALLING_CODE = ["+34"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Spain; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Andalusia", "ES-AN", "Autonomous Community"), + ("Aragon", "ES-AR", "Autonomous Community"), + ("Asturias", "ES-AS", "Autonomous Community"), + ("Balearic Islands", "ES-IB", "Autonomous Community"), + ("Basque Country", "ES-PV", "Autonomous Community"), + ("Canary Islands", "ES-CN", "Autonomous Community"), + ("Cantabria", "ES-CB", "Autonomous Community"), + ("Castile and León", "ES-CL", "Autonomous Community"), + ("Castile-La Mancha", "ES-CM", "Autonomous Community"), + ("Catalonia", "ES-CT", "Autonomous Community"), + ("Extremadura", "ES-EX", "Autonomous Community"), + ("Galicia", "ES-GA", "Autonomous Community"), + ("La Rioja", "ES-RI", "Autonomous Community"), + ("Community of Madrid", "ES-MD", "Autonomous Community"), + ("Region of Murcia", "ES-MC", "Autonomous Community"), + ("Navarre", "ES-NC", "Autonomous Community"), + ("Valencian Community", "ES-VC", "Autonomous Community"), + ("Ceuta", "ES-CE", "Autonomous City"), + ("Melilla", "ES-ML", "Autonomous City") + }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSpain() + { + 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/SriLankaTest.cs b/src/World.Net.UnitTests/Countries/SriLankaTest.cs new file mode 100644 index 0000000..d02d38c --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SriLankaTest.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SriLankaTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Sri Lanka"; + private const string NATIVE_NAME = "ශ්‍රී ලංකාව"; + private const string CAPITAL = "Sri Jayawardenepura Kotte"; + private const string OFFICIAL_NAME = "Democratic Socialist Republic of Sri Lanka"; + private const string ISO2_CODE = "LK"; + private const string ISO3_CODE = "LKA"; + private const int NUMERIC_CODE = 144; + private readonly string[] CALLING_CODE = ["+94"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SriLanka; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Central", "LK-CE", "Province"), + ("Eastern", "LK-EP", "Province"), + ("North Central", "LK-NC", "Province"), + ("Northern", "LK-NU", "Province"), + ("North Western", "LK-NW", "Province"), + ("Sabaragamuwa", "LK-SG", "Province"), + ("Southern", "LK-SO", "Province"), + ("Uva", "LK-UVA", "Province"), + ("Western", "LK-WP", "Province") + }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSriLanka() + { + 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/SudanTest.cs b/src/World.Net.UnitTests/Countries/SudanTest.cs new file mode 100644 index 0000000..9e13f82 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SudanTest.cs @@ -0,0 +1,56 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SudanTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Sudan"; + private const string NATIVE_NAME = "السودان"; + private const string CAPITAL = "Khartoum"; + private const string OFFICIAL_NAME = "Republic of the Sudan"; + private const string ISO2_CODE = "SD"; + private const string ISO3_CODE = "SDN"; + private const int NUMERIC_CODE = 729; + private readonly string[] CALLING_CODE = ["+249"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Sudan; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Khartoum", "SD-KH", "State"), + ("North Kordofan", "SD-NK", "State"), + ("South Kordofan", "SD-SK", "State"), + ("White Nile", "SD-WN", "State"), + ("Blue Nile", "SD-BN", "State"), + ("North Darfur", "SD-ND", "State"), + ("South Darfur", "SD-SD", "State"), + ("West Darfur", "SD-WR", "State"), + ("East Darfur", "SD-ED", "State"), + ("Central Darfur", "SD-CD", "State"), + ("Northern", "SD-NO", "State"), + ("Red Sea", "SD-RS", "State"), + ("River Nile", "SD-RN", "State"), + ("Al Jazirah", "SD-GZ", "State"), + ("Sennar", "SD-SI", "State"), + ("Gezira", "SD-GZ", "State"), + ("Kassala", "SD-KA", "State"), + ("Al Qadarif", "SD-GQ", "State") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSudan() + { + 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/SurinameTest.cs b/src/World.Net.UnitTests/Countries/SurinameTest.cs new file mode 100644 index 0000000..1bfcfe2 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SurinameTest.cs @@ -0,0 +1,48 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SurinameTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Suriname"; + private const string NATIVE_NAME = "Republiek Suriname"; + private const string CAPITAL = "Paramaribo"; + private const string OFFICIAL_NAME = "Republic of Suriname"; + private const string ISO2_CODE = "SR"; + private const string ISO3_CODE = "SUR"; + private const int NUMERIC_CODE = 740; + private readonly string[] CALLING_CODE = ["+597"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Suriname; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Brokopondo", "SR-BR", "District"), + ("Commewijne", "SR-CM", "District"), + ("Coronie", "SR-CR", "District"), + ("Marowijne", "SR-MA", "District"), + ("Nickerie", "SR-NI", "District"), + ("Para", "SR-PR", "District"), + ("Paramaribo", "SR-PM", "District"), + ("Saramacca", "SR-SA", "District"), + ("Sipaliwini", "SR-SI", "District"), + ("Wanica", "SR-WA", "District") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSuriname() + { + 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/SvalbardAndJanMayenTest.cs b/src/World.Net.UnitTests/Countries/SvalbardAndJanMayenTest.cs new file mode 100644 index 0000000..a2b3cee --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SvalbardAndJanMayenTest.cs @@ -0,0 +1,36 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SvalbardAndJanMayenTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Svalbard and Jan Mayen"; + private const string NATIVE_NAME = "Svalbard og Jan Mayen"; + private const string CAPITAL = "Longyearbyen"; + private const string OFFICIAL_NAME = "Svalbard and Jan Mayen"; + private const string ISO2_CODE = "SJ"; + private const string ISO3_CODE = "SJM"; + private const int NUMERIC_CODE = 744; + private readonly string[] CALLING_CODE = ["+47"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SvalbardAndJanMayenIslands; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSvalbardAndJanMayen() + { + 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/SwedenTest.cs b/src/World.Net.UnitTests/Countries/SwedenTest.cs new file mode 100644 index 0000000..33ffef3 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SwedenTest.cs @@ -0,0 +1,59 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SwedenTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Sweden"; + private const string NATIVE_NAME = "Sverige"; + private const string CAPITAL = "Stockholm"; + private const string OFFICIAL_NAME = "Kingdom of Sweden"; + private const string ISO2_CODE = "SE"; + private const string ISO3_CODE = "SWE"; + private const int NUMERIC_CODE = 752; + private readonly string[] CALLING_CODE = ["+46"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Sweden; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Blekinge", "SE-K", "County"), + ("Dalarna", "SE-W", "County"), + ("Gävleborg", "SE-X", "County"), + ("Gotland", "SE-I", "County"), + ("Halland", "SE-N", "County"), + ("Jämtland", "SE-Z", "County"), + ("Jönköping", "SE-F", "County"), + ("Kalmar", "SE-H", "County"), + ("Kronoberg", "SE-G", "County"), + ("Norrbotten", "SE-B", "County"), + ("Örebro", "SE-T", "County"), + ("Östergötland", "SE-E", "County"), + ("Skåne", "SE-M", "County"), + ("Södermanland", "SE-D", "County"), + ("Uppsala", "SE-C", "County"), + ("Värmland", "SE-S", "County"), + ("Västerbotten", "SE-AC", "County"), + ("Västernorrland", "SE-Y", "County"), + ("Västmanland", "SE-U", "County"), + ("Västra Götaland", "SE-O", "County"), + ("Öland", "SE-ZX", "County") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSweden() + { + 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/SwitzerlandTest.cs b/src/World.Net.UnitTests/Countries/SwitzerlandTest.cs new file mode 100644 index 0000000..2af620f --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SwitzerlandTest.cs @@ -0,0 +1,64 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SwitzerlandTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Switzerland"; + private const string NATIVE_NAME = "Schweiz / Suisse / Svizzera / Svizra"; + private const string CAPITAL = "Bern"; + private const string OFFICIAL_NAME = "Swiss Confederation"; + private const string ISO2_CODE = "CH"; + private const string ISO3_CODE = "CHE"; + private const int NUMERIC_CODE = 756; + private readonly string[] CALLING_CODE = ["+41"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Switzerland; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Aargau", "CH-AG", "Canton"), + ("Appenzell Ausserrhoden", "CH-AR", "Canton"), + ("Appenzell Innerrhoden", "CH-AI", "Canton"), + ("Basel-Landschaft", "CH-BL", "Canton"), + ("Basel-Stadt", "CH-BS", "Canton"), + ("Bern", "CH-BE", "Canton"), + ("Fribourg", "CH-FR", "Canton"), + ("Geneva", "CH-GE", "Canton"), + ("Glarus", "CH-GL", "Canton"), + ("Graubünden", "CH-GR", "Canton"), + ("Jura", "CH-JU", "Canton"), + ("Lucerne", "CH-LU", "Canton"), + ("Neuchâtel", "CH-NE", "Canton"), + ("Nidwalden", "CH-NW", "Canton"), + ("Obwalden", "CH-OW", "Canton"), + ("St. Gallen", "CH-SG", "Canton"), + ("Schaffhausen", "CH-SH", "Canton"), + ("Solothurn", "CH-SO", "Canton"), + ("Schwyz", "CH-SZ", "Canton"), + ("Thurgau", "CH-TG", "Canton"), + ("Ticino", "CH-TI", "Canton"), + ("Uri", "CH-UR", "Canton"), + ("Valais", "CH-VS", "Canton"), + ("Vaud", "CH-VD", "Canton"), + ("Zug", "CH-ZG", "Canton"), + ("Zurich", "CH-ZH", "Canton") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSwitzerland() + { + 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/SyriaTest.cs b/src/World.Net.UnitTests/Countries/SyriaTest.cs new file mode 100644 index 0000000..0140c0c --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SyriaTest.cs @@ -0,0 +1,52 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SyriaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Syria"; + private const string NATIVE_NAME = "الجمهورية العربية السورية"; + private const string CAPITAL = "Damascus"; + private const string OFFICIAL_NAME = "Syrian Arab Republic"; + private const string ISO2_CODE = "SY"; + private const string ISO3_CODE = "SYR"; + private const int NUMERIC_CODE = 760; + private readonly string[] CALLING_CODE = ["+963"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Syria; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + { + ("Al-Hasakah", "SY-HA", "Governorate"), + ("Al-Ladhiqiyah", "SY-LA", "Governorate"), + ("Al-Qunaytirah", "SY-QU", "Governorate"), + ("Ar-Raqqah", "SY-RQ", "Governorate"), + ("As-Suwayda", "SY-SU", "Governorate"), + ("Dar‘a", "SY-DR", "Governorate"), + ("Dayr az-Zawr", "SY-DY", "Governorate"), + ("Rif Dimashq", "SY-DI", "Governorate"), + ("Dimashq", "SY-DI", "Governorate"), + ("Hamah", "SY-HM", "Governorate"), + ("Hims", "SY-HI", "Governorate"), + ("Idlib", "SY-ID", "Governorate"), + ("Tartus", "SY-TA", "Governorate"), + ("Raqqa", "SY-RQ", "Governorate") +}; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSyria() + { + 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/SintMaarten.cs b/src/World.Net/Countries/SintMaarten.cs new file mode 100644 index 0000000..6fce776 --- /dev/null +++ b/src/World.Net/Countries/SintMaarten.cs @@ -0,0 +1,34 @@ +namespace World.Net.Countries; + +internal sealed class SintMaarten : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SintMaartenDutchPart; + + // + public string Name { get; } = "Sint Maarten (Dutch part)"; + + // + public string OfficialName { get; } = "Sint Maarten"; + + // + public string NativeName => "Sint Maarten"; + + // + public string Capital { get; } = "Philipsburg"; + + // + public int NumericCode { get; } = 534; + + // + public string ISO2Code { get; } = "SX"; + + // + public string ISO3Code { get; } = "SXM"; + + // + public string[] CallingCode { get; } = ["+1-721"]; + + // + public IEnumerable States => []; +} diff --git a/src/World.Net/Countries/Slovakia.cs b/src/World.Net/Countries/Slovakia.cs new file mode 100644 index 0000000..f43d7d8 --- /dev/null +++ b/src/World.Net/Countries/Slovakia.cs @@ -0,0 +1,45 @@ +namespace World.Net.Countries; + +internal sealed class Slovakia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Slovakia; + + // + public string Name { get; } = "Slovakia"; + + // + public string OfficialName { get; } = "Slovak Republic"; + + // + public string NativeName => "Slovensko"; + + // + public string Capital { get; } = "Bratislava"; + + // + public int NumericCode { get; } = 703; + + // + public string ISO2Code { get; } = "SK"; + + // + public string ISO3Code { get; } = "SVK"; + + // + public string[] CallingCode { get; } = ["+421"]; + + // + public IEnumerable States => new[] + { + new State("Bratislava Region", "SK-BL", "Region"), + new State("Trnava Region", "SK-TA", "Region"), + new State("Trenčín Region", "SK-TC", "Region"), + new State("Nitra Region", "SK-NI", "Region"), + new State("Žilina Region", "SK-ZI", "Region"), + new State("Banská Bystrica Region", "SK-BC", "Region"), + new State("Prešov Region", "SK-PV", "Region"), + new State("Košice Region", "SK-KI", "Region") + }; +} + diff --git a/src/World.Net/Countries/Slovenia.cs b/src/World.Net/Countries/Slovenia.cs new file mode 100644 index 0000000..88730f9 --- /dev/null +++ b/src/World.Net/Countries/Slovenia.cs @@ -0,0 +1,34 @@ +namespace World.Net.Countries; + +internal sealed class Slovenia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Slovenia; + + // + public string Name { get; } = "Slovenia"; + + // + public string OfficialName { get; } = "Republic of Slovenia"; + + // + public string NativeName => "Slovenija"; + + // + public string Capital { get; } = "Ljubljana"; + + // + public int NumericCode { get; } = 705; + + // + public string ISO2Code { get; } = "SI"; + + // + public string ISO3Code { get; } = "SVN"; + + // + public string[] CallingCode { get; } = ["+386"]; + + // + public IEnumerable States => []; +} diff --git a/src/World.Net/Countries/SolomonIslands.cs b/src/World.Net/Countries/SolomonIslands.cs new file mode 100644 index 0000000..03393c0 --- /dev/null +++ b/src/World.Net/Countries/SolomonIslands.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries; + +internal sealed class SolomonIslands : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SolomonIslands; + + // + public string Name { get; } = "Solomon Islands"; + + // + public string OfficialName { get; } = "Solomon Islands"; + + // + public string NativeName => "Solomon Islands"; + + // + public string Capital { get; } = "Honiara"; + + // + public int NumericCode { get; } = 90; + + // + public string ISO2Code { get; } = "SB"; + + // + public string ISO3Code { get; } = "SLB"; + + // + public string[] CallingCode { get; } = ["+677"]; + + // + public IEnumerable States => new[] + { + new State("Central Province", "SB-CE", "Province"), + new State("Choiseul Province", "SB-CH", "Province"), + new State("Guadalcanal Province", "SB-GU", "Province"), + new State("Isabel Province", "SB-IS", "Province"), + new State("Makira-Ulawa Province", "SB-MK", "Province"), + new State("Malaita Province", "SB-ML", "Province"), + new State("Rennell and Bellona Province", "SB-RB", "Province"), + new State("Temotu Province", "SB-TE", "Province"), + new State("Western Province", "SB-WE", "Province"), + new State("Capital Territory (Honiara)", "SB-CT", "Capital Territory") + }; +} + diff --git a/src/World.Net/Countries/Somalia.cs b/src/World.Net/Countries/Somalia.cs new file mode 100644 index 0000000..8f28687 --- /dev/null +++ b/src/World.Net/Countries/Somalia.cs @@ -0,0 +1,55 @@ +namespace World.Net.Countries; + +internal sealed class Somalia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Somalia; + + // + public string Name { get; } = "Somalia"; + + // + public string OfficialName { get; } = "Federal Republic of Somalia"; + + // + public string NativeName => "Soomaaliya"; + + // + public string Capital { get; } = "Mogadishu"; + + // + public int NumericCode { get; } = 706; + + // + public string ISO2Code { get; } = "SO"; + + // + public string ISO3Code { get; } = "SOM"; + + // + public string[] CallingCode { get; } = ["+252"]; + + // + public IEnumerable States => new[] + { + new State("Awdal", "SO-AW", "Region"), + new State("Bakool", "SO-BK", "Region"), + new State("Banaadir", "SO-BN", "Region"), + new State("Bari", "SO-BR", "Region"), + new State("Bay", "SO-BY", "Region"), + new State("Galguduud", "SO-GA", "Region"), + new State("Gedo", "SO-GE", "Region"), + new State("Hiran", "SO-HI", "Region"), + new State("Lower Juba", "SO-JH", "Region"), + new State("Middle Juba", "SO-JD", "Region"), + new State("Mudug", "SO-MU", "Region"), + new State("Nugal", "SO-NU", "Region"), + new State("Sanaag", "SO-SA", "Region"), + new State("Middle Shabelle", "SO-SD", "Region"), + new State("Lower Shabelle", "SO-SH", "Region"), + new State("Sool", "SO-SO", "Region"), + new State("Togdheer", "SO-TO", "Region"), + new State("Woqooyi Galbeed", "SO-WO", "Region") + }; +} + diff --git a/src/World.Net/Countries/SouthAfrica.cs b/src/World.Net/Countries/SouthAfrica.cs new file mode 100644 index 0000000..84313a7 --- /dev/null +++ b/src/World.Net/Countries/SouthAfrica.cs @@ -0,0 +1,45 @@ +namespace World.Net.Countries; + +internal sealed class SouthAfrica : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SouthAfrica; + + // + public string Name { get; } = "South Africa"; + + // + public string OfficialName { get; } = "Republic of South Africa"; + + // + public string NativeName => "South Africa"; + + // + public string Capital { get; } = "Pretoria"; + + // + public int NumericCode { get; } = 710; + + // + public string ISO2Code { get; } = "ZA"; + + // + public string ISO3Code { get; } = "ZAF"; + + // + public string[] CallingCode { get; } = ["+27"]; + + // + public IEnumerable States => new[] + { + new State("Eastern Cape", "ZA-EC", "Province"), + new State("Free State", "ZA-FS", "Province"), + new State("Gauteng", "ZA-GT", "Province"), + new State("KwaZulu-Natal", "ZA-KZN", "Province"), + new State("Limpopo", "ZA-LP", "Province"), + new State("Mpumalanga", "ZA-MP", "Province"), + new State("North West", "ZA-NW", "Province"), + new State("Northern Cape", "ZA-NC", "Province"), + new State("Western Cape", "ZA-WC", "Province") + }; +} diff --git a/src/World.Net/Countries/SouthGeorgiaAndTheSouthSandwichIslands.cs b/src/World.Net/Countries/SouthGeorgiaAndTheSouthSandwichIslands.cs new file mode 100644 index 0000000..d3893d1 --- /dev/null +++ b/src/World.Net/Countries/SouthGeorgiaAndTheSouthSandwichIslands.cs @@ -0,0 +1,34 @@ +namespace World.Net.Countries; + +internal sealed class SouthGeorgiaAndTheSouthSandwichIslands : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SouthGeorgia; + + // + public string Name { get; } = "South Georgia and the South Sandwich Islands"; + + // + public string OfficialName { get; } = "South Georgia and the South Sandwich Islands"; + + // + public string NativeName => "South Georgia and the South Sandwich Islands"; + + // + public string Capital { get; } = "King Edward Point"; + + // + public int NumericCode { get; } = 239; + + // + public string ISO2Code { get; } = "GS"; + + // + public string ISO3Code { get; } = "SGS"; + + // + public string[] CallingCode { get; } = []; + + // + public IEnumerable States => []; +} diff --git a/src/World.Net/Countries/SouthKorea.cs b/src/World.Net/Countries/SouthKorea.cs new file mode 100644 index 0000000..48684be --- /dev/null +++ b/src/World.Net/Countries/SouthKorea.cs @@ -0,0 +1,55 @@ +namespace World.Net.Countries; + +internal sealed class SouthKorea : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SouthKorea; + + // + public string Name { get; } = "South Korea"; + + // + public string OfficialName { get; } = "Republic of Korea"; + + // + public string NativeName => "대한민국"; + + // + public string Capital { get; } = "Seoul"; + + // + public int NumericCode { get; } = 410; + + // + public string ISO2Code { get; } = "KR"; + + // + public string ISO3Code { get; } = "KOR"; + + // + public string[] CallingCode { get; } = ["+82"]; + + // + public IEnumerable States => new[] + { + new State("Seoul", "KR-11", "Special City"), + new State("Busan", "KR-26", "Metropolitan City"), + new State("Daegu", "KR-27", "Metropolitan City"), + new State("Incheon", "KR-28", "Metropolitan City"), + new State("Gwangju", "KR-29", "Metropolitan City"), + new State("Daejeon", "KR-30", "Metropolitan City"), + new State("Ulsan", "KR-31", "Metropolitan City"), + new State("Sejong", "KR-50", "Special Self-Governing City"), + + new State("Gyeonggi", "KR-41", "Province"), + new State("Gangwon", "KR-42", "Province"), + new State("North Chungcheong", "KR-43", "Province"), + new State("South Chungcheong", "KR-44", "Province"), + new State("North Jeolla", "KR-45", "Province"), + new State("South Jeolla", "KR-46", "Province"), + new State("North Gyeongsang", "KR-47", "Province"), + new State("South Gyeongsang", "KR-48", "Province"), + new State("Jeju", "KR-49", "Special Self-Governing Province") + }; +} + diff --git a/src/World.Net/Countries/SouthSudan.cs b/src/World.Net/Countries/SouthSudan.cs new file mode 100644 index 0000000..d125811 --- /dev/null +++ b/src/World.Net/Countries/SouthSudan.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries; + +internal sealed class SouthSudan : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SouthSudan; + + // + public string Name { get; } = "South Sudan"; + + // + public string OfficialName { get; } = "Republic of South Sudan"; + + // + public string NativeName => "South Sudan"; + + // + public string Capital { get; } = "Juba"; + + // + public int NumericCode { get; } = 728; + + // + public string ISO2Code { get; } = "SS"; + + // + public string ISO3Code { get; } = "SSD"; + + // + public string[] CallingCode { get; } = ["+211"]; + + // + public IEnumerable States => new[] + { + new State("Central Equatoria", "SS-EC", "State"), + new State("Eastern Equatoria", "SS-EE", "State"), + new State("Jonglei", "SS-JG", "State"), + new State("Lakes", "SS-LK", "State"), + new State("Northern Bahr el Ghazal", "SS-BN", "State"), + new State("Unity", "SS-UY", "State"), + new State("Upper Nile", "SS-NU", "State"), + new State("Warrap", "SS-WR", "State"), + new State("Western Bahr el Ghazal", "SS-BW", "State"), + new State("Western Equatoria", "SS-EW", "State") + }; +} + diff --git a/src/World.Net/Countries/Spain.cs b/src/World.Net/Countries/Spain.cs new file mode 100644 index 0000000..286d85e --- /dev/null +++ b/src/World.Net/Countries/Spain.cs @@ -0,0 +1,57 @@ +namespace World.Net.Countries; + +internal sealed class Spain : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Spain; + + // + public string Name { get; } = "Spain"; + + // + public string OfficialName { get; } = "Kingdom of Spain"; + + // + public string NativeName => "España"; + + // + public string Capital { get; } = "Madrid"; + + // + public int NumericCode { get; } = 724; + + // + public string ISO2Code { get; } = "ES"; + + // + public string ISO3Code { get; } = "ESP"; + + // + public string[] CallingCode { get; } = ["+34"]; + + // + public IEnumerable States => new[] + { + new State("Andalusia", "ES-AN", "Autonomous Community"), + new State("Aragon", "ES-AR", "Autonomous Community"), + new State("Asturias", "ES-AS", "Autonomous Community"), + new State("Balearic Islands", "ES-IB", "Autonomous Community"), + new State("Basque Country", "ES-PV", "Autonomous Community"), + new State("Canary Islands", "ES-CN", "Autonomous Community"), + new State("Cantabria", "ES-CB", "Autonomous Community"), + new State("Castile and León", "ES-CL", "Autonomous Community"), + new State("Castile-La Mancha", "ES-CM", "Autonomous Community"), + new State("Catalonia", "ES-CT", "Autonomous Community"), + new State("Extremadura", "ES-EX", "Autonomous Community"), + new State("Galicia", "ES-GA", "Autonomous Community"), + new State("La Rioja", "ES-RI", "Autonomous Community"), + new State("Community of Madrid", "ES-MD", "Autonomous Community"), + new State("Region of Murcia", "ES-MC", "Autonomous Community"), + new State("Navarre", "ES-NC", "Autonomous Community"), + new State("Valencian Community", "ES-VC", "Autonomous Community"), + + new State("Ceuta", "ES-CE", "Autonomous City"), + new State("Melilla", "ES-ML", "Autonomous City") + }; +} + diff --git a/src/World.Net/Countries/SriLanka.cs b/src/World.Net/Countries/SriLanka.cs new file mode 100644 index 0000000..0466cc1 --- /dev/null +++ b/src/World.Net/Countries/SriLanka.cs @@ -0,0 +1,45 @@ +namespace World.Net.Countries; + +internal sealed class SriLanka : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SriLanka; + + // + public string Name { get; } = "Sri Lanka"; + + // + public string OfficialName { get; } = "Democratic Socialist Republic of Sri Lanka"; + + // + public string NativeName => "ශ්‍රී ලංකාව"; + + // + public string Capital { get; } = "Sri Jayawardenepura Kotte"; + + // + public int NumericCode { get; } = 144; + + // + public string ISO2Code { get; } = "LK"; + + // + public string ISO3Code { get; } = "LKA"; + + // + public string[] CallingCode { get; } = ["+94"]; + + // + public IEnumerable States => new[] + { + new State("Central", "LK-CE", "Province"), + new State("Eastern", "LK-EP", "Province"), + new State("North Central", "LK-NC", "Province"), + new State("Northern", "LK-NU", "Province"), + new State("North Western", "LK-NW", "Province"), + new State("Sabaragamuwa", "LK-SG", "Province"), + new State("Southern", "LK-SO", "Province"), + new State("Uva", "LK-UVA", "Province"), + new State("Western", "LK-WP", "Province") + }; +} diff --git a/src/World.Net/Countries/Sudan.cs b/src/World.Net/Countries/Sudan.cs new file mode 100644 index 0000000..0bf57de --- /dev/null +++ b/src/World.Net/Countries/Sudan.cs @@ -0,0 +1,55 @@ +namespace World.Net.Countries; + +internal sealed class Sudan : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Sudan; + + // + public string Name { get; } = "Sudan"; + + // + public string OfficialName { get; } = "Republic of the Sudan"; + + // + public string NativeName => "السودان"; + + // + public string Capital { get; } = "Khartoum"; + + // + public int NumericCode { get; } = 729; + + // + public string ISO2Code { get; } = "SD"; + + // + public string ISO3Code { get; } = "SDN"; + + // + public string[] CallingCode { get; } = ["+249"]; + + // + public IEnumerable States => new[] + { + new State("Khartoum", "SD-KH", "State"), + new State("North Kordofan", "SD-NK", "State"), + new State("South Kordofan", "SD-SK", "State"), + new State("White Nile", "SD-WN", "State"), + new State("Blue Nile", "SD-BN", "State"), + new State("North Darfur", "SD-ND", "State"), + new State("South Darfur", "SD-SD", "State"), + new State("West Darfur", "SD-WR", "State"), + new State("East Darfur", "SD-ED", "State"), + new State("Central Darfur", "SD-CD", "State"), + new State("Northern", "SD-NO", "State"), + new State("Red Sea", "SD-RS", "State"), + new State("River Nile", "SD-RN", "State"), + new State("Al Jazirah", "SD-GZ", "State"), + new State("Sennar", "SD-SI", "State"), + new State("Gezira", "SD-GZ", "State"), + new State("Kassala", "SD-KA", "State"), + new State("Al Qadarif", "SD-GQ", "State") + }; +} + diff --git a/src/World.Net/Countries/Suriname.cs b/src/World.Net/Countries/Suriname.cs new file mode 100644 index 0000000..93008b6 --- /dev/null +++ b/src/World.Net/Countries/Suriname.cs @@ -0,0 +1,46 @@ +namespace World.Net.Countries; + +internal sealed class Suriname : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Suriname; + + // + public string Name { get; } = "Suriname"; + + // + public string OfficialName { get; } = "Republic of Suriname"; + + // + public string NativeName => "Republiek Suriname"; + + // + public string Capital { get; } = "Paramaribo"; + + // + public int NumericCode { get; } = 740; + + // + public string ISO2Code { get; } = "SR"; + + // + public string ISO3Code { get; } = "SUR"; + + // + public string[] CallingCode { get; } = ["+597"]; + + // + public IEnumerable States => new[] + { + new State("Brokopondo", "SR-BR", "District"), + new State("Commewijne", "SR-CM", "District"), + new State("Coronie", "SR-CR", "District"), + new State("Marowijne", "SR-MA", "District"), + new State("Nickerie", "SR-NI", "District"), + new State("Para", "SR-PR", "District"), + new State("Paramaribo", "SR-PM", "District"), + new State("Saramacca", "SR-SA", "District"), + new State("Sipaliwini", "SR-SI", "District"), + new State("Wanica", "SR-WA", "District") + }; +} diff --git a/src/World.Net/Countries/SvalbardAndJanMayen.cs b/src/World.Net/Countries/SvalbardAndJanMayen.cs new file mode 100644 index 0000000..40af301 --- /dev/null +++ b/src/World.Net/Countries/SvalbardAndJanMayen.cs @@ -0,0 +1,35 @@ +namespace World.Net.Countries; + +internal sealed class SvalbardAndJanMayen : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SvalbardAndJanMayenIslands; + + // + public string Name { get; } = "Svalbard and Jan Mayen"; + + // + public string OfficialName { get; } = "Svalbard and Jan Mayen"; + + // + public string NativeName => "Svalbard og Jan Mayen"; + + // + public string Capital { get; } = "Longyearbyen"; + + // + public int NumericCode { get; } = 744; + + // + public string ISO2Code { get; } = "SJ"; + + // + public string ISO3Code { get; } = "SJM"; + + // + public string[] CallingCode { get; } = ["+47"]; + + // + public IEnumerable States => []; +} + diff --git a/src/World.Net/Countries/Sweden.cs b/src/World.Net/Countries/Sweden.cs new file mode 100644 index 0000000..149019a --- /dev/null +++ b/src/World.Net/Countries/Sweden.cs @@ -0,0 +1,58 @@ +namespace World.Net.Countries; + +internal sealed class Sweden : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Sweden; + + // + public string Name { get; } = "Sweden"; + + // + public string OfficialName { get; } = "Kingdom of Sweden"; + + // + public string NativeName => "Sverige"; + + // + public string Capital { get; } = "Stockholm"; + + // + public int NumericCode { get; } = 752; + + // + public string ISO2Code { get; } = "SE"; + + // + public string ISO3Code { get; } = "SWE"; + + // + public string[] CallingCode { get; } = ["+46"]; + + // + public IEnumerable States => new[] + { + new State("Blekinge", "SE-K", "County"), + new State("Dalarna", "SE-W", "County"), + new State("Gävleborg", "SE-X", "County"), + new State("Gotland", "SE-I", "County"), + new State("Halland", "SE-N", "County"), + new State("Jämtland", "SE-Z", "County"), + new State("Jönköping", "SE-F", "County"), + new State("Kalmar", "SE-H", "County"), + new State("Kronoberg", "SE-G", "County"), + new State("Norrbotten", "SE-B", "County"), + new State("Örebro", "SE-T", "County"), + new State("Östergötland", "SE-E", "County"), + new State("Skåne", "SE-M", "County"), + new State("Södermanland", "SE-D", "County"), + new State("Uppsala", "SE-C", "County"), + new State("Värmland", "SE-S", "County"), + new State("Västerbotten", "SE-AC", "County"), + new State("Västernorrland", "SE-Y", "County"), + new State("Västmanland", "SE-U", "County"), + new State("Västra Götaland", "SE-O", "County"), + new State("Öland", "SE-ZX", "County") // included for completeness, adjust if needed + }; +} + diff --git a/src/World.Net/Countries/Switzerland.cs b/src/World.Net/Countries/Switzerland.cs new file mode 100644 index 0000000..d2320c3 --- /dev/null +++ b/src/World.Net/Countries/Switzerland.cs @@ -0,0 +1,62 @@ +namespace World.Net.Countries; + +internal sealed class Switzerland : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Switzerland; + + // + public string Name { get; } = "Switzerland"; + + // + public string OfficialName { get; } = "Swiss Confederation"; + + // + public string NativeName => "Schweiz / Suisse / Svizzera / Svizra"; + + // + public string Capital { get; } = "Bern"; + + // + public int NumericCode { get; } = 756; + + // + public string ISO2Code { get; } = "CH"; + + // + public string ISO3Code { get; } = "CHE"; + + // + public string[] CallingCode { get; } = ["+41"]; + + // + public IEnumerable States => new[] + { + new State("Aargau", "CH-AG", "Canton"), + new State("Appenzell Ausserrhoden", "CH-AR", "Canton"), + new State("Appenzell Innerrhoden", "CH-AI", "Canton"), + new State("Basel-Landschaft", "CH-BL", "Canton"), + new State("Basel-Stadt", "CH-BS", "Canton"), + new State("Bern", "CH-BE", "Canton"), + new State("Fribourg", "CH-FR", "Canton"), + new State("Geneva", "CH-GE", "Canton"), + new State("Glarus", "CH-GL", "Canton"), + new State("Graubünden", "CH-GR", "Canton"), + new State("Jura", "CH-JU", "Canton"), + new State("Lucerne", "CH-LU", "Canton"), + new State("Neuchâtel", "CH-NE", "Canton"), + new State("Nidwalden", "CH-NW", "Canton"), + new State("Obwalden", "CH-OW", "Canton"), + new State("St. Gallen", "CH-SG", "Canton"), + new State("Schaffhausen", "CH-SH", "Canton"), + new State("Solothurn", "CH-SO", "Canton"), + new State("Schwyz", "CH-SZ", "Canton"), + new State("Thurgau", "CH-TG", "Canton"), + new State("Ticino", "CH-TI", "Canton"), + new State("Uri", "CH-UR", "Canton"), + new State("Valais", "CH-VS", "Canton"), + new State("Vaud", "CH-VD", "Canton"), + new State("Zug", "CH-ZG", "Canton"), + new State("Zurich", "CH-ZH", "Canton") + }; +} diff --git a/src/World.Net/Countries/Syria.cs b/src/World.Net/Countries/Syria.cs new file mode 100644 index 0000000..0d73e35 --- /dev/null +++ b/src/World.Net/Countries/Syria.cs @@ -0,0 +1,51 @@ +namespace World.Net.Countries; + +internal sealed class Syria : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Syria; + + // + public string Name { get; } = "Syria"; + + // + public string OfficialName { get; } = "Syrian Arab Republic"; + + // + public string NativeName => "الجمهورية العربية السورية"; + + // + public string Capital { get; } = "Damascus"; + + // + public int NumericCode { get; } = 760; + + // + public string ISO2Code { get; } = "SY"; + + // + public string ISO3Code { get; } = "SYR"; + + // + public string[] CallingCode { get; } = ["+963"]; + + // + public IEnumerable States => new[] + { + new State("Al-Hasakah", "SY-HA", "Governorate"), + new State("Al-Ladhiqiyah", "SY-LA", "Governorate"), + new State("Al-Qunaytirah", "SY-QU", "Governorate"), + new State("Ar-Raqqah", "SY-RQ", "Governorate"), + new State("As-Suwayda", "SY-SU", "Governorate"), + new State("Dar‘a", "SY-DR", "Governorate"), + new State("Dayr az-Zawr", "SY-DY", "Governorate"), + new State("Rif Dimashq", "SY-DI", "Governorate"), + new State("Dimashq", "SY-DI", "Governorate"), + new State("Hamah", "SY-HM", "Governorate"), + new State("Hims", "SY-HI", "Governorate"), + new State("Idlib", "SY-ID", "Governorate"), + new State("Tartus", "SY-TA", "Governorate"), + new State("Raqqa", "SY-RQ", "Governorate") + }; +} + diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 8211a11..756b390 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -176,6 +176,23 @@ public static Dictionary Initialize() { CountryIdentifier.Seychelles, new Seychelles() }, { CountryIdentifier.SierraLeone, new SierraLeone() }, { CountryIdentifier.Singapore, new Singapore() }, + { CountryIdentifier.SintMaartenDutchPart, new SintMaarten() }, + { CountryIdentifier.Slovakia, new Slovakia() }, + { CountryIdentifier.Slovenia, new Slovenia() }, + { CountryIdentifier.SolomonIslands, new SolomonIslands() }, + { CountryIdentifier.Somalia, new Somalia() }, + { CountryIdentifier.SouthAfrica, new SouthAfrica() }, + { CountryIdentifier.SouthGeorgia, new SouthGeorgiaAndTheSouthSandwichIslands() }, + { CountryIdentifier.SouthKorea, new SouthKorea() }, + { CountryIdentifier.SouthSudan, new SouthSudan() }, + { CountryIdentifier.Spain, new Spain() }, + { CountryIdentifier.SriLanka, new SriLanka() }, + { CountryIdentifier.Sudan, new Sudan() }, + { CountryIdentifier.Suriname, new Suriname() }, + { CountryIdentifier.SvalbardAndJanMayenIslands, new SvalbardAndJanMayen() }, + { CountryIdentifier.Sweden, new Sweden() }, + { CountryIdentifier.Switzerland, new Switzerland() }, + { CountryIdentifier.Syria, new Syria() }, // Future countries can be added here in the same format. };