From 45646ceaa70ecf4c024212ee5628dce451e72e48 Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 18 Dec 2025 19:52:08 +0100 Subject: [PATCH 1/3] Add new country classes and unit tests This commit introduces several new country classes for Saint Barthelemy, Saint Helena, Saint Kitts and Nevis, Saint Lucia, Saint Martin, Saint Pierre and Miquelon, Saint Vincent and the Grenadines, Samoa, San Marino, Sao Tome and Principe, Saudi Arabia, Senegal, Serbia, Seychelles, Sierra Leone, and Singapore. Each class implements the `ICountry` interface and includes properties such as `Name`, `OfficialName`, `NativeName`, `Capital`, `NumericCode`, `ISO2Code`, `ISO3Code`, `CallingCode`, and a collection of `States`. Corresponding unit tests have also been added to validate the country information retrieval. --- .../Countries/SaintBarthelemyTest.cs | 42 +++++++++++ .../Countries/SaintHelenaTest.cs | 44 +++++++++++ .../Countries/SaintKittsAndNevisTest.cs | 51 +++++++++++++ .../Countries/SaintLuciaTest.cs | 52 +++++++++++++ .../Countries/SaintMartinTest.cs | 50 +++++++++++++ .../Countries/SaintPierreAndMiquelonTest.cs | 43 +++++++++++ .../SaintVincentAndTheGrenadinesTest.cs | 48 ++++++++++++ .../Countries/SamoaTest.cs | 60 +++++++++++++++ .../Countries/SanMarinoTest.cs | 50 +++++++++++++ .../Countries/SaoTomeAndPrincipeTest.cs | 51 +++++++++++++ .../Countries/SaudiArabiaTest.cs | 54 ++++++++++++++ .../Countries/SenegalTest.cs | 63 ++++++++++++++++ .../Countries/SerbiaTest.cs | 73 ++++++++++++++++++ .../Countries/SeychellesTest.cs | 74 +++++++++++++++++++ .../Countries/SierraLeoneTest.cs | 54 ++++++++++++++ .../Countries/SingaporeTest.cs | 47 ++++++++++++ src/World.Net/Countries/SaintBarthelemy.cs | 38 ++++++++++ src/World.Net/Countries/SaintHelena.cs | 39 ++++++++++ src/World.Net/Countries/SaintKittsAndNevis.cs | 39 ++++++++++ src/World.Net/Countries/SaintLucia.cs | 48 ++++++++++++ src/World.Net/Countries/SaintMartin.cs | 38 ++++++++++ .../Countries/SaintPierreAndMiquelon.cs | 39 ++++++++++ .../Countries/SaintVincentAndTheGrenadines.cs | 42 +++++++++++ src/World.Net/Countries/Samoa.cs | 47 ++++++++++++ src/World.Net/Countries/SanMarino.cs | 45 +++++++++++ src/World.Net/Countries/SaoTomeAndPrincipe.cs | 39 ++++++++++ src/World.Net/Countries/SaudiArabia.cs | 49 ++++++++++++ src/World.Net/Countries/Senegal.cs | 50 +++++++++++++ src/World.Net/Countries/Serbia.cs | 61 +++++++++++++++ src/World.Net/Countries/Seychelles.cs | 62 ++++++++++++++++ src/World.Net/Countries/SierraLeone.cs | 41 ++++++++++ src/World.Net/Countries/Singapore.cs | 35 +++++++++ src/World.Net/Helpers/CountryInitializer.cs | 16 ++++ 33 files changed, 1584 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/SaintBarthelemyTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaintHelenaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaintKittsAndNevisTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaintLuciaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaintMartinTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaintPierreAndMiquelonTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaintVincentAndTheGrenadinesTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SamoaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SanMarinoTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaoTomeAndPrincipeTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SenegalTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SerbiaTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SeychellesTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SierraLeoneTest.cs create mode 100644 src/World.Net.UnitTests/Countries/SingaporeTest.cs create mode 100644 src/World.Net/Countries/SaintBarthelemy.cs create mode 100644 src/World.Net/Countries/SaintHelena.cs create mode 100644 src/World.Net/Countries/SaintKittsAndNevis.cs create mode 100644 src/World.Net/Countries/SaintLucia.cs create mode 100644 src/World.Net/Countries/SaintMartin.cs create mode 100644 src/World.Net/Countries/SaintPierreAndMiquelon.cs create mode 100644 src/World.Net/Countries/SaintVincentAndTheGrenadines.cs create mode 100644 src/World.Net/Countries/Samoa.cs create mode 100644 src/World.Net/Countries/SanMarino.cs create mode 100644 src/World.Net/Countries/SaoTomeAndPrincipe.cs create mode 100644 src/World.Net/Countries/SaudiArabia.cs create mode 100644 src/World.Net/Countries/Senegal.cs create mode 100644 src/World.Net/Countries/Serbia.cs create mode 100644 src/World.Net/Countries/Seychelles.cs create mode 100644 src/World.Net/Countries/SierraLeone.cs create mode 100644 src/World.Net/Countries/Singapore.cs diff --git a/src/World.Net.UnitTests/Countries/SaintBarthelemyTest.cs b/src/World.Net.UnitTests/Countries/SaintBarthelemyTest.cs new file mode 100644 index 0000000..01b4224 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintBarthelemyTest.cs @@ -0,0 +1,42 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SaintBarthelemyTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Saint-Barthélemy"; + private const string NATIVE_NAME = "Saint-Barthélemy"; + private const string CAPITAL = "Gustavia"; + private const string OFFICIAL_NAME = "Collectivity of Saint-Barthélemy"; + private const string ISO2_CODE = "BL"; + private const string ISO3_CODE = "BLM"; + private const int NUMERIC_CODE = 652; + private readonly string[] CALLING_CODE = ["+590"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintBarthelemy; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Saint-Barthélemy", "BL-BL", "Territory") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintBarthelemy() + { + // 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/SaintHelenaTest.cs b/src/World.Net.UnitTests/Countries/SaintHelenaTest.cs new file mode 100644 index 0000000..24c7465 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintHelenaTest.cs @@ -0,0 +1,44 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SaintHelenaTest : AssertCountryTestBase +{ + private const string SAINTHELENA_COUNTRY_NAME = "Saint Helena"; + private const string SAINTHELENA_NATIVE_NAME = "Saint Helena"; + private const string SAINTHELENA_CAPITAL = "Jamestown"; + private const string SAINTHELENA_OFFICIAL_NAME = "Saint Helena, Ascension and Tristan da Cunha"; + private const string SAINTHELENA_ISO2_CODE = "SH"; + private const string SAINTHELENA_ISO3_CODE = "SHN"; + private const int SAINTHELENA_NUMERIC_CODE = 654; + private readonly string[] SAINTHELENA_CALLING_CODE = ["+290"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintHelena; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Saint Helena", "SH-HL", "District"), + new("Ascension", "SH-AC", "District"), + new("Tristan da Cunha", "SH-TR", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintHelena() + { + // Arrange + // Act + var country = CountryProvider.GetCountry(EXPECTEDID); + + // Assert + AssertCorrectInformation( + country, + EXPECTEDID, + SAINTHELENA_COUNTRY_NAME, + SAINTHELENA_OFFICIAL_NAME, + SAINTHELENA_NATIVE_NAME, + SAINTHELENA_CAPITAL, + SAINTHELENA_NUMERIC_CODE, + SAINTHELENA_ISO2_CODE, + SAINTHELENA_ISO3_CODE, + SAINTHELENA_CALLING_CODE, + EXPECTED_STATES + ); + } +} diff --git a/src/World.Net.UnitTests/Countries/SaintKittsAndNevisTest.cs b/src/World.Net.UnitTests/Countries/SaintKittsAndNevisTest.cs new file mode 100644 index 0000000..e8ddc1b --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintKittsAndNevisTest.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SaintKittsAndNevisTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Saint Kitts and Nevis"; + private const string NATIVE_NAME = "Saint Kitts and Nevis"; + private const string CAPITAL = "Basseterre"; + private const string OFFICIAL_NAME = "Federation of Saint Kitts and Nevis"; + private const string ISO2_CODE = "KN"; + private const string ISO3_CODE = "KNA"; + private const int NUMERIC_CODE = 659; + private readonly string[] CALLING_CODE = ["+1-869"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintKittsAndNevis; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Saint Kitts", "KN-K", "Island"), + new("Nevis", "KN-N", "Island") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintKittsAndNevis() + { + // 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/SaintLuciaTest.cs b/src/World.Net.UnitTests/Countries/SaintLuciaTest.cs new file mode 100644 index 0000000..202aa13 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintLuciaTest.cs @@ -0,0 +1,52 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SaintLuciaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Saint Lucia"; + private const string NATIVE_NAME = "Saint Lucia"; + private const string CAPITAL = "Castries"; + private const string OFFICIAL_NAME = "Saint Lucia"; + private const string ISO2_CODE = "LC"; + private const string ISO3_CODE = "LCA"; + private const int NUMERIC_CODE = 662; + private readonly string[] CALLING_CODE = ["+1-758"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintLucia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Anse la Raye", "LC-01", "District"), + new("Canaries", "LC-02", "District"), + new("Castries", "LC-03", "District"), + new("Choiseul", "LC-04", "District"), + new("Dennery", "LC-05", "District"), + new("Gros Islet", "LC-06", "District"), + new("Laborie", "LC-07", "District"), + new("Micoud", "LC-08", "District"), + new("Praslin", "LC-09", "District"), + new("Soufriere", "LC-10", "District"), + new("Vieux Fort", "LC-11", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintLucia() + { + // 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/SaintMartinTest.cs b/src/World.Net.UnitTests/Countries/SaintMartinTest.cs new file mode 100644 index 0000000..3d10d7a --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintMartinTest.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SaintMartinTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Saint-Martin"; + private const string NATIVE_NAME = "Saint-Martin"; + private const string CAPITAL = "Marigot"; + private const string OFFICIAL_NAME = "Collectivity of Saint-Martin"; + private const string ISO2_CODE = "MF"; + private const string ISO3_CODE = "MAF"; + private const int NUMERIC_CODE = 663; + private readonly string[] CALLING_CODE = ["+590"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintMartinFrenchPart; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Saint-Martin", "MF-MF", "Territory") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintMartin() + { + // 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/SaintPierreAndMiquelonTest.cs b/src/World.Net.UnitTests/Countries/SaintPierreAndMiquelonTest.cs new file mode 100644 index 0000000..e80d08d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintPierreAndMiquelonTest.cs @@ -0,0 +1,43 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SaintPierreAndMiquelonTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Saint Pierre and Miquelon"; + private const string NATIVE_NAME = "Saint Pierre and Miquelon"; + private const string CAPITAL = "Saint-Pierre"; + private const string OFFICIAL_NAME = "Saint Pierre and Miquelon"; + private const string ISO2_CODE = "PM"; + private const string ISO3_CODE = "SPM"; + private const int NUMERIC_CODE = 666; + private readonly string[] CALLING_CODE = ["+508"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintPierreAndMiquelon; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Saint-Pierre", "PM-SP", "Commune"), + new("Miquelon-Langlade", "PM-MQ", "Commune") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintPierreAndMiquelon() + { + // 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/SaintVincentAndTheGrenadinesTest.cs b/src/World.Net.UnitTests/Countries/SaintVincentAndTheGrenadinesTest.cs new file mode 100644 index 0000000..c4c7400 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaintVincentAndTheGrenadinesTest.cs @@ -0,0 +1,48 @@ + +namespace World.Net.UnitTests.Countries; + +public sealed class SaintVincentAndTheGrenadinesTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Saint Vincent and the Grenadines"; + private const string NATIVE_NAME = "Saint Vincent and the Grenadines"; + private const string CAPITAL = "Kingstown"; + private const string OFFICIAL_NAME = "Saint Vincent and the Grenadines"; + private const string ISO2_CODE = "VC"; + private const string ISO3_CODE = "VCT"; + private const int NUMERIC_CODE = 670; + private readonly string[] CALLING_CODE = ["+1-784"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaintVincentAndTheGrenadines; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Charlotte", "VC-C", "Parish"), + new("Saint Andrew", "VC-A", "Parish"), + new("Saint David", "VC-D", "Parish"), + new("Saint George", "VC-G", "Parish"), + new("Saint Patrick", "VC-P", "Parish"), + new("Grenadines", "VC-VG", "Parish") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaintVincentAndTheGrenadines() + { + // 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/SamoaTest.cs b/src/World.Net.UnitTests/Countries/SamoaTest.cs new file mode 100644 index 0000000..fa460fb --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SamoaTest.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SamoaTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Samoa"; + private const string NATIVE_NAME = "Sāmoa"; + private const string CAPITAL = "Apia"; + private const string OFFICIAL_NAME = "Independent State of Samoa"; + private const string ISO2_CODE = "WS"; + private const string ISO3_CODE = "WSM"; + private const int NUMERIC_CODE = 882; + private readonly string[] CALLING_CODE = ["+685"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Samoa; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("A'ana", "WS-AA", "District"), + new("Aiga-i-le-Tai", "WS-AL", "District"), + new("Atua", "WS-AT", "District"), + new("Fa'asaleleaga", "WS-FS", "District"), + new("Gaga'emauga", "WS-GE", "District"), + new("Gaga'ifomauga", "WS-GF", "District"), + new("Palauli", "WS-PA", "District"), + new("Satupa'itea", "WS-SA", "District"), + new("Tuamasaga", "WS-TU", "District"), + new("Va'a-o-Fonoti", "WS-VF", "District"), + new("Vaisigano", "WS-VS", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSamoa() + { + // 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/SanMarinoTest.cs b/src/World.Net.UnitTests/Countries/SanMarinoTest.cs new file mode 100644 index 0000000..82ec59e --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SanMarinoTest.cs @@ -0,0 +1,50 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SanMarinoTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "San Marino"; + private const string NATIVE_NAME = "San Marino"; + private const string CAPITAL = "San Marino"; + private const string OFFICIAL_NAME = "Most Serene Republic of San Marino"; + private const string ISO2_CODE = "SM"; + private const string ISO3_CODE = "SMR"; + private const int NUMERIC_CODE = 674; + private readonly string[] CALLING_CODE = ["+378"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SanMarino; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Acquaviva", "SM-AC", "Municipality"), + new("Borgo Maggiore", "SM-BM", "Municipality"), + new("Chiesanuova", "SM-CH", "Municipality"), + new("Domagnano", "SM-DO", "Municipality"), + new("Faetano", "SM-FA", "Municipality"), + new("Fiorentino", "SM-FI", "Municipality"), + new("Montegiardino", "SM-MG", "Municipality"), + new("San Marino", "SM-SM", "Municipality"), + new("Serravalle", "SM-SE", "Municipality") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSanMarino() + { + // 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/SaoTomeAndPrincipeTest.cs b/src/World.Net.UnitTests/Countries/SaoTomeAndPrincipeTest.cs new file mode 100644 index 0000000..207c6d0 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaoTomeAndPrincipeTest.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SaoTomeAndPrincipeTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "São Tomé and Príncipe"; + private const string NATIVE_NAME = "São Tomé e Príncipe"; + private const string CAPITAL = "São Tomé"; + private const string OFFICIAL_NAME = "Democratic Republic of São Tomé and Príncipe"; + private const string ISO2_CODE = "ST"; + private const string ISO3_CODE = "STP"; + private const int NUMERIC_CODE = 678; + private readonly string[] CALLING_CODE = ["+239"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaoTomeAndPrincipe; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("São Tomé", "ST-ST", "Province"), + new("Príncipe", "ST-PN", "Province") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaoTomeAndPrincipe() + { + // 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/SaudiArabiaTest.cs b/src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs new file mode 100644 index 0000000..1760df6 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs @@ -0,0 +1,54 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class SaudiArabiaTest : AssertCountryTestBase +{ + private const string COUNTRY_NAME = "Saudi Arabia"; + private const string NATIVE_NAME = "المملكة العربية السعودية"; + private const string CAPITAL = "Riyadh"; + private const string OFFICIAL_NAME = "Kingdom of Saudi Arabia"; + private const string ISO2_CODE = "SA"; + private const string ISO3_CODE = "SAU"; + private const int NUMERIC_CODE = 682; + private readonly string[] CALLING_CODE = ["+966"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SaudiArabia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Riyadh", "SA-01", "Region"), + new("Makkah", "SA-02", "Region"), + new("Al Madinah", "SA-03", "Region"), + new("Eastern Province", "SA-04", "Region"), + new("Asir", "SA-05", "Region"), + new("Hail", "SA-06", "Region"), + new("Tabuk", "SA-07", "Region"), + new("Northern Borders", "SA-08", "Region"), + new("Jazan", "SA-09", "Region"), + new("Najran", "SA-10", "Region"), + new("Al Bahah", "SA-11", "Region"), + new("Al Jawf", "SA-12", "Region"), + new("Qassim", "SA-14", "Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSaudiArabia() + { + // 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/SenegalTest.cs b/src/World.Net.UnitTests/Countries/SenegalTest.cs new file mode 100644 index 0000000..5b818e4 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SenegalTest.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SenegalTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Senegal"; + private const string NATIVE_NAME = "Sénégal"; + private const string CAPITAL = "Dakar"; + private const string OFFICIAL_NAME = "Republic of Senegal"; + private const string ISO2_CODE = "SN"; + private const string ISO3_CODE = "SEN"; + private const int NUMERIC_CODE = 686; + private readonly string[] CALLING_CODE = ["+221"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Senegal; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Dakar", "SN-DK", "Region"), + new("Diourbel", "SN-DB", "Region"), + new("Fatick", "SN-FK", "Region"), + new("Kaffrine", "SN-KA", "Region"), + new("Kaolack", "SN-KL", "Region"), + new("Kédougou", "SN-KE", "Region"), + new("Kolda", "SN-KD", "Region"), + new("Louga", "SN-LG", "Region"), + new("Matam", "SN-MT", "Region"), + new("Saint-Louis", "SN-SL", "Region"), + new("Sédhiou", "SN-SE", "Region"), + new("Tambacounda", "SN-TC", "Region"), + new("Thiès", "SN-TH", "Region"), + new("Ziguinchor", "SN-ZG", "Region") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSenegal() + { + // 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/SerbiaTest.cs b/src/World.Net.UnitTests/Countries/SerbiaTest.cs new file mode 100644 index 0000000..d71ca43 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SerbiaTest.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SerbiaTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Serbia"; + private const string NATIVE_NAME = "Srbija"; + private const string CAPITAL = "Belgrade"; + private const string OFFICIAL_NAME = "Republic of Serbia"; + private const string ISO2_CODE = "RS"; + private const string ISO3_CODE = "SRB"; + private const int NUMERIC_CODE = 688; + private readonly string[] CALLING_CODE = ["+381"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Serbia; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Belgrade", "RS-00", "District"), + new("Bor", "RS-14", "District"), + new("Braničevo", "RS-11", "District"), + new("Central Banat", "RS-02", "District"), + new("Jablanica", "RS-23", "District"), + new("Kolubara", "RS-09", "District"), + new("Mačva", "RS-08", "District"), + new("Moravica", "RS-17", "District"), + new("Nišava", "RS-20", "District"), + new("North Bačka", "RS-01", "District"), + new("North Banat", "RS-03", "District"), + new("Pčinja", "RS-24", "District"), + new("Pirot", "RS-22", "District"), + new("Pomoravlje", "RS-13", "District"), + new("Rasina", "RS-19", "District"), + new("Raška", "RS-18", "District"), + new("South Bačka", "RS-06", "District"), + new("South Banat", "RS-04", "District"), + new("Srem", "RS-07", "District"), + new("Šumadija", "RS-12", "District"), + new("Toplica", "RS-21", "District"), + new("West Bačka", "RS-05", "District"), + new("Zaječar", "RS-15", "District"), + new("Zlatibor", "RS-16", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSerbia() + { + // 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/SeychellesTest.cs b/src/World.Net.UnitTests/Countries/SeychellesTest.cs new file mode 100644 index 0000000..88ed2c1 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SeychellesTest.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SeychellesTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Seychelles"; + private const string NATIVE_NAME = "Sesel"; + private const string CAPITAL = "Victoria"; + private const string OFFICIAL_NAME = "Republic of Seychelles"; + private const string ISO2_CODE = "SC"; + private const string ISO3_CODE = "SYC"; + private const int NUMERIC_CODE = 690; + private readonly string[] CALLING_CODE = ["+248"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Seychelles; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Anse aux Pins", "SC-01", "District"), + new("Anse Boileau", "SC-02", "District"), + new("Anse Etoile", "SC-03", "District"), + new("Anse Royale", "SC-05", "District"), + new("Au Cap", "SC-04", "District"), + new("Baie Lazare", "SC-06", "District"), + new("Baie Sainte Anne", "SC-07", "District"), + new("Beau Vallon", "SC-08", "District"), + new("Bel Air", "SC-09", "District"), + new("Bel Ombre", "SC-10", "District"), + new("Cascade", "SC-11", "District"), + new("Glacis", "SC-12", "District"), + new("Grand'Anse Mahé", "SC-13", "District"), + new("Grand'Anse Praslin", "SC-14", "District"), + new("La Digue", "SC-15", "District"), + new("La Rivière Anglaise", "SC-16", "District"), + new("Les Mamelles", "SC-24", "District"), + new("Mont Buxton", "SC-17", "District"), + new("Mont Fleuri", "SC-18", "District"), + new("Plaisance", "SC-19", "District"), + new("Pointe La Rue", "SC-20", "District"), + new("Port Glaud", "SC-21", "District"), + new("Roche Caiman", "SC-25", "District"), + new("Saint Louis", "SC-22", "District"), + new("Takamaka", "SC-23", "District") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSeychelles() + { + // 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/SierraLeoneTest.cs b/src/World.Net.UnitTests/Countries/SierraLeoneTest.cs new file mode 100644 index 0000000..5ad8a07 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SierraLeoneTest.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SierraLeoneTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Sierra Leone"; + private const string NATIVE_NAME = "Sierra Leone"; + private const string CAPITAL = "Freetown"; + private const string OFFICIAL_NAME = "Republic of Sierra Leone"; + private const string ISO2_CODE = "SL"; + private const string ISO3_CODE = "SLE"; + private const int NUMERIC_CODE = 694; + private readonly string[] CALLING_CODE = ["+232"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.SierraLeone; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = + [ + new("Eastern Province", "SL-E", "Province"), + new("Northern Province", "SL-N", "Province"), + new("North Western Province", "SL-NW", "Province"), + new("Southern Province", "SL-S", "Province"), + new("Western Area", "SL-W", "Province") + ]; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSierraLeone() + { + // 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/SingaporeTest.cs b/src/World.Net.UnitTests/Countries/SingaporeTest.cs new file mode 100644 index 0000000..3dd8731 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/SingaporeTest.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class SingaporeTest : AssertCountryTestBase + { + private const string COUNTRY_NAME = "Singapore"; + private const string NATIVE_NAME = "Singapore"; + private const string CAPITAL = "Singapore"; + private const string OFFICIAL_NAME = "Republic of Singapore"; + private const string ISO2_CODE = "SG"; + private const string ISO3_CODE = "SGP"; + private const int NUMERIC_CODE = 702; + private readonly string[] CALLING_CODE = ["+65"]; + private const CountryIdentifier EXPECTEDID = CountryIdentifier.Singapore; + + private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = []; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForSingapore() + { + // 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/Countries/SaintBarthelemy.cs b/src/World.Net/Countries/SaintBarthelemy.cs new file mode 100644 index 0000000..5d955ad --- /dev/null +++ b/src/World.Net/Countries/SaintBarthelemy.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries; + +internal sealed class SaintBarthelemy : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintBarthelemy; + + // + public string Name { get; } = "Saint-Barthélemy"; + + // + public string OfficialName { get; } = "Collectivity of Saint-Barthélemy"; + + // + public string NativeName => "Saint-Barthélemy"; + + // + public string Capital { get; } = "Gustavia"; + + // + public int NumericCode { get; } = 652; + + // + public string ISO2Code { get; } = "BL"; + + // + public string ISO3Code { get; } = "BLM"; + + // + public string[] CallingCode { get; } = ["+590"]; + + // + public IEnumerable States => + [ + new("Saint-Barthélemy", "BL-BL", "Territory") + ]; +} + diff --git a/src/World.Net/Countries/SaintHelena.cs b/src/World.Net/Countries/SaintHelena.cs new file mode 100644 index 0000000..2bce939 --- /dev/null +++ b/src/World.Net/Countries/SaintHelena.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries; + +internal sealed class SaintHelena : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintHelena; + + // + public string Name { get; } = "Saint Helena"; + + // + public string OfficialName { get; } = "Saint Helena, Ascension and Tristan da Cunha"; + + // + public string NativeName => "Saint Helena"; + + // + public string Capital { get; } = "Jamestown"; + + // + public int NumericCode { get; } = 654; + + // + public string ISO2Code { get; } = "SH"; + + // + public string ISO3Code { get; } = "SHN"; + + // + public string[] CallingCode { get; } = ["+290"]; + + // + public IEnumerable States => + [ + new("Saint Helena", "SH-HL", "District"), + new("Ascension", "SH-AC", "District"), + new("Tristan da Cunha", "SH-TR", "District") + ]; +} diff --git a/src/World.Net/Countries/SaintKittsAndNevis.cs b/src/World.Net/Countries/SaintKittsAndNevis.cs new file mode 100644 index 0000000..31375ac --- /dev/null +++ b/src/World.Net/Countries/SaintKittsAndNevis.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries; + +internal sealed class SaintKittsAndNevis : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintKittsAndNevis; + + // + public string Name { get; } = "Saint Kitts and Nevis"; + + // + public string OfficialName { get; } = "Federation of Saint Kitts and Nevis"; + + // + public string NativeName => "Saint Kitts and Nevis"; + + // + public string Capital { get; } = "Basseterre"; + + // + public int NumericCode { get; } = 659; + + // + public string ISO2Code { get; } = "KN"; + + // + public string ISO3Code { get; } = "KNA"; + + // + public string[] CallingCode { get; } = ["+1-869"]; + + // + public IEnumerable States => + [ + new("Saint Kitts", "KN-K", "Island"), + new("Nevis", "KN-N", "Island") + ]; +} + diff --git a/src/World.Net/Countries/SaintLucia.cs b/src/World.Net/Countries/SaintLucia.cs new file mode 100644 index 0000000..ac9ae51 --- /dev/null +++ b/src/World.Net/Countries/SaintLucia.cs @@ -0,0 +1,48 @@ +namespace World.Net.Countries; + +internal sealed class SaintLucia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintLucia; + + // + public string Name { get; } = "Saint Lucia"; + + // + public string OfficialName { get; } = "Saint Lucia"; + + // + public string NativeName => "Saint Lucia"; + + // + public string Capital { get; } = "Castries"; + + // + public int NumericCode { get; } = 662; + + // + public string ISO2Code { get; } = "LC"; + + // + public string ISO3Code { get; } = "LCA"; + + // + public string[] CallingCode { get; } = ["+1-758"]; + + // + public IEnumerable States => + [ + new("Anse la Raye", "LC-01", "District"), + new("Canaries", "LC-02", "District"), + new("Castries", "LC-03", "District"), + new("Choiseul", "LC-04", "District"), + new("Dennery", "LC-05", "District"), + new("Gros Islet", "LC-06", "District"), + new("Laborie", "LC-07", "District"), + new("Micoud", "LC-08", "District"), + new("Praslin", "LC-09", "District"), + new("Soufriere", "LC-10", "District"), + new("Vieux Fort", "LC-11", "District") + ]; +} + diff --git a/src/World.Net/Countries/SaintMartin.cs b/src/World.Net/Countries/SaintMartin.cs new file mode 100644 index 0000000..b9d33ac --- /dev/null +++ b/src/World.Net/Countries/SaintMartin.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries; + +internal sealed class SaintMartin : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintMartinFrenchPart; + + // + public string Name { get; } = "Saint-Martin"; + + // + public string OfficialName { get; } = "Collectivity of Saint-Martin"; + + // + public string NativeName => "Saint-Martin"; + + // + public string Capital { get; } = "Marigot"; + + // + public int NumericCode { get; } = 663; + + // + public string ISO2Code { get; } = "MF"; + + // + public string ISO3Code { get; } = "MAF"; + + // + public string[] CallingCode { get; } = ["+590"]; + + // + public IEnumerable States => + [ + new("Saint-Martin", "MF-MF", "Territory") + ]; +} + diff --git a/src/World.Net/Countries/SaintPierreAndMiquelon.cs b/src/World.Net/Countries/SaintPierreAndMiquelon.cs new file mode 100644 index 0000000..6585152 --- /dev/null +++ b/src/World.Net/Countries/SaintPierreAndMiquelon.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries; + +internal sealed class SaintPierreAndMiquelon : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintPierreAndMiquelon; + + // + public string Name { get; } = "Saint Pierre and Miquelon"; + + // + public string OfficialName { get; } = "Saint Pierre and Miquelon"; + + // + public string NativeName => "Saint Pierre and Miquelon"; + + // + public string Capital { get; } = "Saint-Pierre"; + + // + public int NumericCode { get; } = 666; + + // + public string ISO2Code { get; } = "PM"; + + // + public string ISO3Code { get; } = "SPM"; + + // + public string[] CallingCode { get; } = ["+508"]; + + // + public IEnumerable States => + [ + new("Saint-Pierre", "PM-SP", "Commune"), + new("Miquelon-Langlade", "PM-MQ", "Commune") + ]; +} + diff --git a/src/World.Net/Countries/SaintVincentAndTheGrenadines.cs b/src/World.Net/Countries/SaintVincentAndTheGrenadines.cs new file mode 100644 index 0000000..cd425bf --- /dev/null +++ b/src/World.Net/Countries/SaintVincentAndTheGrenadines.cs @@ -0,0 +1,42 @@ +namespace World.Net.Countries; + +internal sealed class SaintVincentAndTheGrenadines : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaintVincentAndTheGrenadines; + + // + public string Name { get; } = "Saint Vincent and the Grenadines"; + + // + public string OfficialName { get; } = "Saint Vincent and the Grenadines"; + + // + public string NativeName => "Saint Vincent and the Grenadines"; + + // + public string Capital { get; } = "Kingstown"; + + // + public int NumericCode { get; } = 670; + + // + public string ISO2Code { get; } = "VC"; + + // + public string ISO3Code { get; } = "VCT"; + + // + public string[] CallingCode { get; } = ["+1-784"]; + + // + public IEnumerable States => + [ + new("Charlotte", "VC-C", "Parish"), + new("Saint Andrew", "VC-A", "Parish"), + new("Saint David", "VC-D", "Parish"), + new("Saint George", "VC-G", "Parish"), + new("Saint Patrick", "VC-P", "Parish"), + new("Grenadines", "VC-VG", "Parish") + ]; +} diff --git a/src/World.Net/Countries/Samoa.cs b/src/World.Net/Countries/Samoa.cs new file mode 100644 index 0000000..884263e --- /dev/null +++ b/src/World.Net/Countries/Samoa.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries; + +internal sealed class Samoa : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Samoa; + + // + public string Name { get; } = "Samoa"; + + // + public string OfficialName { get; } = "Independent State of Samoa"; + + // + public string NativeName => "Sāmoa"; + + // + public string Capital { get; } = "Apia"; + + // + public int NumericCode { get; } = 882; + + // + public string ISO2Code { get; } = "WS"; + + // + public string ISO3Code { get; } = "WSM"; + + // + public string[] CallingCode { get; } = ["+685"]; + + // + public IEnumerable States => + [ + new("A'ana", "WS-AA", "District"), + new("Aiga-i-le-Tai", "WS-AL", "District"), + new("Atua", "WS-AT", "District"), + new("Fa'asaleleaga", "WS-FS", "District"), + new("Gaga'emauga", "WS-GE", "District"), + new("Gaga'ifomauga", "WS-GF", "District"), + new("Palauli", "WS-PA", "District"), + new("Satupa'itea", "WS-SA", "District"), + new("Tuamasaga", "WS-TU", "District"), + new("Va'a-o-Fonoti", "WS-VF", "District"), + new("Vaisigano", "WS-VS", "District") + ]; +} diff --git a/src/World.Net/Countries/SanMarino.cs b/src/World.Net/Countries/SanMarino.cs new file mode 100644 index 0000000..1b29d2b --- /dev/null +++ b/src/World.Net/Countries/SanMarino.cs @@ -0,0 +1,45 @@ +namespace World.Net.Countries; + +internal sealed class SanMarino : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SanMarino; + + // + public string Name { get; } = "San Marino"; + + // + public string OfficialName { get; } = "Most Serene Republic of San Marino"; + + // + public string NativeName => "San Marino"; + + // + public string Capital { get; } = "San Marino"; + + // + public int NumericCode { get; } = 674; + + // + public string ISO2Code { get; } = "SM"; + + // + public string ISO3Code { get; } = "SMR"; + + // + public string[] CallingCode { get; } = ["+378"]; + + // + public IEnumerable States => + [ + new("Acquaviva", "SM-AC", "Municipality"), + new("Borgo Maggiore", "SM-BM", "Municipality"), + new("Chiesanuova", "SM-CH", "Municipality"), + new("Domagnano", "SM-DO", "Municipality"), + new("Faetano", "SM-FA", "Municipality"), + new("Fiorentino", "SM-FI", "Municipality"), + new("Montegiardino", "SM-MG", "Municipality"), + new("San Marino", "SM-SM", "Municipality"), + new("Serravalle", "SM-SE", "Municipality") + ]; +} diff --git a/src/World.Net/Countries/SaoTomeAndPrincipe.cs b/src/World.Net/Countries/SaoTomeAndPrincipe.cs new file mode 100644 index 0000000..5379245 --- /dev/null +++ b/src/World.Net/Countries/SaoTomeAndPrincipe.cs @@ -0,0 +1,39 @@ +namespace World.Net.Countries; + +internal sealed class SaoTomeAndPrincipe : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaoTomeAndPrincipe; + + // + public string Name { get; } = "São Tomé and Príncipe"; + + // + public string OfficialName { get; } = "Democratic Republic of São Tomé and Príncipe"; + + // + public string NativeName => "São Tomé e Príncipe"; + + // + public string Capital { get; } = "São Tomé"; + + // + public int NumericCode { get; } = 678; + + // + public string ISO2Code { get; } = "ST"; + + // + public string ISO3Code { get; } = "STP"; + + // + public string[] CallingCode { get; } = ["+239"]; + + // + public IEnumerable States => + [ + new("São Tomé", "ST-ST", "Province"), + new("Príncipe", "ST-PN", "Province") + ]; +} + diff --git a/src/World.Net/Countries/SaudiArabia.cs b/src/World.Net/Countries/SaudiArabia.cs new file mode 100644 index 0000000..662b7ce --- /dev/null +++ b/src/World.Net/Countries/SaudiArabia.cs @@ -0,0 +1,49 @@ +namespace World.Net.Countries; + +internal sealed class SaudiArabia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SaudiArabia; + + // + public string Name { get; } = "Saudi Arabia"; + + // + public string OfficialName { get; } = "Kingdom of Saudi Arabia"; + + // + public string NativeName => "المملكة العربية السعودية"; + + // + public string Capital { get; } = "Riyadh"; + + // + public int NumericCode { get; } = 682; + + // + public string ISO2Code { get; } = "SA"; + + // + public string ISO3Code { get; } = "SAU"; + + // + public string[] CallingCode { get; } = ["+966"]; + + // + public IEnumerable States => + [ + new("Riyadh", "SA-01", "Region"), + new("Makkah", "SA-02", "Region"), + new("Al Madinah", "SA-03", "Region"), + new("Eastern Province", "SA-04", "Region"), + new("Asir", "SA-05", "Region"), + new("Tabuk", "SA-07", "Region"), + new("Hail", "SA-06", "Region"), + new("Northern Borders", "SA-08", "Region"), + new("Jazan", "SA-09", "Region"), + new("Najran", "SA-10", "Region"), + new("Al Bahah", "SA-11", "Region"), + new("Al Jawf", "SA-12", "Region"), + new("Qassim", "SA-14", "Region") + ]; +} diff --git a/src/World.Net/Countries/Senegal.cs b/src/World.Net/Countries/Senegal.cs new file mode 100644 index 0000000..02299b7 --- /dev/null +++ b/src/World.Net/Countries/Senegal.cs @@ -0,0 +1,50 @@ +namespace World.Net.Countries; + +internal sealed class Senegal : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Senegal; + + // + public string Name { get; } = "Senegal"; + + // + public string OfficialName { get; } = "Republic of Senegal"; + + // + public string NativeName => "Sénégal"; + + // + public string Capital { get; } = "Dakar"; + + // + public int NumericCode { get; } = 686; + + // + public string ISO2Code { get; } = "SN"; + + // + public string ISO3Code { get; } = "SEN"; + + // + public string[] CallingCode { get; } = ["+221"]; + + // + public IEnumerable States => + [ + new("Dakar", "SN-DK", "Region"), + new("Diourbel", "SN-DB", "Region"), + new("Fatick", "SN-FK", "Region"), + new("Kaffrine", "SN-KA", "Region"), + new("Kaolack", "SN-KL", "Region"), + new("Kédougou", "SN-KE", "Region"), + new("Kolda", "SN-KD", "Region"), + new("Louga", "SN-LG", "Region"), + new("Matam", "SN-MT", "Region"), + new("Saint-Louis", "SN-SL", "Region"), + new("Sédhiou", "SN-SE", "Region"), + new("Tambacounda", "SN-TC", "Region"), + new("Thiès", "SN-TH", "Region"), + new("Ziguinchor", "SN-ZG", "Region") + ]; +} diff --git a/src/World.Net/Countries/Serbia.cs b/src/World.Net/Countries/Serbia.cs new file mode 100644 index 0000000..88442ae --- /dev/null +++ b/src/World.Net/Countries/Serbia.cs @@ -0,0 +1,61 @@ +namespace World.Net.Countries; + +internal sealed class Serbia : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Serbia; + + // + public string Name { get; } = "Serbia"; + + // + public string OfficialName { get; } = "Republic of Serbia"; + + // + public string NativeName => "Srbija"; + + // + public string Capital { get; } = "Belgrade"; + + // + public int NumericCode { get; } = 688; + + // + public string ISO2Code { get; } = "RS"; + + // + public string ISO3Code { get; } = "SRB"; + + // + public string[] CallingCode { get; } = ["+381"]; + + // + public IEnumerable States => + [ + new("Belgrade", "RS-00", "District"), + new("Bor", "RS-14", "District"), + new("Braničevo", "RS-11", "District"), + new("Central Banat", "RS-02", "District"), + new("Jablanica", "RS-23", "District"), + new("Kolubara", "RS-09", "District"), + new("Mačva", "RS-08", "District"), + new("Moravica", "RS-17", "District"), + new("Nišava", "RS-20", "District"), + new("North Bačka", "RS-01", "District"), + new("North Banat", "RS-03", "District"), + new("Pčinja", "RS-24", "District"), + new("Pirot", "RS-22", "District"), + new("Pomoravlje", "RS-13", "District"), + new("Rasina", "RS-19", "District"), + new("Raška", "RS-18", "District"), + new("South Bačka", "RS-06", "District"), + new("South Banat", "RS-04", "District"), + new("Srem", "RS-07", "District"), + new("Šumadija", "RS-12", "District"), + new("Toplica", "RS-21", "District"), + new("West Bačka", "RS-05", "District"), + new("Zaječar", "RS-15", "District"), + new("Zlatibor", "RS-16", "District") + ]; +} + diff --git a/src/World.Net/Countries/Seychelles.cs b/src/World.Net/Countries/Seychelles.cs new file mode 100644 index 0000000..71c0398 --- /dev/null +++ b/src/World.Net/Countries/Seychelles.cs @@ -0,0 +1,62 @@ +namespace World.Net.Countries; + +internal sealed class Seychelles : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Seychelles; + + // + public string Name { get; } = "Seychelles"; + + // + public string OfficialName { get; } = "Republic of Seychelles"; + + // + public string NativeName => "Sesel"; + + // + public string Capital { get; } = "Victoria"; + + // + public int NumericCode { get; } = 690; + + // + public string ISO2Code { get; } = "SC"; + + // + public string ISO3Code { get; } = "SYC"; + + // + public string[] CallingCode { get; } = ["+248"]; + + // + public IEnumerable States => + [ + new("Anse aux Pins", "SC-01", "District"), + new("Anse Boileau", "SC-02", "District"), + new("Anse Etoile", "SC-03", "District"), + new("Anse Royale", "SC-05", "District"), + new("Au Cap", "SC-04", "District"), + new("Baie Lazare", "SC-06", "District"), + new("Baie Sainte Anne", "SC-07", "District"), + new("Beau Vallon", "SC-08", "District"), + new("Bel Air", "SC-09", "District"), + new("Bel Ombre", "SC-10", "District"), + new("Cascade", "SC-11", "District"), + new("Glacis", "SC-12", "District"), + new("Grand'Anse Mahé", "SC-13", "District"), + new("Grand'Anse Praslin", "SC-14", "District"), + new("La Digue", "SC-15", "District"), + new("La Rivière Anglaise", "SC-16", "District"), + new("Les Mamelles", "SC-24", "District"), + new("Mont Buxton", "SC-17", "District"), + new("Mont Fleuri", "SC-18", "District"), + new("Plaisance", "SC-19", "District"), + new("Pointe La Rue", "SC-20", "District"), + new("Port Glaud", "SC-21", "District"), + new("Roche Caiman", "SC-25", "District"), + new("Saint Louis", "SC-22", "District"), + new("Takamaka", "SC-23", "District") + ]; +} + diff --git a/src/World.Net/Countries/SierraLeone.cs b/src/World.Net/Countries/SierraLeone.cs new file mode 100644 index 0000000..de48df2 --- /dev/null +++ b/src/World.Net/Countries/SierraLeone.cs @@ -0,0 +1,41 @@ +namespace World.Net.Countries; + +internal sealed class SierraLeone : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.SierraLeone; + + // + public string Name { get; } = "Sierra Leone"; + + // + public string OfficialName { get; } = "Republic of Sierra Leone"; + + // + public string NativeName => "Sierra Leone"; + + // + public string Capital { get; } = "Freetown"; + + // + public int NumericCode { get; } = 694; + + // + public string ISO2Code { get; } = "SL"; + + // + public string ISO3Code { get; } = "SLE"; + + // + public string[] CallingCode { get; } = ["+232"]; + + // + public IEnumerable States => + [ + new("Eastern Province", "SL-E", "Province"), + new("Northern Province", "SL-N", "Province"), + new("North Western Province", "SL-NW", "Province"), + new("Southern Province", "SL-S", "Province"), + new("Western Area", "SL-W", "Province") + ]; +} diff --git a/src/World.Net/Countries/Singapore.cs b/src/World.Net/Countries/Singapore.cs new file mode 100644 index 0000000..011f285 --- /dev/null +++ b/src/World.Net/Countries/Singapore.cs @@ -0,0 +1,35 @@ +namespace World.Net.Countries; + +internal sealed class Singapore : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Singapore; + + // + public string Name { get; } = "Singapore"; + + // + public string OfficialName { get; } = "Republic of Singapore"; + + // + public string NativeName => "Singapore"; + + // + public string Capital { get; } = "Singapore"; + + // + public int NumericCode { get; } = 702; + + // + public string ISO2Code { get; } = "SG"; + + // + public string ISO3Code { get; } = "SGP"; + + // + public string[] CallingCode { get; } = ["+65"]; + + // + public IEnumerable States => []; +} + diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index e1b6bf1..6869522 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -160,6 +160,22 @@ public static Dictionary Initialize() { CountryIdentifier.Romania, new Romania() }, { CountryIdentifier.Russia, new Russia() }, { CountryIdentifier.Rwanda, new Rwanda() }, + { CountryIdentifier.SaintHelena, new SaintHelena() }, + { CountryIdentifier.SaintKittsAndNevis, new SaintKittsAndNevis() }, + { CountryIdentifier.SaintLucia, new SaintLucia() }, + { CountryIdentifier.SaintPierreAndMiquelon, new SaintPierreAndMiquelon() }, + { CountryIdentifier.SaintVincentAndTheGrenadines, new SaintVincentAndTheGrenadines() }, + { CountryIdentifier.SaintBarthelemy, new SaintBarthelemy() }, + { CountryIdentifier.SaintMartinFrenchPart, new SaintMartin() }, + { CountryIdentifier.Samoa, new Samoa() }, + { CountryIdentifier.SanMarino, new SanMarino() }, + { CountryIdentifier.SaoTomeAndPrincipe, new SaoTomeAndPrincipe() }, + { CountryIdentifier.SaudiArabia, new SaudiArabia() }, + { CountryIdentifier.Senegal, new Senegal() }, + { CountryIdentifier.Serbia, new Serbia() }, + { CountryIdentifier.Seychelles, new Seychelles() }, + { CountryIdentifier.SierraLeone, new Singapore() }, + { CountryIdentifier.Singapore, new Singapore() }, // Future countries can be added here in the same format. }; From 006d747cd97d94b3fa3ec4300c16659c36ae95e6 Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 18 Dec 2025 19:54:47 +0100 Subject: [PATCH 2/3] updated siera lonne --- src/World.Net/Helpers/CountryInitializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 6869522..8211a11 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -174,7 +174,7 @@ public static Dictionary Initialize() { CountryIdentifier.Senegal, new Senegal() }, { CountryIdentifier.Serbia, new Serbia() }, { CountryIdentifier.Seychelles, new Seychelles() }, - { CountryIdentifier.SierraLeone, new Singapore() }, + { CountryIdentifier.SierraLeone, new SierraLeone() }, { CountryIdentifier.Singapore, new Singapore() }, // Future countries can be added here in the same format. From 1ff16080bc8759946f09df55750d86d5f247de5c Mon Sep 17 00:00:00 2001 From: IDAM Date: Thu, 18 Dec 2025 20:18:19 +0100 Subject: [PATCH 3/3] updated failed test --- .../Countries/SaudiArabiaTest.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs b/src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs index 1760df6..4ede702 100644 --- a/src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs +++ b/src/World.Net.UnitTests/Countries/SaudiArabiaTest.cs @@ -15,18 +15,18 @@ public sealed class SaudiArabiaTest : AssertCountryTestBase private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = [ new("Riyadh", "SA-01", "Region"), - new("Makkah", "SA-02", "Region"), - new("Al Madinah", "SA-03", "Region"), - new("Eastern Province", "SA-04", "Region"), - new("Asir", "SA-05", "Region"), - new("Hail", "SA-06", "Region"), - new("Tabuk", "SA-07", "Region"), - new("Northern Borders", "SA-08", "Region"), - new("Jazan", "SA-09", "Region"), - new("Najran", "SA-10", "Region"), - new("Al Bahah", "SA-11", "Region"), - new("Al Jawf", "SA-12", "Region"), - new("Qassim", "SA-14", "Region") + new("Makkah", "SA-02", "Region"), + new("Al Madinah", "SA-03", "Region"), + new("Eastern Province", "SA-04", "Region"), + new("Asir", "SA-05", "Region"), + new("Tabuk", "SA-07", "Region"), + new("Hail", "SA-06", "Region"), + new("Northern Borders", "SA-08", "Region"), + new("Jazan", "SA-09", "Region"), + new("Najran", "SA-10", "Region"), + new("Al Bahah", "SA-11", "Region"), + new("Al Jawf", "SA-12", "Region"), + new("Qassim", "SA-14", "Region") ]; [Fact]