diff --git a/src/World.Net.UnitTests/Countries/BrazilTest.cs b/src/World.Net.UnitTests/Countries/BrazilTest.cs new file mode 100644 index 0000000..21aadec --- /dev/null +++ b/src/World.Net.UnitTests/Countries/BrazilTest.cs @@ -0,0 +1,38 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class BrazilTest + { + private const string BRAZIL_NAME = "Brazil"; + private const int BRAZIL_STATE_COUNT = 27; + private const string BRAZIL_OFFICIAL_NAME = "Federative Republic of Brazil"; + private const string BRAZIL_NATIVE_NAME = "Brasil"; + private const string BRAZIL_CAPITAL = "Brasilia"; + private const int BRAZIL_NUMERIC_CODE = 076; + private const string BRAZIL_ISO2_CODE = "BR"; + private const string BRAZIL_ISO3_CODE = "BRA"; + private const string BRAZIL_CALLING_CODE = "+55"; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_for_Brazil() + { + // Arrange + int existingCountryId = CountryIdentifier.Brazil; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + //Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(BRAZIL_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(BRAZIL_STATE_COUNT, country.States.Count()); + Assert.Equal(BRAZIL_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(BRAZIL_NATIVE_NAME, country.NativeName); + Assert.Equal(BRAZIL_CAPITAL, country.Capital); + Assert.Equal(BRAZIL_NUMERIC_CODE, country.NumericCode); + Assert.Equal(BRAZIL_ISO2_CODE, country.ISO2Code); + Assert.Equal(BRAZIL_ISO3_CODE, country.ISO3Code); + Assert.Equal(BRAZIL_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net.UnitTests/Countries/BritishIndianOceanTerritoryTest.cs b/src/World.Net.UnitTests/Countries/BritishIndianOceanTerritoryTest.cs new file mode 100644 index 0000000..c574ea8 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/BritishIndianOceanTerritoryTest.cs @@ -0,0 +1,37 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class BritishIndianOceanTerritoryTest + { + private const string BRITISH_INDIAN_OCEAN_TERRITORY_NAME = "British Indian Ocean Territory"; + private const string BRITISH_INDIAN_OCEAN_TERRITORY_OFFICIAL_NAME = "British Indian Ocean Territory"; + private const string BRITISH_INDIAN_OCEAN_TERRITORY_NATIVE_NAME = "British Indian Ocean Territory"; + private const string BRITISH_INDIAN_OCEAN_TERRITORY_CAPITAL = "Diego Garcia"; + private const int BRITISH_INDIAN_OCEAN_TERRITORY_NUMERIC_CODE = 086; + private const string BRITISH_INDIAN_OCEAN_TERRITORY_ISO2_CODE = "IO"; + private const string BRITISH_INDIAN_OCEAN_TERRITORY_ISO3_CODE = "IOT"; + private const string BRITISH_INDIAN_OCEAN_TERRITORY_CALLING_CODE = "+246"; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_for_BritishIndianOceanTerritory() + { + // Arrange + int existingCountryId = CountryIdentifier.BritishIndianOceanTerritory; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + //Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Empty(country.States); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_NATIVE_NAME, country.NativeName); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_CAPITAL, country.Capital); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_NUMERIC_CODE, country.NumericCode); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_ISO2_CODE, country.ISO2Code); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_ISO3_CODE, country.ISO3Code); + Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net.UnitTests/Countries/BruneiTest.cs b/src/World.Net.UnitTests/Countries/BruneiTest.cs new file mode 100644 index 0000000..8f547d7 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/BruneiTest.cs @@ -0,0 +1,38 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class BruneiTest + { + private const string BRUNEI_NAME = "Brunei"; + private const int BRUNEI_STATE_COUNT = 4; + private const string BRUNEI_OFFICIAL_NAME = "Nation of Brunei, the Abode of Peace"; + private const string BRUNEI_NATIVE_NAME = "Negara Brunei Darussalam"; + private const string BRUNEI_CAPITAL = "Bandar Seri Begawan"; + private const int BRUNEI_NUMERIC_CODE = 096; + private const string BRUNEI_ISO2_CODE = "BN"; + private const string BRUNEI_ISO3_CODE = "BRN"; + private const string BRUNEI_CALLING_CODE = "+673"; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_for_Brunei() + { + // Arrange + int existingCountryId = CountryIdentifier.Brunei; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + //Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(BRUNEI_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(BRUNEI_STATE_COUNT, country.States.Count()); + Assert.Equal(BRUNEI_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(BRUNEI_NATIVE_NAME, country.NativeName); + Assert.Equal(BRUNEI_CAPITAL, country.Capital); + Assert.Equal(BRUNEI_NUMERIC_CODE, country.NumericCode); + Assert.Equal(BRUNEI_ISO2_CODE, country.ISO2Code); + Assert.Equal(BRUNEI_ISO3_CODE, country.ISO3Code); + Assert.Equal(BRUNEI_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net.UnitTests/Countries/BulgariaTest.cs b/src/World.Net.UnitTests/Countries/BulgariaTest.cs new file mode 100644 index 0000000..9c941e7 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/BulgariaTest.cs @@ -0,0 +1,38 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class BulgariaTest + { + private const string BULGARIA_NAME = "Bulgaria"; + private const int BULGARIA_STATE_COUNT = 28; + private const string BULGARIA_OFFICIAL_NAME = "Republic of Bulgaria"; + private const string BULGARIA_NATIVE_NAME = "България"; + private const string BULGARIA_CAPITAL = "Sofia"; + private const int BULGARIA_NUMERIC_CODE = 100; + private const string BULGARIA_ISO2_CODE = "BG"; + private const string BULGARIA_ISO3_CODE = "BGR"; + private const string BULGARIA_CALLING_CODE = "+359"; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_for_Bulgaria() + { + // Arrange + int existingCountryId = CountryIdentifier.Bulgaria; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + //Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(BULGARIA_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(BULGARIA_STATE_COUNT, country.States.Count()); + Assert.Equal(BULGARIA_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(BULGARIA_NATIVE_NAME, country.NativeName); + Assert.Equal(BULGARIA_CAPITAL, country.Capital); + Assert.Equal(BULGARIA_NUMERIC_CODE, country.NumericCode); + Assert.Equal(BULGARIA_ISO2_CODE, country.ISO2Code); + Assert.Equal(BULGARIA_ISO3_CODE, country.ISO3Code); + Assert.Equal(BULGARIA_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net.UnitTests/Countries/BurkinaFasoTest.cs b/src/World.Net.UnitTests/Countries/BurkinaFasoTest.cs new file mode 100644 index 0000000..5ec0259 --- /dev/null +++ b/src/World.Net.UnitTests/Countries/BurkinaFasoTest.cs @@ -0,0 +1,38 @@ +namespace World.Net.UnitTests.Countries +{ + public sealed class BurkinaFasoTest + { + private const string BURKINA_FASO_NAME = "Burkina Faso"; + private const int BURKINA_FASO_STATE_COUNT = 57; + private const string BURKINA_FASO_OFFICIAL_NAME = "The Republic of Burkina Faso"; + private const string BURKINA_FASO_NATIVE_NAME = "Burkina Faso"; + private const string BURKINA_FASO_CAPITAL = "Ouagadougou"; + private const int BURKINA_FASO_NUMERIC_CODE = 854; + private const string BURKINA_FASO_ISO2_CODE = "BF"; + private const string BURKINA_FASO_ISO3_CODE = "BFA"; + private const string BURKINA_FASO_CALLING_CODE = "+226"; + + [Fact] + public void GetCountry_ReturnsCorrectInformation_for_BurkinaFaso() + { + // Arrange + int existingCountryId = CountryIdentifier.BurkinaFaso; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + //Assert + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(BURKINA_FASO_NAME, country.Name); + Assert.NotNull(country.States); + Assert.Equal(BURKINA_FASO_STATE_COUNT, country.States.Count()); + Assert.Equal(BURKINA_FASO_OFFICIAL_NAME, country.OfficialName); + Assert.Equal(BURKINA_FASO_NATIVE_NAME, country.NativeName); + Assert.Equal(BURKINA_FASO_CAPITAL, country.Capital); + Assert.Equal(BURKINA_FASO_NUMERIC_CODE, country.NumericCode); + Assert.Equal(BURKINA_FASO_ISO2_CODE, country.ISO2Code); + Assert.Equal(BURKINA_FASO_ISO3_CODE, country.ISO3Code); + Assert.Equal(BURKINA_FASO_CALLING_CODE, country.CallingCode); + } + } +} diff --git a/src/World.Net/Countries/Brazil.cs b/src/World.Net/Countries/Brazil.cs new file mode 100644 index 0000000..b0b6319 --- /dev/null +++ b/src/World.Net/Countries/Brazil.cs @@ -0,0 +1,64 @@ +namespace World.Net.Countries +{ + internal sealed class Brazil : ICountry + { + /// + public int Id => CountryIdentifier.Brazil; + + /// + public string Name => nameof(Brazil); + + /// + public string OfficialName { get; } = "Federative Republic of Brazil"; + + /// + public string NativeName { get; } = "Brasil"; + + /// + public string Capital { get; } = "Brasilia"; + + /// + public int NumericCode { get; } = 076; + + /// + public string ISO2Code { get; } = "BR"; + + /// + public string ISO3Code { get; } = "BRA"; + + /// + public string CallingCode { get; } = "+55"; + + /// + public IEnumerable States { get; } = + [ + new("Acre", "AC", "State"), + new("Alagoas", "AL", "State"), + new("Amapá", "AP", "State"), + new("Amazonas", "AM", "State"), + new("Bahia", "BA", "State"), + new("Ceará", "CE", "State"), + new("Distrito Federal", "DF", "Federal District"), + new("Espírito Santo", "ES", "State"), + new("Goiás", "GO", "State"), + new("Maranhão", "MA", "State"), + new("Mato Grosso", "MT", "State"), + new("Mato Grosso do Sul", "MS", "State"), + new("Minas Gerais", "MG", "State"), + new("Pará", "PA", "State"), + new("Paraíba", "PB", "State"), + new("Paraná", "PR", "State"), + new("Pernambuco", "PE", "State"), + new("Piauí", "PI", "State"), + new("Rio de Janeiro", "RJ", "State"), + new("Rio Grande do Norte", "RN", "State"), + new("Rio Grande do Sul", "RS", "State"), + new("Rondônia", "RO", "State"), + new("Roraima", "RR", "State"), + new("Santa Catarina", "SC", "State"), + new("São Paulo", "SP", "State"), + new("Sergipe", "SE", "State"), + new("Tocantins", "TO", "State"), + ]; + } +} diff --git a/src/World.Net/Countries/BritishIndianOceanTerritory.cs b/src/World.Net/Countries/BritishIndianOceanTerritory.cs new file mode 100644 index 0000000..bc4c505 --- /dev/null +++ b/src/World.Net/Countries/BritishIndianOceanTerritory.cs @@ -0,0 +1,38 @@ +namespace World.Net.Countries +{ + internal sealed class BritishIndianOceanTerritory : ICountry + { + /// + public int Id => CountryIdentifier.BritishIndianOceanTerritory; + + /// + public string Name => "British Indian Ocean Territory"; + + /// + public string OfficialName { get; } = "British Indian Ocean Territory"; + + /// + public string NativeName { get; } = "British Indian Ocean Territory"; + + /// + public string Capital { get; } = "Diego Garcia"; + + /// + public int NumericCode { get; } = 086; + + /// + public string ISO2Code { get; } = "IO"; + + /// + public string ISO3Code { get; } = "IOT"; + + /// + public string CallingCode { get; } = "+246"; + + /// + public IEnumerable States { get; } = + [ + + ]; + } +} diff --git a/src/World.Net/Countries/Brunei.cs b/src/World.Net/Countries/Brunei.cs new file mode 100644 index 0000000..3f1804d --- /dev/null +++ b/src/World.Net/Countries/Brunei.cs @@ -0,0 +1,41 @@ +namespace World.Net.Countries +{ + internal sealed class Brunei : ICountry + { + /// + public int Id => CountryIdentifier.Brunei; + + /// + public string Name => nameof(Brunei); + + /// + public string OfficialName { get; } = "Nation of Brunei, the Abode of Peace"; + + /// + public string NativeName { get; } = "Negara Brunei Darussalam"; + + /// + public string Capital { get; } = "Bandar Seri Begawan"; + + /// + public int NumericCode { get; } = 096; + + /// + public string ISO2Code { get; } = "BN"; + + /// + public string ISO3Code { get; } = "BRN"; + + /// + public string CallingCode { get; } = "+673"; + + /// + public IEnumerable States { get; } = + [ + new("Belait", "BE", "District"), + new("Brunei-Muara", "BM", "District"), + new("Temburong", "TE", "District"), + new("Tutong", "TU", "District"), + ]; + } +} diff --git a/src/World.Net/Countries/Bulgaria.cs b/src/World.Net/Countries/Bulgaria.cs new file mode 100644 index 0000000..0d5bc90 --- /dev/null +++ b/src/World.Net/Countries/Bulgaria.cs @@ -0,0 +1,65 @@ +namespace World.Net.Countries +{ + internal sealed class Bulgaria : ICountry + { + /// + public int Id => CountryIdentifier.Bulgaria; + + /// + public string Name => nameof(Bulgaria); + + /// + public string OfficialName { get; } = "Republic of Bulgaria"; + + /// + public string NativeName { get; } = "България"; + + /// + public string Capital { get; } = "Sofia"; + + /// + public int NumericCode { get; } = 100; + + /// + public string ISO2Code { get; } = "BG"; + + /// + public string ISO3Code { get; } = "BGR"; + + /// + public string CallingCode { get; } = "+359"; + + /// + public IEnumerable States { get; } = + [ + new("Blagoevgrad", "BG-01", "District"), + new("Burgas", "BG-02", "District"), + new("Varna", "BG-03", "District"), + new("Veliko Tarnovo", "BG-04", "District"), + new("Vidin", "BG-05", "District"), + new("Vratsa", "BG-06", "District"), + new("Gabrovo", "BG-07", "District"), + new("Dobrich", "BG-08", "District"), + new("Kardzhali", "BG-09", "District"), + new("Kyustendil", "BG-10", "District"), + new("Lovech", "BG-11", "District"), + new("Montana", "BG-12", "District"), + new("Pazardzhik", "BG-13", "District"), + new("Pernik", "BG-14", "District"), + new("Pleven", "BG-15", "District"), + new("Plovdiv", "BG-16", "District"), + new("Razgrad", "BG-17", "District"), + new("Ruse", "BG-18", "District"), + new("Silistra", "BG-19", "District"), + new("Sliven", "BG-20", "District"), + new("Smolyan", "BG-21", "District"), + new("Sofia City", "BG-22", "District"), + new("Sofia", "BG-23", "District"), + new("Stara Zagora", "BG-24", "District"), + new("Targovishte", "BG-25", "District"), + new("Haskovo", "BG-26", "District"), + new("Shumen", "BG-27", "District"), + new("Yambol", "BG-28", "District"), + ]; + } +} diff --git a/src/World.Net/Countries/BurkinaFaso.cs b/src/World.Net/Countries/BurkinaFaso.cs new file mode 100644 index 0000000..a9ee582 --- /dev/null +++ b/src/World.Net/Countries/BurkinaFaso.cs @@ -0,0 +1,94 @@ +namespace World.Net.Countries +{ + internal sealed class BurkinaFaso : ICountry + { + /// + public int Id => CountryIdentifier.BurkinaFaso; + + /// + public string Name => "Burkina Faso"; + + /// + public string OfficialName { get; } = "The Republic of Burkina Faso"; + + /// + public string NativeName { get; } = "Burkina Faso"; + + /// + public string Capital { get; } = "Ouagadougou"; + + /// + public int NumericCode { get; } = 854; + + /// + public string ISO2Code { get; } = "BF"; + + /// + public string ISO3Code { get; } = "BFA"; + + /// + public string CallingCode { get; } = "+226"; + + /// + public IEnumerable States { get; } = + [ + new("Balé", "BAL", "Province"), + new("Bam", "BAM", "Province"), + new("Banwa", "BAN", "Province"), + new("Bazèga", "BAZ", "Province"), + new("Boucle du Mouhoun", "01", "Region"), + new("Bougouriba", "BGR", "Province"), + new("Boulgou", "BLG", "Province"), + new("Cascades", "02", "Region"), + new("Centre", "03", "Region"), + new("Centre-Est", "04", "Region"), + new("Centre-Nord", "05", "Region"), + new("Centre-Ouest", "06", "Region"), + new("Centre-Sud", "07", "Region"), + new("Comoé", "COM", "Province"), + new("Est", "08", "Region"), + new("Ganzourgou", "GAN", "Province"), + new("Gnagna", "GNA", "Province"), + new("Gourma", "GOU", "Province"), + new("Hauts-Bassins", "09", "Region"), + new("Houet", "HOU", "Province"), + new("Ioba", "IOB", "Province"), + new("Kadiogo", "KAD", "Province"), + new("Kénédougou", "KEN", "Province"), + new("Komondjari", "KMD", "Province"), + new("Kompienga", "KMP", "Province"), + new("Kossi", "KOS", "Province"), + new("Koulpélogo", "KOP", "Province"), + new("Kouritenga", "KOT", "Province"), + new("Kourwéogo", "KOW", "Province"), + new("Léraba", "LER", "Province"), + new("Loroum", "LOR", "Province"), + new("Mouhoun", "MOU", "Province"), + new("Nahouri", "NAO", "Province"), + new("Namentenga", "NAM", "Province"), + new("Nayala", "NAY", "Province"), + new("Nord", "10", "Region"), + new("Noumbiel", "NOU", "Province"), + new("Oubritenga", "OUB", "Province"), + new("Oudalan", "OUD", "Province"), + new("Passoré", "PAS", "Province"), + new("Plateau-Central", "11", "Region"), + new("Poni", "PON", "Province"), + new("Sahel", "12", "Region"), + new("Sanguié", "SNG", "Province"), + new("Sanmatenga", "SMT", "Province"), + new("Séno", "SEN", "Province"), + new("Sissili", "SIS", "Province"), + new("Soum", "SOM", "Province"), + new("Sourou", "SOR", "Province"), + new("Sud-Ouest", "13", "Region"), + new("Tapoa", "TAP", "Province"), + new("Tuy", "TUI", "Province"), + new("Yagha", "YAG", "Province"), + new("Yatenga", "YAT", "Province"), + new("Ziro", "ZIR", "Province"), + new("Zondoma", "ZON", "Province"), + new("Zoundwéogo", "ZOU", "Province"), + ]; + } +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index bb68b38..49d4e45 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -36,6 +36,11 @@ public static Dictionary Initialize() { CountryIdentifier.BosniaAndHerzegovina, new BosniaAndHerzegovina() }, { CountryIdentifier.Botswana, new Botswana() }, { CountryIdentifier.BouvetIsland, new BouvetIsland() }, + { CountryIdentifier.Bulgaria, new Bulgaria() }, + { CountryIdentifier.BurkinaFaso, new BurkinaFaso() }, + { CountryIdentifier.Brazil, new Brazil() }, + { CountryIdentifier.Brunei, new Brunei() }, + { CountryIdentifier.BritishIndianOceanTerritory, new BritishIndianOceanTerritory() }, // Future countries can be added here in the same format. };