Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/World.Net.UnitTests/Countries/CaymanIslandsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace World.Net.UnitTests.Countries
{
public sealed class CaymanIslandsTest
{
private const string CAYMAN_ISLANDS_COUNTRY_NAME = "Cayman Islands";
private const string CAYMAN_ISLANDS_NATIVE_NAME = "Cayman Islands";
private const string CAYMAN_ISLANDS_CAPITAL = "George Town";
private const string CAYMAN_ISLANDS_OFFICIAL_NAME = "Cayman Islands";
private const string CAYMAN_ISLANDS_ISO2_CODE = "KY";
private const string CAYMAN_ISLANDS_ISO3_CODE = "CYM";
private const int CAYMAN_ISLANDS_NUMERIC_CODE = 136;
private const string CAYMAN_ISLANDS_CALLING_CODE = "+1-345";
private const int CAYMAN_ISLANDS_STATE_COUNT = 3;
private static readonly string[] VALID_STATE_TYPES = { "District" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCaymanIslands()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.CaymanIslands;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CAYMAN_ISLANDS_COUNTRY_NAME, country.Name);
Assert.Equal(CAYMAN_ISLANDS_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CAYMAN_ISLANDS_NATIVE_NAME, country.NativeName);
Assert.Equal(CAYMAN_ISLANDS_CAPITAL, country.Capital);
Assert.Equal(CAYMAN_ISLANDS_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CAYMAN_ISLANDS_ISO2_CODE, country.ISO2Code);
Assert.Equal(CAYMAN_ISLANDS_ISO3_CODE, country.ISO3Code);
Assert.Equal(CAYMAN_ISLANDS_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CAYMAN_ISLANDS_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
}
42 changes: 42 additions & 0 deletions src/World.Net.UnitTests/Countries/CentralAfricanRepublicTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.UnitTests.Countries;

public sealed class CentralAfricanRepublicTest
{
private const string CAR_COUNTRY_NAME = "Central African Republic";
private const string CAR_NATIVE_NAME = "Ködörösêse tî Bêafrîka";
private const string CAR_CAPITAL = "Bangui";
private const string CAR_OFFICIAL_NAME = "Central African Republic";
private const string CAR_ISO2_CODE = "CF";
private const string CAR_ISO3_CODE = "CAF";
private const int CAR_NUMERIC_CODE = 140;
private const string CAR_CALLING_CODE = "+236";
private const int CAR_STATE_COUNT = 14;
private static readonly string[] VALID_STATE_TYPES = { "Prefecture", "Capital District" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCentralAfricanRepublic()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.CentralAfricanRepublic;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CAR_COUNTRY_NAME, country.Name);
Assert.Equal(CAR_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CAR_NATIVE_NAME, country.NativeName);
Assert.Equal(CAR_CAPITAL, country.Capital);
Assert.Equal(CAR_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CAR_ISO2_CODE, country.ISO2Code);
Assert.Equal(CAR_ISO3_CODE, country.ISO3Code);
Assert.Equal(CAR_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CAR_STATE_COUNT, country.States.Count());

// Assert that each state has a valid type
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
42 changes: 42 additions & 0 deletions src/World.Net.UnitTests/Countries/ChadTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.UnitTests.Countries;

public sealed class ChadTest
{
private const string CHAD_COUNTRY_NAME = "Chad";
private const string CHAD_NATIVE_NAME = "Tchad";
private const string CHAD_CAPITAL = "N'Djamena";
private const string CHAD_OFFICIAL_NAME = "Republic of Chad";
private const string CHAD_ISO2_CODE = "TD";
private const string CHAD_ISO3_CODE = "TCD";
private const int CHAD_NUMERIC_CODE = 148;
private const string CHAD_CALLING_CODE = "+235";
private const int CHAD_STATE_COUNT = 23;
private static readonly string[] VALID_STATE_TYPES = { "Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForChad()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Chad;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CHAD_COUNTRY_NAME, country.Name);
Assert.Equal(CHAD_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CHAD_NATIVE_NAME, country.NativeName);
Assert.Equal(CHAD_CAPITAL, country.Capital);
Assert.Equal(CHAD_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CHAD_ISO2_CODE, country.ISO2Code);
Assert.Equal(CHAD_ISO3_CODE, country.ISO3Code);
Assert.Equal(CHAD_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CHAD_STATE_COUNT, country.States.Count());

// Assert that each state has a valid type
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
42 changes: 42 additions & 0 deletions src/World.Net.UnitTests/Countries/ChileTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.UnitTests.Countries;

public sealed class ChileTest
{
private const string CHILE_COUNTRY_NAME = "Chile";
private const string CHILE_NATIVE_NAME = "República de Chile";
private const string CHILE_CAPITAL = "Santiago";
private const string CHILE_OFFICIAL_NAME = "Republic of Chile";
private const string CHILE_ISO2_CODE = "CL";
private const string CHILE_ISO3_CODE = "CHL";
private const int CHILE_NUMERIC_CODE = 152;
private const string CHILE_CALLING_CODE = "+56";
private const int CHILE_STATE_COUNT = 16;
private static readonly string[] VALID_STATE_TYPES = { "Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForChile()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Chile;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CHILE_COUNTRY_NAME, country.Name);
Assert.Equal(CHILE_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CHILE_NATIVE_NAME, country.NativeName);
Assert.Equal(CHILE_CAPITAL, country.Capital);
Assert.Equal(CHILE_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CHILE_ISO2_CODE, country.ISO2Code);
Assert.Equal(CHILE_ISO3_CODE, country.ISO3Code);
Assert.Equal(CHILE_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CHILE_STATE_COUNT, country.States.Count());

// Assert that each state has a valid type
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
42 changes: 42 additions & 0 deletions src/World.Net.UnitTests/Countries/ChinaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.UnitTests.Countries;

public sealed class ChinaTest
{
private const string CHINA_COUNTRY_NAME = "China";
private const string CHINA_NATIVE_NAME = "中国";
private const string CHINA_CAPITAL = "Beijing";
private const string CHINA_OFFICIAL_NAME = "People's Republic of China";
private const string CHINA_ISO2_CODE = "CN";
private const string CHINA_ISO3_CODE = "CHN";
private const int CHINA_NUMERIC_CODE = 156;
private const string CHINA_CALLING_CODE = "+86";
private const int CHINA_STATE_COUNT = 34; // 23 Provinces, 4 Municipalities, 5 Autonomous Regions, 2 SAR
private static readonly string[] VALID_STATE_TYPES = { "Province", "Municipality", "Autonomous Region", "Special Administrative Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForChina()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.China;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CHINA_COUNTRY_NAME, country.Name);
Assert.Equal(CHINA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CHINA_NATIVE_NAME, country.NativeName);
Assert.Equal(CHINA_CAPITAL, country.Capital);
Assert.Equal(CHINA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CHINA_ISO2_CODE, country.ISO2Code);
Assert.Equal(CHINA_ISO3_CODE, country.ISO3Code);
Assert.Equal(CHINA_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CHINA_STATE_COUNT, country.States.Count());

// Assert that each state has a valid type
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
29 changes: 29 additions & 0 deletions src/World.Net/Countries/CaymanIslands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace World.Net.Countries;

internal sealed class CaymanIslands : ICountry
{
public CountryIdentifier Id => CountryIdentifier.CaymanIslands;

public string Name => "Cayman Islands";

public string OfficialName => "Cayman Islands";

public string NativeName => "Cayman Islands";

public string Capital => "George Town";

public int NumericCode => 136;

public string ISO2Code => "KY";

public string ISO3Code => "CYM";

public string CallingCode => "+1-345";

public IEnumerable<State> States =>
[
new("Cayman Brac", "", "District"),
new("Grand Cayman", "", "District"),
new("Little Cayman", "", "District")
];
}
40 changes: 40 additions & 0 deletions src/World.Net/Countries/CentralAfricanRepublic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.Countries;

internal sealed class CentralAfricanRepublic : ICountry
{
public CountryIdentifier Id => CountryIdentifier.CentralAfricanRepublic;

public string Name => "Central African Republic";

public string OfficialName => "Central African Republic";

public string NativeName => "Ködörösêse tî Bêafrîka";

public string Capital => "Bangui";

public int NumericCode => 140;

public string ISO2Code => "CF";

public string ISO3Code => "CAF";

public string CallingCode => "+236";

public IEnumerable<State> States =>
[
new("Bamingui-Bangoran", "BB", "Prefecture"),
new("Bangui", "BGF", "Capital District"),
new("Basse-Kotto", "BK", "Prefecture"),
new("Haut-Mbomou", "HM", "Prefecture"),
new("Haut-Oubangui", "HK", "Prefecture"),
new("Kémo", "KG", "Prefecture"),
new("Lobaye", "LB", "Prefecture"),
new("Mambéré-Kadéï", "CF", "Prefecture"),
new("Mbomou", "MB", "Prefecture"),
new("Nana-Mambéré", "NM", "Prefecture"),
new("Nana-Grébizi", "NG", "Prefecture"),
new("Ombella-M'Poko", "OM", "Prefecture"),
new("Sangha-Mbaéré", "SM", "Prefecture"),
new("Vakaga", "VK", "Prefecture")
];
}
49 changes: 49 additions & 0 deletions src/World.Net/Countries/Chad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace World.Net.Countries;

internal sealed class Chad : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Chad;

public string Name => "Chad";

public string OfficialName => "Republic of Chad";

public string NativeName => "Tchad";

public string Capital => "N'Djamena";

public int NumericCode => 148;

public string ISO2Code => "TD";

public string ISO3Code => "TCD";

public string CallingCode => "+235";

public IEnumerable<State> States =>
[
new State("Bahr el Gazel", "BG", "Region"),
new State("Batha", "BA", "Region"),
new State("Borkou", "BO", "Region"),
new State("Chari-Baguirmi", "TD-CH", "Region"),
new State("Ennedi-Est", "EE", "Region"),
new State("Ennedi-Ouest", "EO", "Region"),
new State("Guéra", "GE", "Region"),
new State("Hadjer-Lamis", "HL", "Region"),
new State("Kanem", "KA", "Region"),
new State("Lac", "LC", "Region"),
new State("Logone Occidental", "LO", "Region"),
new State("Logone Oriental", "LO", "Region"),
new State("Mandoul", "MD", "Region"),
new State("Mayo-Kebbi Est", "MK", "Region"),
new State("Mayo-Kebbi Ouest", "MO", "Region"),
new State("Moyen-Chari", "MC", "Region"),
new State("N'Djamena'", "ND", "Region"),
new State("Ouaddaï", "OD", "Region"),
new State("Salamat", "SA", "Region"),
new State("Sila", "SI", "Region"),
new State("Tandjilé", "TA", "Region"),
new State("Tibesti", "TI", "Region"),
new State("Wadi Fira", "WF", "Region")
];
}
46 changes: 46 additions & 0 deletions src/World.Net/Countries/Chile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace World.Net.Countries;

internal sealed class Chile : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Chile;

public string Name => "Chile";

public string OfficialName => "Republic of Chile";

public string NativeName => "República de Chile";

public string Capital => "Santiago";

public int NumericCode => 152;

public string ISO2Code => "CL";

public string ISO3Code => "CHL";

public string CallingCode => "+56";

public IEnumerable<State> States =>
[
new("Arica y Parinacota", "AP", "Region"),
new("Antofagasta", "AN", "Region"),
new("Atacama", "AT", "Region"),
new("Aysén del General Carlos Ibáñez del Campo", "AI", "Region"),
new("Biobío", "BI", "Region"),
new("Coquimbo", "CO", "Region"),
new("La Araucanía", "AR", "Region"),
new("Los Lagos", "LL", "Region"),
new("Los Ríos", "LR", "Region"),
new("Magallanes y de la Antártica Chilena", "MA", "Region"),
new("Libertador General Bernardo O''Higgins", "LI", "Region"),
new("Maule", "-ML", "Region"),
new("Ñuble", "NB", "Region"),
new("Metropolitana de Santiago", "RM", "Region"),
new("Tarapacá", "TA", "Region"),
new("Valparaíso", "VS", "Region")
];
}
Loading