diff --git a/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs b/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs new file mode 100644 index 0000000..227c50b --- /dev/null +++ b/src/World.Net.UnitTests/Countries/FaroeIslandsTest.cs @@ -0,0 +1,42 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class FaroeIslandsTest +{ + private const string FAROEISLANDS_COUNTRY_NAME = "Faroe Islands"; + private const string FAROEISLANDS_NATIVE_NAME = "Føroyar"; + private const string FAROEISLANDS_CAPITAL = "Tórshavn"; + private const string FAROEISLANDS_OFFICIAL_NAME = "Faroe Islands"; + private const string FAROEISLANDS_ISO2_CODE = "FO"; + 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" }; + + [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)); + } +} + + diff --git a/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs b/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs new file mode 100644 index 0000000..49e111e --- /dev/null +++ b/src/World.Net.UnitTests/Countries/FijiIslandsTest.cs @@ -0,0 +1,42 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class FijiIslandsTest +{ + private const string FIJI_COUNTRY_NAME = "Fiji"; + private const string FIJI_NATIVE_NAME = "Matanitu ko Viti"; + private const string FIJI_CAPITAL = "Suva"; + private const string FIJI_OFFICIAL_NAME = "Republic of Fiji"; + private const string FIJI_ISO2_CODE = "FJ"; + 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" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForFiji() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.FijiIslands; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // 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)); + } +} + + diff --git a/src/World.Net.UnitTests/Countries/FinlandTest.cs b/src/World.Net.UnitTests/Countries/FinlandTest.cs new file mode 100644 index 0000000..3b223c5 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/FinlandTest.cs @@ -0,0 +1,41 @@ +namespace World.Net.UnitTests.Countries; + +public sealed class FinlandTest +{ + private const string FINLAND_COUNTRY_NAME = "Finland"; + private const string FINLAND_NATIVE_NAME = "Suomen tasavalta / Republiken Finland"; + private const string FINLAND_CAPITAL = "Helsinki"; + private const string FINLAND_OFFICIAL_NAME = "Republic of Finland"; + private const string FINLAND_ISO2_CODE = "FI"; + private const string FINLAND_ISO3_CODE = "FIN"; + private const int FINLAND_NUMERIC_CODE = 246; + private readonly string[] FINLAND_CALLING_CODE = ["+358"]; + private const int FINLAND_STATE_COUNT = 21; + private static readonly string[] VALID_STATE_TYPES = { "Region" }; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForFinland() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Finland; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.NotNull(country); + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(FINLAND_COUNTRY_NAME, country.Name); + Assert.Equal(FINLAND_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(FINLAND_NATIVE_NAME, country.NativeName); + Assert.Equal(FINLAND_CAPITAL, country.Capital); + Assert.Equal(FINLAND_NUMERIC_CODE, country.NumericCode); + Assert.Equal(FINLAND_ISO2_CODE, country.ISO2Code); + Assert.Equal(FINLAND_ISO3_CODE, country.ISO3Code); + Assert.Equal(FINLAND_CALLING_CODE, country.CallingCode); + Assert.NotNull(country.States); + Assert.Equal(FINLAND_STATE_COUNT, country.States.Count()); + Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES)); + } +} + diff --git a/src/World.Net/Countries/FaroeIslands.cs b/src/World.Net/Countries/FaroeIslands.cs new file mode 100644 index 0000000..0d6d47c --- /dev/null +++ b/src/World.Net/Countries/FaroeIslands.cs @@ -0,0 +1,42 @@ +namespace World.Net.Countries; + +internal sealed class FaroeIslands : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.FaroeIslands; + + // + public string Name { get; } = "Faroe Islands"; + + // + public string OfficialName { get; } = "Faroe Islands"; + + // + public string NativeName => "Føroyar"; + + // + public string Capital { get; } = "Tórshavn"; + + // + public int NumericCode { get; } = 234; + + // + public string ISO2Code { get; } = "FO"; + + // + public string ISO3Code { get; } = "FRO"; + + // + public string[] CallingCode { get; } = ["+298"]; + + // + public IEnumerable 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") + ]; +} diff --git a/src/World.Net/Countries/FijiIslands.cs b/src/World.Net/Countries/FijiIslands.cs new file mode 100644 index 0000000..0a22236 --- /dev/null +++ b/src/World.Net/Countries/FijiIslands.cs @@ -0,0 +1,51 @@ +namespace World.Net.Countries; + +internal sealed class FijiIslands : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.FijiIslands; + + // + public string Name { get; } = "Fiji"; + + // + public string OfficialName { get; } = "Republic of Fiji"; + + // + public string NativeName => "Matanitu ko Viti"; + + // + public string Capital { get; } = "Suva"; + + // + public int NumericCode { get; } = 242; + + // + public string ISO2Code { get; } = "FJ"; + + // + public string ISO3Code { get; } = "FJI"; + + // + public string[] CallingCode { get; } = ["+679"]; + + // + public IEnumerable States => + [ + new("Ba", "FJ-01"), + new("Bua", "FJ-02"), + new("Cakaudrove", "FJ-03"), + new("Kadavu", "FJ-04"), + new("Lau", "FJ-05"), + new("Lomaiviti", "FJ-06"), + new("Macuata", "FJ-07"), + new("Nadroga-Navosa", "FJ-08"), + new("Naitasiri", "FJ-09"), + new("Namosi", "FJ-10"), + new("Ra", "FJ-11"), + new("Rewa", "FJ-12"), + new("Serua", "FJ-13"), + new("Tailevu", "FJ-14"), + new("Rotuma", "FJ-15", "Dependency") + ]; +} diff --git a/src/World.Net/Countries/Finland.cs b/src/World.Net/Countries/Finland.cs new file mode 100644 index 0000000..be510ac --- /dev/null +++ b/src/World.Net/Countries/Finland.cs @@ -0,0 +1,57 @@ +namespace World.Net.Countries; + +internal sealed class Finland : ICountry +{ + // + public CountryIdentifier Id => CountryIdentifier.Finland; + + // + public string Name { get; } = "Finland"; + + // + public string OfficialName { get; } = "Republic of Finland"; + + // + public string NativeName => "Suomen tasavalta / Republiken Finland"; + + // + public string Capital { get; } = "Helsinki"; + + // + public int NumericCode { get; } = 246; + + // + public string ISO2Code { get; } = "FI"; + + // + public string ISO3Code { get; } = "FIN"; + + // + public string[] CallingCode { get; } = ["+358"]; + + // + public IEnumerable States => + [ + new("Åland", "FI-01", "Region"), + new("Central Finland", "FI-08", "Region"), + new("Central Ostrobothnia", "FI-07", "Region"), + new("Etelä-Karjala", "FI-02", "Region"), + new("Etelä-Pohjanmaa", "FI-03", "Region"), + new("Etelä-Savo", "FI-04", "Region"), + new("Kainuu", "FI-05", "Region"), + new("Kanta-Häme", "FI-06", "Region"), + new("Keski-Pohjanmaa", "FI-09", "Region"), + new("Keski-Suomi", "FI-10", "Region"), + new("Kymenlaakso", "FI-11", "Region"), + new("Lappi", "FI-12", "Region"), + new("Pirkanmaa", "FI-13", "Region"), + new("Pohjanmaa", "FI-14", "Region"), + new("Pohjois-Karjala", "FI-15", "Region"), + new("Pohjois-Pohjanmaa", "FI-16", "Region"), + new("Pohjois-Savo", "FI-17", "Region"), + new("Päijät-Häme", "FI-18", "Region"), + new("Satakunta", "FI-19", "Region"), + new("Uusimaa", "FI-20", "Region"), + new("Varsinais-Suomi", "FI-21", "Region") + ]; +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index bb0e55f..e898d83 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -64,13 +64,16 @@ public static Dictionary Initialize() { CountryIdentifier.Curacao, new Curaçao() }, { CountryIdentifier.Cyprus, new Cyprus() }, { CountryIdentifier.CzechRepublic, new CzechRepublic() }, + { CountryIdentifier.Denmark, new Denmark() }, + { CountryIdentifier.Djibouti, new Djibouti() }, + { CountryIdentifier.Dominica, new Dominica() }, { CountryIdentifier.DominicanRepublic, new DominicanRepublic() }, { CountryIdentifier.TimorLeste, new TimorLeste() }, { CountryIdentifier.Ecuador, new Ecuador() }, { CountryIdentifier.Egypt, new Egypt() }, - { CountryIdentifier.Denmark, new Denmark() }, - { CountryIdentifier.Djibouti, new Djibouti() }, - { CountryIdentifier.Dominica, new Dominica() }, + { CountryIdentifier.FaroeIslands, new FaroeIslands() }, + { CountryIdentifier.FijiIslands, new FijiIslands() }, + { CountryIdentifier.Finland, new Finland() }, { CountryIdentifier.France, new France() }, { CountryIdentifier.FrenchGuiana, new FrenchGuiana() }, { CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() },