From 02d22743f40a8ccd01638fcb1b61b7062478d3af Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 9 Oct 2025 22:17:20 +0100 Subject: [PATCH 01/20] add lebanon state details --- src/World.Net/Countries/Lebanon.cs | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/World.Net/Countries/Lebanon.cs diff --git a/src/World.Net/Countries/Lebanon.cs b/src/World.Net/Countries/Lebanon.cs new file mode 100644 index 0000000..8e02af1 --- /dev/null +++ b/src/World.Net/Countries/Lebanon.cs @@ -0,0 +1,46 @@ +namespace World.Net.Countries +{ + internal sealed class Lebanon : ICountry + { + // + public CountryIdentifier Id => CountryIdentifier.Lebanon; + + // + public string Name { get; } = "Lebanon"; + + // + public string OfficialName { get; } = "Lebanese Republic"; + + // + public string NativeName { get; } = "الجمهورية اللبنانية"; + + // + public string Capital { get; } = "Beirut"; + + // + public int NumericCode { get; } = 422; + + // + public string ISO2Code { get; } = "LB"; + + // + public string ISO3Code { get; } = "LBN"; + + // + public string[] CallingCode { get; } = ["+961"]; + + // + public IEnumerable States { get; } = + [ + new("Akkar", "LB-AK", "Governorate"), + new("Baalbek-Hermel", "LB-BH", "Governorate"), + new("Beirut", "LB-BA", "Governorate"), + new("Beqaa", "LB-BI", "Governorate"), + new("Mount Lebanon", "LB-JL", "Governorate"), + new("Nabatieh", "LB-NA", "Governorate"), + new("North Lebanon", "LB-AS", "Governorate"), + new("South Lebanon", "LB-JA", "Governorate") + ]; + } + +} From 909c6ecbfb43397573f44dc9e7fbc019cbaf6f89 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 12:59:51 +0100 Subject: [PATCH 02/20] add lesotho --- src/World.Net/Countries/Lesotho.cs | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/World.Net/Countries/Lesotho.cs diff --git a/src/World.Net/Countries/Lesotho.cs b/src/World.Net/Countries/Lesotho.cs new file mode 100644 index 0000000..2816bc7 --- /dev/null +++ b/src/World.Net/Countries/Lesotho.cs @@ -0,0 +1,47 @@ +namespace World.Net.Countries +{ + internal sealed class Lesotho : ICountry + { + // + public CountryIdentifier Id => CountryIdentifier.Lesotho; + + // + public string Name { get; } = "Lesotho"; + + // + public string OfficialName { get; } = "Kingdom of Lesotho"; + + // + public string NativeName { get; } = "Muso oa Lesotho"; + + // + public string Capital { get; } = "Maseru"; + + // + public int NumericCode { get; } = 426; + + // + public string ISO2Code { get; } = "LS"; + + // + public string ISO3Code { get; } = "LSO"; + + // + public string[] CallingCode { get; } = ["+266"]; + + // + public IEnumerable States { get; } = + [ + new("Berea", "LS-D", "District"), + new("Butha-Buthe", "LS-B", "District"), + new("Leribe", "LS-C", "District"), + new("Mafeteng", "LS-E", "District"), + new("Maseru", "LS-A", "District"), + new("Mohale's Hoek", "LS-F", "District"), + new("Mokhotlong", "LS-J", "District"), + new("Qacha's Nek", "LS-H", "District"), + new("Quthing", "LS-G", "District"), + new("Thaba-Tseka", "LS-K", "District") + ]; + } +} From 2bfe92311d8645b0b15622a1807a5cdec024cf68 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:00:03 +0100 Subject: [PATCH 03/20] add liberia --- src/World.Net/Countries/Liberia.cs | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/World.Net/Countries/Liberia.cs diff --git a/src/World.Net/Countries/Liberia.cs b/src/World.Net/Countries/Liberia.cs new file mode 100644 index 0000000..4eab108 --- /dev/null +++ b/src/World.Net/Countries/Liberia.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace World.Net.Countries +{ + internal sealed class Liberia : ICountry + { + + // + public CountryIdentifier Id => CountryIdentifier.Liberia; + + // + public string Name { get; } = "Liberia"; + + // + public string OfficialName { get; } = "Republic of Liberia"; + + // + public string NativeName { get; } = "Republic of Liberia"; + + // + public string Capital { get; } = "Monrovia"; + + // + public int NumericCode { get; } = 430; + + // + public string ISO2Code { get; } = "LR"; + + // + public string ISO3Code { get; } = "LBR"; + + // + public string[] CallingCode { get; } = ["+231"]; + + // + public IEnumerable States { get; } = + [ + new("Bomi", "LR-BM", "County"), + new("Bong", "LR-BG", "County"), + new("Gbarpolu", "LR-GP", "County"), + new("Grand Bassa", "LR-GB", "County"), + new("Grand Cape Mount", "LR-CM", "County"), + new("Grand Gedeh", "LR-GG", "County"), + new("Grand Kru", "LR-GK", "County"), + new("Lofa", "LR-LO", "County"), + new("Margibi", "LR-MG", "County"), + new("Maryland", "LR-MY", "County"), + new("Montserrado", "LR-MO", "County"), + new("Nimba", "LR-NI", "County"), + new("River Cess", "LR-RI", "County"), + new("River Gee", "LR-RG", "County"), + new("Sinoe", "LR-SI", "County") + ]; + } + +} From f8fde04b6158f14f48bf7099f0bf2ac22b7c7caa Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:05:06 +0100 Subject: [PATCH 04/20] initialize lebanon, lesotho and liberia --- src/World.Net/Helpers/CountryInitializer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index c58af85..5b23e00 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -100,6 +100,9 @@ public static Dictionary Initialize() { CountryIdentifier.Kyrgyzstan, new Kyrgyzstan() }, { CountryIdentifier.Laos, new Laos() }, { CountryIdentifier.Latvia, new Latvia() }, + { CountryIdentifier.Lebanon, new Lebanon() }, + { CountryIdentifier.Lesotho, new Lesotho() }, + { CountryIdentifier.Liberia, new Liberia() }, // Future countries can be added here in the same format. }; From 04e807cc5f24784ff9276fdb6cb2c775149722cd Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:26:31 +0100 Subject: [PATCH 05/20] add Liechtenstein --- src/World.Net/Countries/Liechtenstein.cs | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/World.Net/Countries/Liechtenstein.cs diff --git a/src/World.Net/Countries/Liechtenstein.cs b/src/World.Net/Countries/Liechtenstein.cs new file mode 100644 index 0000000..4e85abd --- /dev/null +++ b/src/World.Net/Countries/Liechtenstein.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace World.Net.Countries +{ + internal sealed class Liechtenstein : ICountry + { + // + public CountryIdentifier Id => CountryIdentifier.Liechtenstein; + + // + public string Name { get; } = "Liechtenstein"; + + // + public string OfficialName { get; } = "Principality of Liechtenstein"; + + // + public string NativeName { get; } = "Fürstentum Liechtenstein"; + + // + public string Capital { get; } = "Vaduz"; + + // + public int NumericCode { get; } = 438; + + // + public string ISO2Code { get; } = "LI"; + + // + public string ISO3Code { get; } = "LIE"; + + // + public string[] CallingCode { get; } = ["+423"]; + + // + public IEnumerable States { get; } = + [ + new("Balzers", "LI-01", "Municipality"), + new("Eschen", "LI-02", "Municipality"), + new("Gamprin", "LI-03", "Municipality"), + new("Mauren", "LI-04", "Municipality"), + new("Planken", "LI-05", "Municipality"), + new("Ruggell", "LI-06", "Municipality"), + new("Schaan", "LI-07", "Municipality"), + new("Schellenberg", "LI-08", "Municipality"), + new("Triesen", "LI-09", "Municipality"), + new("Triesenberg", "LI-10", "Municipality"), + new("Vaduz", "LI-11", "Municipality") + ]; + } + +} From a7ef439f6b4054f59616ed3c6b8d1db38df1055b Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:26:42 +0100 Subject: [PATCH 06/20] add Libya --- src/World.Net/Countries/Libya.cs | 57 ++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/World.Net/Countries/Libya.cs diff --git a/src/World.Net/Countries/Libya.cs b/src/World.Net/Countries/Libya.cs new file mode 100644 index 0000000..8883f2c --- /dev/null +++ b/src/World.Net/Countries/Libya.cs @@ -0,0 +1,57 @@ +namespace World.Net.Countries +{ + internal sealed class Libya : ICountry + { + + // + public CountryIdentifier Id => CountryIdentifier.Libya; + + // + public string Name { get; } = "Libya"; + + // + public string OfficialName { get; } = "State of Libya"; + + // + public string NativeName { get; } = "دولة ليبيا"; + + // + public string Capital { get; } = "Tripoli"; + + // + public int NumericCode { get; } = 434; + + // + public string ISO2Code { get; } = "LY"; + + // + public string ISO3Code { get; } = "LBY"; + + // + public string[] CallingCode { get; } = ["+218"]; + + // + public IEnumerable States { get; } = + [ + new("Al Butnan", "LY-BU", "District"), + new("Al Jabal al Akhdar", "LY-JA", "District"), + new("Al Jabal al Gharbi", "LY-JG", "District"), + new("Al Jafara", "LY-JI", "District"), + new("Al Jufra", "LY-JU", "District"), + new("Al Kufra", "LY-KF", "District"), + new("Al Marj", "LY-MJ", "District"), + new("Al Marqab", "LY-MB", "District"), + new("Al Wahat", "LY-WA", "District"), + new("Nalut", "LY-NL", "District"), + new("Misrata", "LY-MI", "District"), + new("Murzuq", "LY-MQ", "District"), + new("Sabha", "LY-SB", "District"), + new("Sirt", "LY-SR", "District"), + new("Tripoli", "LY-TB", "District"), + new("Wadi al Hayat", "LY-WD", "District"), + new("Wadi ash Shati'", "LY-WS", "District"), + new("Zawiya", "LY-ZA", "District") + ]; + } + +} From 7cf019e29a0b03d2fb37b5133bc5ea9c402465ad Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:27:06 +0100 Subject: [PATCH 07/20] initialize Liechtenstein and Libya --- src/World.Net/Helpers/CountryInitializer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 5b23e00..ee0378d 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -103,6 +103,8 @@ public static Dictionary Initialize() { CountryIdentifier.Lebanon, new Lebanon() }, { CountryIdentifier.Lesotho, new Lesotho() }, { CountryIdentifier.Liberia, new Liberia() }, + { CountryIdentifier.Libya, new Libya() }, + { CountryIdentifier.Liechtenstein, new Liechtenstein() }, // Future countries can be added here in the same format. }; From 06b2ca7f76083529198ec4f071bde9db4996ab51 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:28:14 +0100 Subject: [PATCH 08/20] add Lesotho test --- .../Countries/LesothoTest.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LesothoTest.cs diff --git a/src/World.Net.UnitTests/Countries/LesothoTest.cs b/src/World.Net.UnitTests/Countries/LesothoTest.cs new file mode 100644 index 0000000..2423d74 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LesothoTest.cs @@ -0,0 +1,49 @@ +namespace World.Net.UnitTests.Countries +{ + public class LesothoTest : AssertCountryTestBase + { + public static CountryIdentifier Id => CountryIdentifier.Lesotho; + public string Name { get; } = "Lesotho"; + public string OfficialName { get; } = "Kingdom of Lesotho"; + public string NativeName { get; } = "Muso oa Lesotho"; + public string Capital { get; } = "Maseru"; + public int NumericCode { get; } = 426; + public string ISO2Code { get; } = "LS"; + public string ISO3Code { get; } = "LSO"; + public string[] CallingCode { get; } = ["+266"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + new("Berea", "LS-D", "District"), + new("Butha-Buthe", "LS-B", "District"), + new("Leribe", "LS-C", "District"), + new("Mafeteng", "LS-E", "District"), + new("Maseru", "LS-A", "District"), + new("Mohale's Hoek", "LS-F", "District"), + new("Mokhotlong", "LS-J", "District"), + new("Qacha's Nek", "LS-H", "District"), + new("Quthing", "LS-G", "District"), + new("Thaba-Tseka", "LS-K", "District") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLebanon() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From e3f4a25811c98608a2fe4bd99db7a5baa0ae92e1 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:28:32 +0100 Subject: [PATCH 09/20] add lebanon test --- .../Countries/LebanonTest.cs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LebanonTest.cs diff --git a/src/World.Net.UnitTests/Countries/LebanonTest.cs b/src/World.Net.UnitTests/Countries/LebanonTest.cs new file mode 100644 index 0000000..6b5cc26 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LebanonTest.cs @@ -0,0 +1,47 @@ +namespace World.Net.UnitTests.Countries +{ + public class LebanonTest : AssertCountryTestBase + { + private CountryIdentifier Id => CountryIdentifier.Lebanon; + private string Name { get; } = "Lebanon"; + private string OfficialName { get; } = "Lebanese Republic"; + private string NativeName { get; } = "الجمهورية اللبنانية"; + private string Capital { get; } = "Beirut"; + private int NumericCode { get; } = 422; + private string ISO2Code { get; } = "LB"; + private string ISO3Code { get; } = "LBN"; + private string[] CallingCode { get; } = ["+961"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + new("Akkar", "LB-AK", "Governorate"), + new("Baalbek-Hermel", "LB-BH", "Governorate"), + new("Beirut", "LB-BA", "Governorate"), + new("Beqaa", "LB-BI", "Governorate"), + new("Mount Lebanon", "LB-JL", "Governorate"), + new("Nabatieh", "LB-NA", "Governorate"), + new("North Lebanon", "LB-AS", "Governorate"), + new("South Lebanon", "LB-JA", "Governorate") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLebanon() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 841e423cd4895494274050826f3ba097424e24f7 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:56:08 +0100 Subject: [PATCH 10/20] add lithuania --- src/World.Net/Countries/Lithuania.cs | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/World.Net/Countries/Lithuania.cs diff --git a/src/World.Net/Countries/Lithuania.cs b/src/World.Net/Countries/Lithuania.cs new file mode 100644 index 0000000..db766fe --- /dev/null +++ b/src/World.Net/Countries/Lithuania.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace World.Net.Countries +{ + internal sealed class Lithuania : ICountry + { + // + public CountryIdentifier Id => CountryIdentifier.Lithuania; + + // + public string Name { get; } = "Lithuania"; + + // + public string OfficialName { get; } = "Republic of Lithuania"; + + // + public string NativeName { get; } = "Lietuvos Respublika"; + + // + public string Capital { get; } = "Vilnius"; + + // + public int NumericCode { get; } = 440; + + // + public string ISO2Code { get; } = "LT"; + + // + public string ISO3Code { get; } = "LTU"; + + // + public string[] CallingCode { get; } = ["+370"]; + + // + public IEnumerable States { get; } = + [ + new("Alytus County", "LT-AL", "County"), + new("Kaunas County", "LT-KU", "County"), + new("Klaipėda County", "LT-KL", "County"), + new("Marijampolė County", "LT-MR", "County"), + new("Panevėžys County", "LT-PN", "County"), + new("Šiauliai County", "LT-SA", "County"), + new("Tauragė County", "LT-TA", "County"), + new("Telšiai County", "LT-TE", "County"), + new("Utena County", "LT-UT", "County"), + new("Vilnius County", "LT-VL", "County") + ]; + } +} From 3a091e7c092b5b965c7096931d36efa31c64b920 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:56:20 +0100 Subject: [PATCH 11/20] add luxembourg --- src/World.Net/Countries/Luxembourg.cs | 53 +++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/World.Net/Countries/Luxembourg.cs diff --git a/src/World.Net/Countries/Luxembourg.cs b/src/World.Net/Countries/Luxembourg.cs new file mode 100644 index 0000000..59066fb --- /dev/null +++ b/src/World.Net/Countries/Luxembourg.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace World.Net.Countries +{ + internal sealed class Luxembourg : ICountry + { + // + public CountryIdentifier Id => CountryIdentifier.Luxembourg; + + // + public string Name { get; } = "Luxembourg"; + + // + public string OfficialName { get; } = "Grand Duchy of Luxembourg"; + + // + public string NativeName { get; } = "Groussherzogtum Lëtzebuerg"; + + // + public string Capital { get; } = "Luxembourg City"; + + // + public int NumericCode { get; } = 442; + + // + public string ISO2Code { get; } = "LU"; + + // + public string ISO3Code { get; } = "LUX"; + + // + public string[] CallingCode { get; } = ["+352"]; + + // + public IEnumerable States { get; } = + [ + new("Capellen", "LU-CA", "Canton"), + new("Clervaux", "LU-CL", "Canton"), + new("Diekirch", "LU-DI", "Canton"), + new("Echternach", "LU-EC", "Canton"), + new("Esch-sur-Alzette", "LU-ES", "Canton"), + new("Grevenmacher", "LU-GR", "Canton"), + new("Luxembourg", "LU-LU", "Canton"), + new("Mersch", "LU-ME", "Canton"), + new("Redange", "LU-RD", "Canton"), + new("Remich", "LU-RM", "Canton"), + new("Vianden", "LU-VD", "Canton"), + new("Wiltz", "LU-WI", "Canton") + ]; + } +} From 2ac7e4a1aae2c35a2ee5f67a26e116a193e87b8a Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:56:32 +0100 Subject: [PATCH 12/20] add Macausar --- src/World.Net/Countries/MacauSAR.cs | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/World.Net/Countries/MacauSAR.cs diff --git a/src/World.Net/Countries/MacauSAR.cs b/src/World.Net/Countries/MacauSAR.cs new file mode 100644 index 0000000..393321e --- /dev/null +++ b/src/World.Net/Countries/MacauSAR.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace World.Net.Countries +{ + internal sealed class MacauSAR : ICountry + { + /// + public CountryIdentifier Id => CountryIdentifier.MacauSAR; + + /// + public string Name { get; } = "Macau S.A.R."; + + /// + public string OfficialName { get; } = "Macao Special Administrative Region of the People's Republic of China"; + + /// + public string NativeName { get; } = "中華人民共和國澳門特別行政區"; + + /// + public string Capital { get; } = "Macau"; + + /// + public int NumericCode { get; } = 446; + + /// + public string ISO2Code { get; } = "MO"; + + /// + public string ISO3Code { get; } = "MAC"; + + /// + public string[] CallingCode { get; } = ["+853"]; + + /// + public IEnumerable States { get; } = + [ + new("Macau Peninsula", "MO-PN", "Region"), + new("Taipa", "MO-TA", "Region"), + new("Coloane", "MO-CO", "Region"), + new("Cotai", "MO-CT", "Region") + ]; + } + +} From 3dc6b6d46fe7d3ff00b154f21909839a53c5c2a0 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:56:57 +0100 Subject: [PATCH 13/20] add Madagascar --- src/World.Net/Countries/Madagascar.cs | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/World.Net/Countries/Madagascar.cs diff --git a/src/World.Net/Countries/Madagascar.cs b/src/World.Net/Countries/Madagascar.cs new file mode 100644 index 0000000..09db393 --- /dev/null +++ b/src/World.Net/Countries/Madagascar.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace World.Net.Countries +{ + internal sealed class Madagascar : ICountry + { + /// + public CountryIdentifier Id => CountryIdentifier.Madagascar; + + /// + public string Name { get; } = "Madagascar"; + + /// + public string OfficialName { get; } = "Republic of Madagascar"; + + /// + public string NativeName { get; } = "Repoblikan’i Madagasikara"; + + /// + public string Capital { get; } = "Antananarivo"; + + /// + public int NumericCode { get; } = 450; + + /// + public string ISO2Code { get; } = "MG"; + + /// + public string ISO3Code { get; } = "MDG"; + + /// + public string[] CallingCode { get; } = ["+261"]; + + /// + public IEnumerable States { get; } = + [ + new("Antananarivo", "MG-T", "Province"), + new("Antsiranana", "MG-D", "Province"), + new("Fianarantsoa", "MG-F", "Province"), + new("Mahajanga", "MG-M", "Province"), + new("Toamasina", "MG-A", "Province"), + new("Toliara", "MG-U", "Province") + ]; + } +} From abcd568a87084f1114502e2ac3363953e373e469 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:57:15 +0100 Subject: [PATCH 14/20] initalize counties --- src/World.Net/Helpers/CountryInitializer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index ee0378d..e856a5f 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -105,6 +105,10 @@ public static Dictionary Initialize() { CountryIdentifier.Liberia, new Liberia() }, { CountryIdentifier.Libya, new Libya() }, { CountryIdentifier.Liechtenstein, new Liechtenstein() }, + { CountryIdentifier.Lithuania, new Lithuania() }, + { CountryIdentifier.Luxembourg, new Luxembourg() }, + { CountryIdentifier.MacauSAR, new MacauSAR() }, + { CountryIdentifier.Madagascar, new Madagascar() }, // Future countries can be added here in the same format. }; From d9a8d15510ccc6c06cdc557f35fa8f1435201d1f Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Fri, 10 Oct 2025 13:57:31 +0100 Subject: [PATCH 15/20] add Liberia test case --- .../Countries/LiberiaTest.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LiberiaTest.cs diff --git a/src/World.Net.UnitTests/Countries/LiberiaTest.cs b/src/World.Net.UnitTests/Countries/LiberiaTest.cs new file mode 100644 index 0000000..176a815 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LiberiaTest.cs @@ -0,0 +1,54 @@ +namespace World.Net.UnitTests.Countries +{ + public class LiberiaTest : AssertCountryTestBase + { + public static CountryIdentifier Id => CountryIdentifier.Liberia; + public string Name { get; } = "Liberia"; + public string OfficialName { get; } = "Republic of Liberia"; + public string NativeName { get; } = "Republic of Liberia"; + public string Capital { get; } = "Monrovia"; + public int NumericCode { get; } = 430; + public string ISO2Code { get; } = "LR"; + public string ISO3Code { get; } = "LBR"; + public string[] CallingCode { get; } = ["+231"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + new("Bomi", "LR-BM", "County"), + new("Bong", "LR-BG", "County"), + new("Gbarpolu", "LR-GP", "County"), + new("Grand Bassa", "LR-GB", "County"), + new("Grand Cape Mount", "LR-CM", "County"), + new("Grand Gedeh", "LR-GG", "County"), + new("Grand Kru", "LR-GK", "County"), + new("Lofa", "LR-LO", "County"), + new("Margibi", "LR-MG", "County"), + new("Maryland", "LR-MY", "County"), + new("Montserrado", "LR-MO", "County"), + new("Nimba", "LR-NI", "County"), + new("River Cess", "LR-RI", "County"), + new("River Gee", "LR-RG", "County"), + new("Sinoe", "LR-SI", "County") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLebanon() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 230bfefc282a8859f7e5003b122b586c1cb3c550 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sun, 12 Oct 2025 21:16:12 +0100 Subject: [PATCH 16/20] update faroe islands test --- .../Countries/FaroeIslandsTest.cs | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs b/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs index 227c50b..cde71c8 100644 --- a/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs +++ b/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs @@ -1,7 +1,11 @@ -namespace World.Net.UnitTests.Countries; +using System.Reflection.Metadata; +using System.Xml.Linq; -public sealed class FaroeIslandsTest +namespace World.Net.UnitTests.Countries; + +public sealed class FaroeIslandsTest : AssertCountryTestBase { + private static CountryIdentifier Id => CountryIdentifier.FaroeIslands; private const string FAROEISLANDS_COUNTRY_NAME = "Faroe Islands"; private const string FAROEISLANDS_NATIVE_NAME = "Føroyar"; private const string FAROEISLANDS_CAPITAL = "Tórshavn"; @@ -10,32 +14,38 @@ public sealed class FaroeIslandsTest private const string FAROEISLANDS_ISO3_CODE = "FRO"; private const int FAROEISLANDS_NUMERIC_CODE = 234; private readonly string[] FAROEISLANDS_CALLING_CODE = ["+298"]; - private const int FAROEISLANDS_STATE_COUNT = 6; // 6 regions - private static readonly string[] VALID_STATE_TYPES = { "Region" }; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + new("Eysturoy", "FO-01", "Region"), + new("Norðoyar", "FO-02", "Region"), + new("Sandoy", "FO-03", "Region"), + new("Streymoy", "FO-04", "Region"), + new("Suðuroy", "FO-05", "Region"), + new("Vágar", "FO-06", "Region") + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForFaroeIslands() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.FaroeIslands; - // Act - var country = CountryProvider.GetCountry(existingCountryId); // Assert - Assert.NotNull(country); - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(FAROEISLANDS_COUNTRY_NAME, country.Name); - Assert.Equal(FAROEISLANDS_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(FAROEISLANDS_NATIVE_NAME, country.NativeName); - Assert.Equal(FAROEISLANDS_CAPITAL, country.Capital); - Assert.Equal(FAROEISLANDS_NUMERIC_CODE, country.NumericCode); - Assert.Equal(FAROEISLANDS_ISO2_CODE, country.ISO2Code); - Assert.Equal(FAROEISLANDS_ISO3_CODE, country.ISO3Code); - Assert.Equal(FAROEISLANDS_CALLING_CODE, country.CallingCode); - Assert.NotNull(country.States); - Assert.Equal(FAROEISLANDS_STATE_COUNT, country.States.Count()); - Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + FAROEISLANDS_COUNTRY_NAME, + FAROEISLANDS_OFFICIAL_NAME, + FAROEISLANDS_NATIVE_NAME, + FAROEISLANDS_CAPITAL, + FAROEISLANDS_NUMERIC_CODE, + FAROEISLANDS_ISO2_CODE, + FAROEISLANDS_ISO3_CODE, + FAROEISLANDS_CALLING_CODE, + States + ); } } From 606f70c332389780367e2a042c8acd0c766ab6ab Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sun, 12 Oct 2025 21:16:34 +0100 Subject: [PATCH 17/20] update fiji test --- .../Countries/FijiIslandsTest.cs | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs b/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs index 49e111e..5652b56 100644 --- a/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs +++ b/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs @@ -1,6 +1,6 @@ namespace World.Net.UnitTests.Countries; -public sealed class FijiIslandsTest +public sealed class FijiIslandsTest : AssertCountryTestBase { private const string FIJI_COUNTRY_NAME = "Fiji"; private const string FIJI_NATIVE_NAME = "Matanitu ko Viti"; @@ -10,32 +10,47 @@ public sealed class FijiIslandsTest private const string FIJI_ISO3_CODE = "FJI"; private const int FIJI_NUMERIC_CODE = 242; private readonly string[] FIJI_CALLING_CODE = ["+679"]; - private const int FIJI_STATE_COUNT = 15; // 14 provinces + 1 dependency - private static readonly string[] VALID_STATE_TYPES = { "Province", "Dependency" }; + private const CountryIdentifier ExpectedId = CountryIdentifier.FijiIslands; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + new("Ba", "FJ-01", "Province"), + new("Bua", "FJ-02", "Province"), + new("Cakaudrove", "FJ-03", "Province"), + new("Kadavu", "FJ-04", "Province"), + new("Lau", "FJ-05", "Province"), + new("Lomaiviti", "FJ-06", "Province"), + new("Macuata", "FJ-07", "Province"), + new("Nadroga-Navosa", "FJ-08", "Province"), + new("Naitasiri", "FJ-09", "Province"), + new("Namosi", "FJ-10", "Province"), + new("Ra", "FJ-11", "Province"), + new("Rewa", "FJ-12", "Province"), + new("Serua", "FJ-13", "Province"), + new("Tailevu", "FJ-14", "Province"), + new("Rotuma", "FJ-15", "Dependency") + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForFiji() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.FijiIslands; - // Act - var country = CountryProvider.GetCountry(existingCountryId); - + var country = CountryProvider.GetCountry(ExpectedId); + // Assert - Assert.NotNull(country); - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(FIJI_COUNTRY_NAME, country.Name); - Assert.Equal(FIJI_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(FIJI_NATIVE_NAME, country.NativeName); - Assert.Equal(FIJI_CAPITAL, country.Capital); - Assert.Equal(FIJI_NUMERIC_CODE, country.NumericCode); - Assert.Equal(FIJI_ISO2_CODE, country.ISO2Code); - Assert.Equal(FIJI_ISO3_CODE, country.ISO3Code); - Assert.Equal(FIJI_CALLING_CODE, country.CallingCode); - Assert.NotNull(country.States); - Assert.Equal(FIJI_STATE_COUNT, country.States.Count()); - Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + AssertCorrectInformation( + country, + ExpectedId, + FIJI_COUNTRY_NAME, + FIJI_OFFICIAL_NAME, + FIJI_NATIVE_NAME, + FIJI_CAPITAL, + FIJI_NUMERIC_CODE, + FIJI_ISO2_CODE, + FIJI_ISO3_CODE, + FIJI_CALLING_CODE, + States + ); } } From 21687835845fe2483557da0a5d371754187ff6a3 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sun, 12 Oct 2025 21:17:35 +0100 Subject: [PATCH 18/20] update france tests --- .../Countries/FranceTest.cs | 154 +++++++++++++++--- 1 file changed, 135 insertions(+), 19 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/FranceTest.cs b/src/World.Net.UnitTests/Countries/FranceTest.cs index 1fbc3b0..2b0f716 100644 --- a/src/World.Net.UnitTests/Countries/FranceTest.cs +++ b/src/World.Net.UnitTests/Countries/FranceTest.cs @@ -1,39 +1,155 @@ namespace World.Net.UnitTests.Countries; -public sealed class FranceTest +public sealed class FranceTest : AssertCountryTestBase { private const string FRANCE_NAME = "France"; - private const int FRANCE_STATE_COUNT = 116; private const string FRANCE_OFFICIAL_NAME = "French Republic"; private const string FRANCE_NATIVE_NAME = "France"; private const string FRANCE_CAPITAL = "Paris"; private const int FRANCE_NUMERIC_CODE = 250; private const string FRANCE_ISO2_CODE = "FR"; - private static readonly string[] VALID_STATE_TYPES = { "metropolitan department", "European collectivity", "metropolitan region", "dependency", "metropolitan collectivity with special status", "overseas region", "overseas collectivity", "overseas territory", "overseas region", "metropolitan department", "metropolitan department", }; private const string FRANCE_ISO3_CODE = "FRA"; private readonly string[] FRANCE_CALLING_CODE = ["+33"]; - + private const CountryIdentifier ExpectedId = CountryIdentifier.France; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + new("Ain", "FR-01", "metropolitan department"), + new("Aisne", "FR-02", "metropolitan department"), + new("Allier", "FR-03", "metropolitan department"), + new("Alpes-de-Haute-Provence", "FR-04", "metropolitan department"), + new("Alpes-Maritimes", "FR-06", "metropolitan department"), + new("Alsace", "FR-6AE", "European collectivity"), + new("Ardèche", "FR-07", "metropolitan department"), + new("Ardennes", "FR-08", "metropolitan department"), + new("Ariège", "FR-09", "metropolitan department"), + new("Aube", "FR-10", "metropolitan department"), + new("Aude", "FR-11", "metropolitan department"), + new("Auvergne-Rhône-Alpes", "FR-ARA", "metropolitan region"), + new("Aveyron", "FR-12", "metropolitan department"), + new("Bas-Rhin", "FR-67", "metropolitan department"), + new("Bouches-du-Rhône", "FR-13", "metropolitan department"), + new("Bourgogne-Franche-Comté", "FR-BFC", "metropolitan region"), + new("Bretagne", "FR-BRE", "metropolitan region"), + new("Calvados", "FR-14", "metropolitan department"), + new("Cantal", "FR-15", "metropolitan department"), + new("Centre-Val de Loire", "FR-CVL", "metropolitan region"), + new("Charente", "FR-16", "metropolitan department"), + new("Charente-Maritime", "FR-17", "metropolitan department"), + new("Cher", "FR-18", "metropolitan department"), + new("Clipperton", "FR-CP", "dependency"), + new("Corrèze", "FR-19", "metropolitan department"), + new("Corse", "FR-20R", "metropolitan collectivity with special status"), + new("Corse-du-Sud", "FR-2A", "metropolitan department"), + new("Côte-d'Or", "FR-21", "metropolitan department"), + new("Côtes-d'Armor", "FR-22", "metropolitan department"), + new("Creuse", "FR-23", "metropolitan department"), + new("Deux-Sèvres", "FR-79", "metropolitan department"), + new("Dordogne", "FR-24", "metropolitan department"), + new("Doubs", "FR-25", "metropolitan department"), + new("Drôme", "FR-26", "metropolitan department"), + new("Essonne", "FR-91", "metropolitan department"), + new("Eure", "FR-27", "metropolitan department"), + new("Eure-et-Loir", "FR-28", "metropolitan department"), + new("Finistère", "FR-29", "metropolitan department"), + new("French Guiana", "FR-973", "overseas region"), + new("French Polynesia", "FR-PF", "overseas collectivity"), + new("French Southern and Antarctic Lands", "FR-TF", "overseas territory"), + new("Gard", "FR-30", "metropolitan department"), + new("Gers", "FR-32", "metropolitan department"), + new("Gironde", "FR-33", "metropolitan department"), + new("Grand-Est", "FR-GES", "metropolitan region"), + new("Guadeloupe", "FR-971", "overseas region"), + new("Haut-Rhin", "FR-68", "metropolitan department"), + new("Haute-Corse", "FR-2B", "metropolitan department"), + new("Haute-Garonne", "FR-31", "metropolitan department"), + new("Haute-Loire", "FR-43", "metropolitan department"), + new("Haute-Marne", "FR-52", "metropolitan department"), + new("Haute-Saône", "FR-70", "metropolitan department"), + new("Haute-Savoie", "FR-74", "metropolitan department"), + new("Haute-Vienne", "FR-87", "metropolitan department"), + new("Hautes-Alpes", "FR-05", "metropolitan department"), + new("Hautes-Pyrénées", "FR-65", "metropolitan department"), + new("Hauts-de-France", "FR-HDF", "metropolitan region"), + new("Hauts-de-Seine", "FR-92", "metropolitan department"), + new("Hérault", "FR-34", "metropolitan department"), + new("Île-de-France", "FR-IDF", "metropolitan region"), + new("Ille-et-Vilaine", "FR-35", "metropolitan department"), + new("Indre", "FR-36", "metropolitan department"), + new("Indre-et-Loire", "FR-37", "metropolitan department"), + new("Isère", "FR-38", "metropolitan department"), + new("Jura", "FR-39", "metropolitan department"), + new("La Réunion", "FR-974", "overseas region"), + new("Landes", "FR-40", "metropolitan department"), + new("Loir-et-Cher", "FR-41", "metropolitan department"), + new("Loire", "FR-42", "metropolitan department"), + new("Loire-Atlantique", "FR-44", "metropolitan department"), + new("Loiret", "FR-45", "metropolitan department"), + new("Lot", "FR-46", "metropolitan department"), + new("Lot-et-Garonne", "FR-47", "metropolitan department"), + new("Lozère", "FR-48", "metropolitan department"), + new("Maine-et-Loire", "FR-49", "metropolitan department"), + new("Manche", "FR-50", "metropolitan department"), + new("Marne", "FR-51", "metropolitan department"), + new("Martinique", "FR-972", "overseas region"), + new("Mayenne", "FR-53", "metropolitan department"), + new("Mayotte", "FR-976", "overseas region"), + new("Métropole de Lyon", "FR-69M", "metropolitan department"), + new("Meurthe-et-Moselle", "FR-54", "metropolitan department"), + new("Meuse", "FR-55", "metropolitan department"), + new("Morbihan", "FR-56", "metropolitan department"), + new("Moselle", "FR-57", "metropolitan department"), + new("Nièvre", "FR-58", "metropolitan department"), + new("Nord", "FR-59", "metropolitan department"), + new("Oise", "FR-60", "metropolitan department"), + new("Oléron", "FR-OL", "dependency"), + new("Orne", "FR-61", "metropolitan department"), + new("Paris", "FR-75", "metropolitan department"), + new("Pas-de-Calais", "FR-62", "metropolitan department"), + new("Puy-de-Dôme", "FR-63", "metropolitan department"), + new("Pyrénées-Atlantiques", "FR-64", "metropolitan department"), + new("Pyrénées-Orientales", "FR-66", "metropolitan department"), + new("Réunion", "FR-974", "overseas region"), + new("Rhône", "FR-69", "metropolitan department"), + new("Saône-et-Loire", "FR-71", "metropolitan department"), + new("Sarthe", "FR-72", "metropolitan department"), + new("Savoie", "FR-73", "metropolitan department"), + new("Seine-et-Marne", "FR-77", "metropolitan department"), + new("Seine-Maritime", "FR-76", "metropolitan department"), + new("Yvelines", "FR-78", "metropolitan department"), + new("Somme", "FR-80", "metropolitan department"), + new("Tarn", "FR-81", "metropolitan department"), + new("Tarn-et-Garonne", "FR-82", "metropolitan department"), + new("Territoire de Belfort", "FR-90", "metropolitan department"), + new("Val-de-Marne", "FR-94", "metropolitan department"), + new("Val-d'Oise", "FR-95", "metropolitan department"), + new("Var", "FR-83", "metropolitan department"), + new("Vaucluse", "FR-84", "metropolitan department"), + new("Vendée", "FR-85", "metropolitan department"), + new("Vienne", "FR-86", "metropolitan department"), + new("Vosges", "FR-88", "metropolitan department"), + new("Yonne", "FR-89", "metropolitan department"), + new("Yvelines", "FR-78", "metropolitan department") + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForFrance() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.France; - // Act - var country = CountryProvider.GetCountry(existingCountryId); + var country = CountryProvider.GetCountry(ExpectedId); //Assert - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(FRANCE_NAME, country.Name); - Assert.NotNull(country.States); - Assert.Equal(FRANCE_STATE_COUNT, country.States.Count()); - Assert.Equal(FRANCE_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(FRANCE_NATIVE_NAME, country.NativeName); - Assert.Equal(FRANCE_CAPITAL, country.Capital); - Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); - Assert.Equal(FRANCE_NUMERIC_CODE, country.NumericCode); - Assert.Equal(FRANCE_ISO2_CODE, country.ISO2Code); - Assert.Equal(FRANCE_ISO3_CODE, country.ISO3Code); - Assert.Equal(FRANCE_CALLING_CODE, country.CallingCode); + AssertCorrectInformation( + country, + ExpectedId, + FRANCE_NAME, + FRANCE_OFFICIAL_NAME, + FRANCE_NATIVE_NAME, + FRANCE_CAPITAL, + FRANCE_NUMERIC_CODE, + FRANCE_ISO2_CODE, + FRANCE_ISO3_CODE, + FRANCE_CALLING_CODE, + ExpectedStates + ); } } From 2da255d5c4a330de7b02ea3e231ae224c9188adf Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sun, 12 Oct 2025 21:17:57 +0100 Subject: [PATCH 19/20] french guiana tests --- .../Countries/FrenchGuianaTest.cs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/FrenchGuianaTest.cs b/src/World.Net.UnitTests/Countries/FrenchGuianaTest.cs index 5ac1398..b77a1a4 100644 --- a/src/World.Net.UnitTests/Countries/FrenchGuianaTest.cs +++ b/src/World.Net.UnitTests/Countries/FrenchGuianaTest.cs @@ -1,5 +1,5 @@ namespace World.Net.UnitTests.Countries; -public sealed class FrenchGuianaTest +public sealed class FrenchGuianaTest : AssertCountryTestBase { private const string FRENCH_GUIANA_NAME = "French Guiana"; private const string FRENCH_GUIANA_OFFICIAL_NAME = "Guyane française"; @@ -9,28 +9,31 @@ public sealed class FrenchGuianaTest private const string FRENCH_GUIANA_ISO2_CODE = "GF"; private const string FRENCH_GUIANA_ISO3_CODE = "GUF"; private readonly string[] FRENCH_GUIANA_CALLING_CODE = ["+594"]; - + private const CountryIdentifier ExpectedId = CountryIdentifier.FrenchGuiana; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForFrench_Guiana() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.FrenchGuiana; - // Act - var country = CountryProvider.GetCountry(existingCountryId); + var country = CountryProvider.GetCountry(ExpectedId); //Assert - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(FRENCH_GUIANA_NAME, country.Name); - Assert.NotNull(country.States); - Assert.Empty(country.States); - Assert.Equal(FRENCH_GUIANA_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(FRENCH_GUIANA_NATIVE_NAME, country.NativeName); - Assert.Equal(FRENCH_GUIANA_CAPITAL, country.Capital); - Assert.Equal(FRENCH_GUIANA_NUMERIC_CODE, country.NumericCode); - Assert.Equal(FRENCH_GUIANA_ISO2_CODE, country.ISO2Code); - Assert.Equal(FRENCH_GUIANA_ISO3_CODE, country.ISO3Code); - Assert.Equal(FRENCH_GUIANA_CALLING_CODE, country.CallingCode); + AssertCorrectInformation( + country, + ExpectedId, + FRENCH_GUIANA_NAME, + FRENCH_GUIANA_OFFICIAL_NAME, + FRENCH_GUIANA_NATIVE_NAME, + FRENCH_GUIANA_CAPITAL, + FRENCH_GUIANA_NUMERIC_CODE, + FRENCH_GUIANA_ISO2_CODE, + FRENCH_GUIANA_ISO3_CODE, + FRENCH_GUIANA_CALLING_CODE, + ExpectedStates + ); } } From 74231932225ceeb48c5e7b9da6bfe56d8f92d43b Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Sun, 12 Oct 2025 21:20:28 +0100 Subject: [PATCH 20/20] add french polynesia test --- .../Countries/FrenchPolynesiaTest.cs | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/FrenchPolynesiaTest.cs b/src/World.Net.UnitTests/Countries/FrenchPolynesiaTest.cs index ae83044..25dd97b 100644 --- a/src/World.Net.UnitTests/Countries/FrenchPolynesiaTest.cs +++ b/src/World.Net.UnitTests/Countries/FrenchPolynesiaTest.cs @@ -1,39 +1,44 @@ namespace World.Net.UnitTests.Countries; -public sealed class FrenchPolynesiaTest +public sealed class FrenchPolynesiaTest : AssertCountryTestBase { private const string FRENCH_POLYNESIA_NAME = "French Polynesia"; - private const int FRENCH_POLYNESIA_STATE_COUNT = 5; private const string FRENCH_POLYNESIA_OFFICIAL_NAME = "Polynésie française"; private const string FRENCH_POLYNESIA_NATIVE_NAME = "Polynésie française"; private const string FRENCH_POLYNESIA_CAPITAL = "Papeete"; private const int FRENCH_POLYNESIA_NUMERIC_CODE = 258; private const string FRENCH_POLYNESIA_ISO2_CODE = "PF"; private const string FRENCH_POLYNESIA_ISO3_CODE = "PYF"; - private static readonly string[] VALID_STATE_TYPES = { "division" }; private readonly string[] FRENCH_POLYNESIA_CALLING_CODE = ["+689"]; - + private const CountryIdentifier ExpectedId = CountryIdentifier.FrenchPolynesia; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = [ + ("N'Austral Islands", "PF-01", "division"), + ("Leeward Islands", "PF-02", "division"), + ("Marquesas Islands", "PF-03", "division"), + ("Tuamotu-Gambier", "PF-04", "division"), + ("Windward Islands", "PF-05", "division"), + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForFrench_Polynesia() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.FrenchPolynesia; - // Act - var country = CountryProvider.GetCountry(existingCountryId); + var country = CountryProvider.GetCountry(ExpectedId); //Assert - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(FRENCH_POLYNESIA_NAME, country.Name); - Assert.NotNull(country.States); - Assert.Equal(FRENCH_POLYNESIA_STATE_COUNT, country.States.Count()); - Assert.Equal(FRENCH_POLYNESIA_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(FRENCH_POLYNESIA_NATIVE_NAME, country.NativeName); - Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); - Assert.Equal(FRENCH_POLYNESIA_CAPITAL, country.Capital); - Assert.Equal(FRENCH_POLYNESIA_NUMERIC_CODE, country.NumericCode); - Assert.Equal(FRENCH_POLYNESIA_ISO2_CODE, country.ISO2Code); - Assert.Equal(FRENCH_POLYNESIA_ISO3_CODE, country.ISO3Code); - Assert.Equal(FRENCH_POLYNESIA_CALLING_CODE, country.CallingCode); + + AssertCorrectInformation( + country, + ExpectedId, + FRENCH_POLYNESIA_NAME, + FRENCH_POLYNESIA_OFFICIAL_NAME, + FRENCH_POLYNESIA_NATIVE_NAME, + FRENCH_POLYNESIA_CAPITAL, + FRENCH_POLYNESIA_NUMERIC_CODE, + FRENCH_POLYNESIA_ISO2_CODE, + FRENCH_POLYNESIA_ISO3_CODE, + FRENCH_POLYNESIA_CALLING_CODE, + ExpectedStates + ); } }