From 02d22743f40a8ccd01638fcb1b61b7062478d3af Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 9 Oct 2025 22:17:20 +0100 Subject: [PATCH 01/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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/31] 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 + ); } } From 520cc2e389c9833adc4681149aa94218aaa170b0 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Mon, 13 Oct 2025 06:24:04 +0100 Subject: [PATCH 21/31] update timorleste tests --- .../Countries/TimorLesteTest.cs | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/TimorLesteTest.cs b/src/World.Net.UnitTests/Countries/TimorLesteTest.cs index d65fb2e..0a3866c 100644 --- a/src/World.Net.UnitTests/Countries/TimorLesteTest.cs +++ b/src/World.Net.UnitTests/Countries/TimorLesteTest.cs @@ -1,6 +1,6 @@ namespace World.Net.UnitTests.Countries; -public sealed class TimorLesteTest +public sealed class TimorLesteTest : AssertCountryTestBase { private const string TIMORLESTE_COUNTRY_NAME = "Timor-Leste"; private const string TIMORLESTE_NATIVE_NAME = "Repúblika Demokrátika Timór-Leste"; @@ -12,29 +12,46 @@ public sealed class TimorLesteTest private readonly string[] TIMORLESTE_CALLING_CODE = ["+670"]; private const int TIMORLESTE_STATE_COUNT = 13; // 12 municipalities + 1 special administrative region private static readonly string[] VALID_STATE_TYPES = { "Municipality", "Special Administrative Region" }; + private const CountryIdentifier ExpectedId = CountryIdentifier.TimorLeste; + private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Aileu", "TL-AL", "Municipality"), + ("Ainaro", "TL-AN", "Municipality"), + ("Baucau", "TL-BA", "Municipality"), + ("Bobonaro", "TL-BO", "Municipality"), + ("Cova Lima", "TL-CO", "Municipality"), + ("Dili", "TL-DI", "Municipality"), + ("Ermera", "TL-ER", "Municipality"), + ("Lautém", "TL-LA", "Municipality"), + ("Liquiça", "TL-LI", "Municipality"), + ("Manatuto", "TL-MT", "Municipality"), + ("Manufahi", "TL-MF", "Municipality"), + ("Viqueque", "TL-VI", "Municipality"), + ("Oecusse", "TL-OE", "Special Administrative Region") + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForTimorLeste() { - // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.TimorLeste; - // Act - var country = CountryProvider.GetCountry(existingCountryId); + var country = CountryProvider.GetCountry(ExpectedId); // Assert - Assert.NotNull(country); - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(TIMORLESTE_COUNTRY_NAME, country.Name); - Assert.Equal(TIMORLESTE_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(TIMORLESTE_NATIVE_NAME, country.NativeName); - Assert.Equal(TIMORLESTE_CAPITAL, country.Capital); - Assert.Equal(TIMORLESTE_NUMERIC_CODE, country.NumericCode); - Assert.Equal(TIMORLESTE_ISO2_CODE, country.ISO2Code); - Assert.Equal(TIMORLESTE_ISO3_CODE, country.ISO3Code); - Assert.Equal(TIMORLESTE_CALLING_CODE, country.CallingCode); - Assert.NotNull(country.States); Assert.Equal(TIMORLESTE_STATE_COUNT, country.States.Count()); Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + + AssertCorrectInformation( + country, + ExpectedId, + TIMORLESTE_COUNTRY_NAME, + TIMORLESTE_OFFICIAL_NAME, + TIMORLESTE_NATIVE_NAME, + TIMORLESTE_CAPITAL, + TIMORLESTE_NUMERIC_CODE, + TIMORLESTE_ISO2_CODE, + TIMORLESTE_ISO3_CODE, + TIMORLESTE_CALLING_CODE, + ExpectedStates + ); } } From 96d38a549349829b290f314290a18bd059690c51 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Mon, 13 Oct 2025 19:05:08 +0100 Subject: [PATCH 22/31] update bahamas test --- .../Countries/TheBahamasTest.cs | 77 +++++++++++++++---- 1 file changed, 62 insertions(+), 15 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/TheBahamasTest.cs b/src/World.Net.UnitTests/Countries/TheBahamasTest.cs index 17be8bf..4ab4ac0 100644 --- a/src/World.Net.UnitTests/Countries/TheBahamasTest.cs +++ b/src/World.Net.UnitTests/Countries/TheBahamasTest.cs @@ -1,6 +1,6 @@ namespace World.Net.UnitTests.Countries; -public sealed class TheBahamasTest +public sealed class TheBahamasTest : AssertCountryTestBase { private const string THEBAHAMAS_COUNTRY_NAME = "The Bahamas"; private const string THEBAHAMAS_NATIVE_NAME = "Bahamas"; @@ -12,29 +12,76 @@ public sealed class TheBahamasTest private readonly string[] THEBAHAMAS_CALLING_CODE = ["+1 242"]; private const int THEBAHAMAS_STATE_COUNT = 42; private static readonly string[] VALID_STATE_TYPES = { "District", "Island" }; + private const CountryIdentifier ExpectedId = CountryIdentifier.Bahamas; + private readonly static (string Name, string IsoCode, string Type)[] ExpectedStates = + [ + ("Acklins", "AK", "District"), + ("Acklins and Crooked Islands", "AC", "District"), + ("Berry Islands", "BY", "District"), + ("Bimini", "BI", "District"), + ("Black Point", "BP", "District"), + ("Cat Island", "CI", "District"), + ("Central Abaco", "CO", "District"), + ("Central Andros", "CS", "District"), + ("Central Eleuthera", "CE", "District"), + ("Crooked Island", "CK", "District"), + ("East Grand Bahama", "EG", "District"), + ("Exuma", "EX", "District"), + ("Freeport", "FP", "District"), + ("Fresh Creek", "FC", "District"), + ("Governor’s Harbour", "GH", "District"), + ("Grand Cay", "GC", "District"), + ("Green Turtle Cay", "GT", "District"), + ("Harbour Island", "HI", "District"), + ("High Rock", "HR", "District"), + ("Hope Town", "HT", "District"), + ("Inagua", "IN", "District"), + ("Kemps Bay", "KB", "District"), + ("Long Island", "LI", "District"), + ("Mangrove Cay", "MC", "District"), + ("Marsh Harbour", "MH", "District"), + ("Mayaguana", "MG", "District"), + ("New Providence", "NP", "Island"), + ("Nichollstown and Berry Islands", "NB", "District"), + ("North Abaco", "NO", "District"), + ("North Andros", "NS", "District"), + ("North Eleuthera", "NE", "District"), + ("Ragged Island", "RI", "District"), + ("Rock Sound", "RS", "District"), + ("Rum Cay", "RC", "District"), + ("San Salvador and Rum Cay", "SR", "District"), + ("San Salvador Island", "SS", "District"), + ("Sandy Point", "SP", "District"), + ("South Abaco", "SO", "District"), + ("South Andros", "SA", "District"), + ("South Eleuthera", "SE", "District"), + ("Spanish Wells", "SW", "District"), + ("West Grand Bahama", "WG", "District") + ]; [Fact] public void GetCountry_ReturnsCorrectInformation_ForTheBahamas() { // Arrange - CountryIdentifier existingCountryId = CountryIdentifier.Bahamas; - // Act - var country = CountryProvider.GetCountry(existingCountryId); + var country = CountryProvider.GetCountry(ExpectedId); // Assert - Assert.NotNull(country); - Assert.Equal(existingCountryId, country.Id); - Assert.Equal(THEBAHAMAS_COUNTRY_NAME, country.Name); - Assert.Equal(THEBAHAMAS_OFFICIAL_NAME, country.OfficialName); - Assert.Equal(THEBAHAMAS_NATIVE_NAME, country.NativeName); - Assert.Equal(THEBAHAMAS_CAPITAL, country.Capital); - Assert.Equal(THEBAHAMAS_NUMERIC_CODE, country.NumericCode); - Assert.Equal(THEBAHAMAS_ISO2_CODE, country.ISO2Code); - Assert.Equal(THEBAHAMAS_ISO3_CODE, country.ISO3Code); - Assert.Equal(THEBAHAMAS_CALLING_CODE, country.CallingCode); - Assert.NotNull(country.States); Assert.Equal(THEBAHAMAS_STATE_COUNT, country.States.Count()); Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + + AssertCorrectInformation( + country, + ExpectedId, + THEBAHAMAS_COUNTRY_NAME, + THEBAHAMAS_OFFICIAL_NAME, + THEBAHAMAS_NATIVE_NAME, + THEBAHAMAS_CAPITAL, + THEBAHAMAS_NUMERIC_CODE, + THEBAHAMAS_ISO2_CODE, + THEBAHAMAS_ISO3_CODE, + THEBAHAMAS_CALLING_CODE, + ExpectedStates + ); } } From a3143f8947c7381eea885c23c8665d94ba06f211 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Mon, 13 Oct 2025 19:05:27 +0100 Subject: [PATCH 23/31] update madagascar test --- .../Countries/MadagascarTest.cs | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/MadagascarTest.cs diff --git a/src/World.Net.UnitTests/Countries/MadagascarTest.cs b/src/World.Net.UnitTests/Countries/MadagascarTest.cs new file mode 100644 index 0000000..77360a9 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MadagascarTest.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 class MadagascarTest : AssertCountryTestBase + { + public static 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"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + 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") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMadagascar() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 77428104baf994483992601cfd35cf58f83a39ac Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Mon, 13 Oct 2025 19:07:22 +0100 Subject: [PATCH 24/31] update macau sar test --- .../Countries/MacauSARTest.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/MacauSARTest.cs diff --git a/src/World.Net.UnitTests/Countries/MacauSARTest.cs b/src/World.Net.UnitTests/Countries/MacauSARTest.cs new file mode 100644 index 0000000..ae06448 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/MacauSARTest.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public class MacauSARTest : AssertCountryTestBase + { + public static 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"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + new("Macau Peninsula", "MO-PN", "Region"), + new("Taipa", "MO-TA", "Region"), + new("Coloane", "MO-CO", "Region"), + new("Cotai", "MO-CT", "Region") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForMacauSAR() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 43d559f6c95ccdb8380d46b17c7240ad921696e7 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Tue, 14 Oct 2025 23:45:09 +0100 Subject: [PATCH 25/31] add luxembourge test case --- .../Countries/LuxembourgTest.cs | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LuxembourgTest.cs diff --git a/src/World.Net.UnitTests/Countries/LuxembourgTest.cs b/src/World.Net.UnitTests/Countries/LuxembourgTest.cs new file mode 100644 index 0000000..f280c2d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LuxembourgTest.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public class LuxembourgTest : AssertCountryTestBase + { + public static 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"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + 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") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLuxembourg() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 08b694dd31d46ff6d052cfedd49efc7d39a39e90 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Tue, 14 Oct 2025 23:45:29 +0100 Subject: [PATCH 26/31] add Lithuania --- .../Countries/LithuaniaTest.cs | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LithuaniaTest.cs diff --git a/src/World.Net.UnitTests/Countries/LithuaniaTest.cs b/src/World.Net.UnitTests/Countries/LithuaniaTest.cs new file mode 100644 index 0000000..1c561b1 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LithuaniaTest.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public class LithuaniaTest : AssertCountryTestBase + { + public static 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"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + 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") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLithuania() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 93845db2cd867eacc51408126ac289a26092e6f4 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Tue, 14 Oct 2025 23:45:53 +0100 Subject: [PATCH 27/31] add Liechtenstein --- .../Countries/LiechtensteinTest.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LiechtensteinTest.cs diff --git a/src/World.Net.UnitTests/Countries/LiechtensteinTest.cs b/src/World.Net.UnitTests/Countries/LiechtensteinTest.cs new file mode 100644 index 0000000..96370d9 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LiechtensteinTest.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace World.Net.UnitTests.Countries +{ + public sealed class LiechtensteinTest : AssertCountryTestBase + { + public static 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"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + 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") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLiechtenstein() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 2c6dd33d1f39af9e66dbc56d8350475e5278ff88 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Wed, 15 Oct 2025 22:26:16 +0100 Subject: [PATCH 28/31] add Libya tests --- .../Countries/LibyaTest.cs | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/World.Net.UnitTests/Countries/LibyaTest.cs diff --git a/src/World.Net.UnitTests/Countries/LibyaTest.cs b/src/World.Net.UnitTests/Countries/LibyaTest.cs new file mode 100644 index 0000000..24e71d3 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/LibyaTest.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 class LibyaTest : AssertCountryTestBase + { + public static 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"]; + private static readonly (string Name, string IsoCode, string Type)[] States = + [ + 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") + ]; + + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForLibya() + { + var country = CountryProvider.GetCountry(Id); + + AssertCorrectInformation( + country, + Id, + Name, + OfficialName, + NativeName, + Capital, + NumericCode, + ISO2Code, + ISO3Code, + CallingCode, + States + ); + } + } +} From 7fbc7ab4165cb12486bc428afb22b07254c62816 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Wed, 15 Oct 2025 22:26:28 +0100 Subject: [PATCH 29/31] update latvia test --- src/World.Net.UnitTests/Countries/LatviaTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/World.Net.UnitTests/Countries/LatviaTests.cs b/src/World.Net.UnitTests/Countries/LatviaTests.cs index e3b04c4..75d7a00 100644 --- a/src/World.Net.UnitTests/Countries/LatviaTests.cs +++ b/src/World.Net.UnitTests/Countries/LatviaTests.cs @@ -53,7 +53,7 @@ private static readonly (string Name, string IsoCode, string Type)[] ExpectedSta [Fact] - public void GetCountry_ReturnsCorrectInformation_ForLaos() + public void GetCountry_ReturnsCorrectInformation_ForLatvia() { var country = CountryProvider.GetCountry(ExpectedId); From f3c10860532aa3c29c138bc5a5640faf4b2de9e3 Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Wed, 15 Oct 2025 22:26:49 +0100 Subject: [PATCH 30/31] update Laos tests --- src/World.Net.UnitTests/Countries/LaosTest.cs | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/LaosTest.cs b/src/World.Net.UnitTests/Countries/LaosTest.cs index be4dbbc..77cc216 100644 --- a/src/World.Net.UnitTests/Countries/LaosTest.cs +++ b/src/World.Net.UnitTests/Countries/LaosTest.cs @@ -1,6 +1,6 @@ namespace World.Net.UnitTests.Countries { - public class LaosTest + public class LaosTest : AssertCountryTestBase { private const CountryIdentifier ExpectedId = CountryIdentifier.Laos; private const string ExpectedName = "Laos"; @@ -38,24 +38,20 @@ private static readonly (string Name, string IsoCode, string Type)[] ExpectedSta public void GetCountry_ReturnsCorrectInformation_ForLaos() { var country = CountryProvider.GetCountry(ExpectedId); - Assert.Equal(ExpectedId, country.Id); - Assert.Equal(ExpectedName, country.Name); - Assert.Equal(ExpectedOfficialName, country.OfficialName); - Assert.Equal(ExpectedNativeName, country.NativeName); - Assert.Equal(ExpectedCapital, country.Capital); - Assert.Equal(ExpectedNumericCode, country.NumericCode); - Assert.Equal(ExpectedISO2Code, country.ISO2Code); - Assert.Equal(ExpectedISO3Code, country.ISO3Code); - Assert.Equal(ExpectedCallingCode, country.CallingCode); - var states = country.States.ToArray(); - Assert.Equal(ExpectedStates.Length, states.Length); - for (int i = 0; i < states.Length; i++) - { - Assert.Equal(ExpectedStates[i].Name, states[i].Name); - Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode); - Assert.Equal(ExpectedStates[i].Type, states[i].Type); - } + AssertCorrectInformation( + country, + ExpectedId, + ExpectedName, + ExpectedOfficialName, + ExpectedNativeName, + ExpectedCapital, + ExpectedNumericCode, + ExpectedISO2Code, + ExpectedISO3Code, + ExpectedCallingCode, + ExpectedStates + ); } } } From 1b7fac124f2e7d2ad9bbd99180178209f93b2d6d Mon Sep 17 00:00:00 2001 From: Raphael Anyanwu Date: Thu, 16 Oct 2025 08:05:51 +0100 Subject: [PATCH 31/31] update test for Kyrgyzstan --- .../Countries/KyrgyzstanTest.cs | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs index 71b958a..68755c6 100644 --- a/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs +++ b/src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs @@ -1,11 +1,6 @@ -using World.Net; -using World.Net.Countries; -using World.Net.Helpers; -using Xunit; - -namespace World.Net.UnitTests.Countries +namespace World.Net.UnitTests.Countries { - public class KyrgyzstanTest + public class KyrgyzstanTest : AssertCountryTestBase { private const CountryIdentifier ExpectedId = CountryIdentifier.Kyrgyzstan; private const string ExpectedName = "Kyrgyzstan"; @@ -33,24 +28,20 @@ private static readonly (string Name, string IsoCode, string Type)[] ExpectedSta public void GetCountry_ReturnsCorrectInformation_ForKyrgyzstan() { var country = CountryProvider.GetCountry(ExpectedId); - Assert.Equal(ExpectedId, country.Id); - Assert.Equal(ExpectedName, country.Name); - Assert.Equal(ExpectedOfficialName, country.OfficialName); - Assert.Equal(ExpectedNativeName, country.NativeName); - Assert.Equal(ExpectedCapital, country.Capital); - Assert.Equal(ExpectedNumericCode, country.NumericCode); - Assert.Equal(ExpectedISO2Code, country.ISO2Code); - Assert.Equal(ExpectedISO3Code, country.ISO3Code); - Assert.Equal(ExpectedCallingCode, country.CallingCode); - var states = country.States.ToArray(); - Assert.Equal(ExpectedStates.Length, states.Length); - for (int i = 0; i < states.Length; i++) - { - Assert.Equal(ExpectedStates[i].Name, states[i].Name); - Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode); - Assert.Equal(ExpectedStates[i].Type, states[i].Type); - } + AssertCorrectInformation( + country, + ExpectedId, + ExpectedName, + ExpectedOfficialName, + ExpectedNativeName, + ExpectedCapital, + ExpectedNumericCode, + ExpectedISO2Code, + ExpectedISO3Code, + ExpectedCallingCode, + ExpectedStates + ); } } }