Skip to content
Closed
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
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/CentralAfricanRepublicTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class CentralAfricanRepublicTest
{
private const string CENTRAL_AFRICAN_REPUBLIC_NAME = "Central African Republic";
private const int CENTRAL_AFRICAN_REPUBLIC_STATE_COUNT = 17;
private const string CENTRAL_AFRICAN_REPUBLIC_OFFICIAL_NAME = "Central African Republic";
private const string CENTRAL_AFRICAN_REPUBLIC_NATIVE_NAME = "Ködörösêse tî Bêafrîka";
private const string CENTRAL_AFRICAN_REPUBLIC_CAPITAL = "Bangui";
private const int CENTRAL_AFRICAN_REPUBLIC_NUMERIC_CODE = 140;
private const string CENTRAL_AFRICAN_REPUBLIC_ISO2_CODE = "CF";
private const string CENTRAL_AFRICAN_REPUBLIC_ISO3_CODE = "CAF";
private const string CENTRAL_AFRICAN_REPUBLIC_CALLING_CODE = "+236";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_STATE_COUNT, country.States.Count());
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_NATIVE_NAME, country.NativeName);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_CAPITAL, country.Capital);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_ISO2_CODE, country.ISO2Code);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_ISO3_CODE, country.ISO3Code);
Assert.Equal(CENTRAL_AFRICAN_REPUBLIC_CALLING_CODE, country.CallingCode);
}
}
}
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/ChadTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class ChadTest
{
private const string CHAD_NAME = "Chad";
private const int CHAD_STATE_COUNT = 23;
private const string CHAD_OFFICIAL_NAME = "Republic of Chad";
private const string CHAD_NATIVE_NAME = "Tchad";
private const string CHAD_CAPITAL = "N'Djamena";
private const int CHAD_NUMERIC_CODE = 148;
private const string CHAD_ISO2_CODE = "TD";
private const string CHAD_ISO3_CODE = "TCD";
private const string CHAD_CALLING_CODE = "+235";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CHAD_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(CHAD_STATE_COUNT, country.States.Count());
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);
}
}
}
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/ChileTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class ChileTest
{
private const string CHILE_NAME = "Chile";
private const int CHILE_STATE_COUNT = 16;
private const string CHILE_OFFICIAL_NAME = "Republic of Chile";
private const string CHILE_NATIVE_NAME = "Chile";
private const string CHILE_CAPITAL = "Santiago";
private const int CHILE_NUMERIC_CODE = 152;
private const string CHILE_ISO2_CODE = "CL";
private const string CHILE_ISO3_CODE = "CHL";
private const string CHILE_CALLING_CODE = "+56";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CHILE_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(CHILE_STATE_COUNT, country.States.Count());
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);
}
}
}
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/ChinaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class ChinaTest
{
private const string CHINA_NAME = "China";
private const int CHINA_STATE_COUNT = 34;
private const string CHINA_OFFICIAL_NAME = "People's Republic of China";
private const string CHINA_NATIVE_NAME = "中国";
private const string CHINA_CAPITAL = "Beijing";
private const int CHINA_NUMERIC_CODE = 156;
private const string CHINA_ISO2_CODE = "CN";
private const string CHINA_ISO3_CODE = "CHN";
private const string CHINA_CALLING_CODE = "+86";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CHINA_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(CHINA_STATE_COUNT, country.States.Count());
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);
}
}
}
54 changes: 54 additions & 0 deletions src/World.Net/Countries/CentralAfricanRepublic.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace World.Net.Countries
{
internal sealed class CentralAfricanRepublic : ICountry
{
///<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.CentralAfricanRepublic;

///<inheritdoc/>
public string Name => "Central African Republic";

///<inheritdoc/>
public string OfficialName { get; } = "Central African Republic";

///<inheritdoc/>
public string NativeName { get; } = "Ködörösêse tî Bêafrîka";

///<inheritdoc/>
public string Capital { get; } = "Bangui";

///<inheritdoc/>
public int NumericCode { get; } = 140;

///<inheritdoc/>
public string ISO2Code { get; } = "CF";

///<inheritdoc/>
public string ISO3Code { get; } = "CAF";

///<inheritdoc/>
public string CallingCode { get; } = "+236";

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Bamingui-Bangoran", "CF-BB", "Prefecture"),
new("Bangui", "CF-BGF", "Commune"),
new("Basse-Kotto", "CF-BK", "Prefecture"),
new("Haut-Mbomou", "CF-HM", "Prefecture"),
new("Haute-Kotto", "CF-HK", "Prefecture"),
new("Kémo", "CF-KG", "Prefecture"),
new("Lobaye", "CF-LB", "Prefecture"),
new("Mambéré-Kadéï", "CF-HS", "Prefecture"),
new("Mbomou", "CF-MB", "Prefecture"),
new("Nana-Grébizi", "CF-KB", "Economic Prefecture"),
new("Nana-Mambéré", "CF-NM", "Prefecture"),
new("Ombella-M'Poko", "CF-MP", "Prefecture"),
new("Ouaka", "CF-UK", "Prefecture"),
new("Ouham", "CF-AC", "Prefecture"),
new("Ouham-Pendé", "CF-OP", "Prefecture"),
new("Sangha-Mbaéré", "CF-SE", "Prefecture"),
new("Vakaga", "CF-VK", "Prefecture"),
];
}
}
60 changes: 60 additions & 0 deletions src/World.Net/Countries/Chad.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
namespace World.Net.Countries
{
internal sealed class Chad : ICountry
{
///<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Chad;

///<inheritdoc/>
public string Name => nameof(Chad);

///<inheritdoc/>
public string OfficialName { get; } = "Republic of Chad";

///<inheritdoc/>
public string NativeName { get; } = "Tchad";

///<inheritdoc/>
public string Capital { get; } = "N'Djamena";

///<inheritdoc/>
public int NumericCode { get; } = 148;

///<inheritdoc/>
public string ISO2Code { get; } = "TD";

///<inheritdoc/>
public string ISO3Code { get; } = "TCD";

///<inheritdoc/>
public string CallingCode { get; } = "+235";

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Bahr el Gazel", "TD-BG", "Province"),
new("Batha", "TD-BA", "Province"),
new("Borkou", "TD-BO", "Province"),
new("Chari-Baguirmi", "TD-CB", "Province"),
new("Ennedi-Est", "TD-EE", "Province"),
new("Ennedi-Ouest", "TD-EO", "Province"),
new("Guéra", "TD-GR", "Province"),
new("Hadjer-Lamis", "TD-HL", "Province"),
new("Kanem", "TD-KA", "Province"),
new("Lac", "TD-LC", "Province"),
new("Logone Occidental", "TD-LO", "Province"),
new("Logone Oriental", "TD-LR", "Province"),
new("Mandoul", "TD-MA", "Province"),
new("Mayo-Kebbi Est", "TD-ME", "Province"),
new("Mayo-Kebbi Ouest", "TD-MO", "Province"),
new("Moyen-Chari", "TD-MC", "Province"),
new("N'Djamena", "TD-ND", "Province"),
new("Ouaddaï", "TD-OD", "Province"),
new("Salamat", "TD-SA", "Province"),
new("Sila", "TD-SI", "Province"),
new("Tandjilé", "TD-TA", "Province"),
new("Tibesti", "TD-TI", "Province"),
new("Wadi Fira", "TD-WF", "Province"),
];
}
}
53 changes: 53 additions & 0 deletions src/World.Net/Countries/Chile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace World.Net.Countries
{
internal sealed class Chile : ICountry
{
///<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Chile;

///<inheritdoc/>
public string Name => nameof(Chile);

///<inheritdoc/>
public string OfficialName { get; } = "Republic of Chile";

///<inheritdoc/>
public string NativeName { get; } = "Chile";

///<inheritdoc/>
public string Capital { get; } = "Santiago";

///<inheritdoc/>
public int NumericCode { get; } = 152;

///<inheritdoc/>
public string ISO2Code { get; } = "CL";

///<inheritdoc/>
public string ISO3Code { get; } = "CHL";

///<inheritdoc/>
public string CallingCode { get; } = "+56";

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Aisén del General Carlos Ibañez del Campo", "CL-AI", "Region"),
new("Antofagasta", "CL-AN", "Region"),
new("Arica y Parinacota", "CL-AP", "Region"),
new("Atacama", "CL-AT", "Region"),
new("Biobío", "CL-BI", "Region"),
new("Coquimbo", "CL-CO", "Region"),
new("La Araucanía", "CL-AR", "Region"),
new("Libertador General Bernardo O'Higgins", "CL-LI", "Region"),
new("Los Lagos", "CL-LL", "Region"),
new("Los Ríos", "CL-LR", "Region"),
new("Magallanes y de la Antártica Chilena", "CL-MA", "Region"),
new("Maule", "CL-ML", "Region"),
new("Ñuble", "CL-NB", "Region"),
new("Región Metropolitana de Santiago", "CL-RM", "Region"),
new("Tarapacá", "CL-TA", "Region"),
new("Valparaíso", "CL-VS", "Region"),
];
}
}
71 changes: 71 additions & 0 deletions src/World.Net/Countries/China.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
namespace World.Net.Countries
{
internal sealed class China : ICountry
{
///<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.China;

///<inheritdoc/>
public string Name => nameof(China);

///<inheritdoc/>
public string OfficialName { get; } = "People's Republic of China";

///<inheritdoc/>
public string NativeName { get; } = "中国";

///<inheritdoc/>
public string Capital { get; } = "Beijing";

///<inheritdoc/>
public int NumericCode { get; } = 156;

///<inheritdoc/>
public string ISO2Code { get; } = "CN";

///<inheritdoc/>
public string ISO3Code { get; } = "CHN";

///<inheritdoc/>
public string CallingCode { get; } = "+86";

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Anhui", "CN-AH", "Province"),
new("Beijing", "CN-BJ", "Municipality"),
new("Chongqing", "CN-CQ", "Municipality"),
new("Fujian", "CN-FJ", "Province"),
new("Gansu", "CN-GS", "Province"),
new("Guangdong", "CN-GD", "Province"),
new("Guangxi Zhuang", "CN-GX", "Autonomous Region"),
new("Guizhou", "CN-GZ", "Province"),
new("Hainan", "CN-HI", "Province"),
new("Hebei", "CN-HE", "Province"),
new("Heilongjiang", "CN-HL", "Province"),
new("Henan", "CN-HA", "Province"),
new("Hong Kong SAR", "CN-HK", "Special Administrative Region"),
new("Hubei", "CN-HB", "Province"),
new("Hunan", "CN-HN", "Province"),
new("Inner Mongolia", "CN-NM", "Autonomous Region"),
new("Jiangsu", "CN-JS", "Province"),
new("Jiangxi", "CN-JX", "Province"),
new("Jilin", "CN-JL", "Province"),
new("Liaoning", "CN-LN", "Province"),
new("Macau SAR", "CN-MO", "Special Administrative Region"),
new("Ningxia Huizu", "CN-NX", "Autonomous Region"),
new("Qinghai", "CN-QH", "Province"),
new("Shaanxi", "CN-SN", "Province"),
new("Shandong", "CN-SD", "Province"),
new("Shanghai", "CN-SH", "Municipality"),
new("Shanxi", "CN-SX", "Province"),
new("Sichuan", "CN-SC", "Province"),
new("Taiwan", "CN-TW", "Province"),
new("Tianjin", "CN-TJ", "Municipality"),
new("Xinjiang", "CN-XJ", "Autonomous Region"),
new("Xizang", "CN-XZ", "Autonomous Region"),
new("Yunnan", "CN-YN", "Province"),
new("Zhejiang", "CN-ZJ", "Province"),
];
}
}
Loading