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
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CroatiaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CroatiaTest
{
private const string CROATIA_COUNTRY_NAME = "Croatia";
private const string CROATIA_NATIVE_NAME = "Hrvatska";
private const string CROATIA_CAPITAL = "Zagreb";
private const string CROATIA_OFFICIAL_NAME = "Republic of Croatia";
private const string CROATIA_ISO2_CODE = "HR";
private const string CROATIA_ISO3_CODE = "HRV";
private const int CROATIA_NUMERIC_CODE = 191;
private const string CROATIA_CALLING_CODE = "+385";
private const int CROATIA_STATE_COUNT = 21;
private static readonly string[] VALID_STATE_TYPES = { "City", "County" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCroatia()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Croatia;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CROATIA_COUNTRY_NAME, country.Name);
Assert.Equal(CROATIA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CROATIA_NATIVE_NAME, country.NativeName);
Assert.Equal(CROATIA_CAPITAL, country.Capital);
Assert.Equal(CROATIA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CROATIA_ISO2_CODE, country.ISO2Code);
Assert.Equal(CROATIA_ISO3_CODE, country.ISO3Code);
Assert.Equal(CROATIA_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CROATIA_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CubaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CubaTest
{
private const string CUBA_COUNTRY_NAME = "Cuba";
private const string CUBA_NATIVE_NAME = "Cuba";
private const string CUBA_CAPITAL = "Havana";
private const string CUBA_OFFICIAL_NAME = "Republic of Cuba";
private const string CUBA_ISO2_CODE = "CU";
private const string CUBA_ISO3_CODE = "CUB";
private const int CUBA_NUMERIC_CODE = 192;
private const string CUBA_CALLING_CODE = "+53";
private const int CUBA_STATE_COUNT = 16;
private static readonly string[] VALID_STATE_TYPES = { "Province", "Special Municipality" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCuba()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Cuba;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CUBA_COUNTRY_NAME, country.Name);
Assert.Equal(CUBA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CUBA_NATIVE_NAME, country.NativeName);
Assert.Equal(CUBA_CAPITAL, country.Capital);
Assert.Equal(CUBA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CUBA_ISO2_CODE, country.ISO2Code);
Assert.Equal(CUBA_ISO3_CODE, country.ISO3Code);
Assert.Equal(CUBA_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CUBA_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CuraçaoTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CuraçaoTest
{
private const string CURACAO_COUNTRY_NAME = "Curaçao";
private const string CURACAO_NATIVE_NAME = "Kòrsou";
private const string CURACAO_CAPITAL = "Willemstad";
private const string CURACAO_OFFICIAL_NAME = "Country of Curaçao";
private const string CURACAO_ISO2_CODE = "CW";
private const string CURACAO_ISO3_CODE = "CUW";
private const int CURACAO_NUMERIC_CODE = 531;
private const string CURACAO_CALLING_CODE = "+599";
private const int CURACAO_STATE_COUNT = 1;
private static readonly string[] VALID_STATE_TYPES = { "Country" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCuracao()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Curacao;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CURACAO_COUNTRY_NAME, country.Name);
Assert.Equal(CURACAO_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CURACAO_NATIVE_NAME, country.NativeName);
Assert.Equal(CURACAO_CAPITAL, country.Capital);
Assert.Equal(CURACAO_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CURACAO_ISO2_CODE, country.ISO2Code);
Assert.Equal(CURACAO_ISO3_CODE, country.ISO3Code);
Assert.Equal(CURACAO_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.NotEmpty(country.States);
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CyprusTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CyprusTest
{
private const string CYPRUS_COUNTRY_NAME = "Cyprus";
private const string CYPRUS_NATIVE_NAME = "Κύπρος";
private const string CYPRUS_CAPITAL = "Nicosia";
private const string CYPRUS_OFFICIAL_NAME = "Republic of Cyprus";
private const string CYPRUS_ISO2_CODE = "CY";
private const string CYPRUS_ISO3_CODE = "CYP";
private const int CYPRUS_NUMERIC_CODE = 196;
private const string CYPRUS_CALLING_CODE = "+357";
private const int CYPRUS_STATE_COUNT = 6;
private static readonly string[] VALID_STATE_TYPES = { "District" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCyprus()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Cyprus;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CYPRUS_COUNTRY_NAME, country.Name);
Assert.Equal(CYPRUS_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CYPRUS_NATIVE_NAME, country.NativeName);
Assert.Equal(CYPRUS_CAPITAL, country.Capital);
Assert.Equal(CYPRUS_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CYPRUS_ISO2_CODE, country.ISO2Code);
Assert.Equal(CYPRUS_ISO3_CODE, country.ISO3Code);
Assert.Equal(CYPRUS_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CYPRUS_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CzechRepublicTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CzechRepublicTest
{
private const string CZECHREPUBLIC_COUNTRY_NAME = "Czech Republic";
private const string CZECHREPUBLIC_NATIVE_NAME = "Česká republika";
private const string CZECHREPUBLIC_CAPITAL = "Prague";
private const string CZECHREPUBLIC_OFFICIAL_NAME = "Czech Republic";
private const string CZECHREPUBLIC_ISO2_CODE = "CZ";
private const string CZECHREPUBLIC_ISO3_CODE = "CZE";
private const int CZECHREPUBLIC_NUMERIC_CODE = 203;
private const string CZECHREPUBLIC_CALLING_CODE = "+420";
private const int CZECHREPUBLIC_STATE_COUNT = 14;
private static readonly string[] VALID_STATE_TYPES = { "Region", "Capital City" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCzechRepublic()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.CzechRepublic;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CZECHREPUBLIC_COUNTRY_NAME, country.Name);
Assert.Equal(CZECHREPUBLIC_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CZECHREPUBLIC_NATIVE_NAME, country.NativeName);
Assert.Equal(CZECHREPUBLIC_CAPITAL, country.Capital);
Assert.Equal(CZECHREPUBLIC_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CZECHREPUBLIC_ISO2_CODE, country.ISO2Code);
Assert.Equal(CZECHREPUBLIC_ISO3_CODE, country.ISO3Code);
Assert.Equal(CZECHREPUBLIC_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CZECHREPUBLIC_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
57 changes: 57 additions & 0 deletions src/World.Net/Countries/Croatia.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace World.Net.Countries;

internal sealed class Croatia : ICountry
{
//<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Croatia;

//<inheritdoc/>
public string Name { get; } = "Croatia";

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

//<inheritdoc/>
public string NativeName => "Hrvatska";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Bjelovar-Bilogora", "HR-07", "County"),
new("Brod-Posavina", "HR-12", "County"),
new("Dubrovnik-Neretva", "HR-19", "County"),
new("Istria", "HR-18", "County"),
new("Karlovac", "HR-04", "County"),
new("Koprivnica-Križevci", "HR-06", "County"),
new("Krapina-Zagorje", "HR-02", "County"),
new("Lika-Senj", "HR-09", "County"),
new("Međimurje", "HR-20", "County"),
new("Osijek-Baranja", "HR-14", "County"),
new("Požega-Slavonia", "HR-11", "County"),
new("Primorje-Gorski Kotar", "HR-08", "County"),
new("Šibenik-Knin", "HR-15", "County"),
new("Sisak-Moslavina", "HR-03", "County"),
new("Split-Dalmatia", "HR-17", "County"),
new("Varaždin", "HR-05", "County"),
new("Virovitica-Podravina", "HR-10", "County"),
new("Vukovar-Syrmia", "HR-16", "County"),
new("Zadar", "HR-13", "County"),
new("Zagreb", "HR-21", "City"),
new("Zagreb County", "HR-01", "County")
];
}
52 changes: 52 additions & 0 deletions src/World.Net/Countries/Cuba.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace World.Net.Countries;

internal sealed class Cuba : ICountry
{
//<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Cuba;

//<inheritdoc/>
public string Name { get; } = "Cuba";

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

//<inheritdoc/>
public string NativeName => "Cuba";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Artemisa", "CU-15", "Province"),
new("Camagüey", "CU-09", "Province"),
new("Ciego de Ávila", "CU-08", "Province"),
new("Cienfuegos", "CU-06", "Province"),
new("Granma", "CU-12", "Province"),
new("Guantánamo", "CU-14", "Province"),
new("Holguín", "CU-11", "Province"),
new("Isla de la Juventud", "CU-99", "Special Municipality"),
new("La Habana", "CU-03", "Province"),
new("Las Tunas", "CU-10", "Province"),
new("Matanzas", "CU-04", "Province"),
new("Mayabeque", "CU-16", "Province"),
new("Pinar del Río", "CU-01", "Province"),
new("Sancti Spíritus", "CU-07", "Province"),
new("Santiago de Cuba", "CU-13", "Province"),
new("Villa Clara", "CU-05", "Province")
];
}
37 changes: 37 additions & 0 deletions src/World.Net/Countries/Curaçao.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace World.Net.Countries;

internal sealed class Curaçao : ICountry
{
//<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Curacao;

//<inheritdoc/>
public string Name { get; } = "Curaçao";

//<inheritdoc/>
public string OfficialName { get; } = "Country of Curaçao";

//<inheritdoc/>
public string NativeName => "Kòrsou";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Curaçao", "CW", "Country")
];
}
42 changes: 42 additions & 0 deletions src/World.Net/Countries/Cyprus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.Countries;

internal sealed class Cyprus : ICountry
{
//<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Cyprus;

//<inheritdoc/>
public string Name { get; } = "Cyprus";

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

//<inheritdoc/>
public string NativeName => "Κύπρος";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Famagusta", "CY-04", "District"),
new("Kyrenia", "CY-06", "District"),
new("Larnaca", "CY-03", "District"),
new("Limassol", "CY-02", "District"),
new("Nicosia", "CY-01", "District"),
new("Paphos", "CY-05", "District")
];
}
Loading