Skip to content

Commit 296f33f

Browse files
authored
Merge pull request #42 from deanology/CrCUCuCz
Add country information for Croatia, Cuba, Curaçao, Cyprus, and Czech…
2 parents c03080c + 411e38b commit 296f33f

11 files changed

Lines changed: 443 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class CroatiaTest
4+
{
5+
private const string CROATIA_COUNTRY_NAME = "Croatia";
6+
private const string CROATIA_NATIVE_NAME = "Hrvatska";
7+
private const string CROATIA_CAPITAL = "Zagreb";
8+
private const string CROATIA_OFFICIAL_NAME = "Republic of Croatia";
9+
private const string CROATIA_ISO2_CODE = "HR";
10+
private const string CROATIA_ISO3_CODE = "HRV";
11+
private const int CROATIA_NUMERIC_CODE = 191;
12+
private const string CROATIA_CALLING_CODE = "+385";
13+
private const int CROATIA_STATE_COUNT = 21;
14+
private static readonly string[] VALID_STATE_TYPES = { "City", "County" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCroatia()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.Croatia;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
// Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(CROATIA_COUNTRY_NAME, country.Name);
29+
Assert.Equal(CROATIA_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(CROATIA_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(CROATIA_CAPITAL, country.Capital);
32+
Assert.Equal(CROATIA_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(CROATIA_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(CROATIA_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(CROATIA_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(CROATIA_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class CubaTest
4+
{
5+
private const string CUBA_COUNTRY_NAME = "Cuba";
6+
private const string CUBA_NATIVE_NAME = "Cuba";
7+
private const string CUBA_CAPITAL = "Havana";
8+
private const string CUBA_OFFICIAL_NAME = "Republic of Cuba";
9+
private const string CUBA_ISO2_CODE = "CU";
10+
private const string CUBA_ISO3_CODE = "CUB";
11+
private const int CUBA_NUMERIC_CODE = 192;
12+
private const string CUBA_CALLING_CODE = "+53";
13+
private const int CUBA_STATE_COUNT = 16;
14+
private static readonly string[] VALID_STATE_TYPES = { "Province", "Special Municipality" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCuba()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.Cuba;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
// Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(CUBA_COUNTRY_NAME, country.Name);
29+
Assert.Equal(CUBA_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(CUBA_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(CUBA_CAPITAL, country.Capital);
32+
Assert.Equal(CUBA_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(CUBA_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(CUBA_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(CUBA_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(CUBA_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class CuraçaoTest
4+
{
5+
private const string CURACAO_COUNTRY_NAME = "Curaçao";
6+
private const string CURACAO_NATIVE_NAME = "Kòrsou";
7+
private const string CURACAO_CAPITAL = "Willemstad";
8+
private const string CURACAO_OFFICIAL_NAME = "Country of Curaçao";
9+
private const string CURACAO_ISO2_CODE = "CW";
10+
private const string CURACAO_ISO3_CODE = "CUW";
11+
private const int CURACAO_NUMERIC_CODE = 531;
12+
private const string CURACAO_CALLING_CODE = "+599";
13+
private const int CURACAO_STATE_COUNT = 1;
14+
private static readonly string[] VALID_STATE_TYPES = { "Country" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCuracao()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.Curacao;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
// Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(CURACAO_COUNTRY_NAME, country.Name);
29+
Assert.Equal(CURACAO_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(CURACAO_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(CURACAO_CAPITAL, country.Capital);
32+
Assert.Equal(CURACAO_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(CURACAO_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(CURACAO_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(CURACAO_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.NotEmpty(country.States);
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class CyprusTest
4+
{
5+
private const string CYPRUS_COUNTRY_NAME = "Cyprus";
6+
private const string CYPRUS_NATIVE_NAME = "Κύπρος";
7+
private const string CYPRUS_CAPITAL = "Nicosia";
8+
private const string CYPRUS_OFFICIAL_NAME = "Republic of Cyprus";
9+
private const string CYPRUS_ISO2_CODE = "CY";
10+
private const string CYPRUS_ISO3_CODE = "CYP";
11+
private const int CYPRUS_NUMERIC_CODE = 196;
12+
private const string CYPRUS_CALLING_CODE = "+357";
13+
private const int CYPRUS_STATE_COUNT = 6;
14+
private static readonly string[] VALID_STATE_TYPES = { "District" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCyprus()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.Cyprus;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
// Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(CYPRUS_COUNTRY_NAME, country.Name);
29+
Assert.Equal(CYPRUS_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(CYPRUS_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(CYPRUS_CAPITAL, country.Capital);
32+
Assert.Equal(CYPRUS_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(CYPRUS_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(CYPRUS_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(CYPRUS_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(CYPRUS_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class CzechRepublicTest
4+
{
5+
private const string CZECHREPUBLIC_COUNTRY_NAME = "Czech Republic";
6+
private const string CZECHREPUBLIC_NATIVE_NAME = "Česká republika";
7+
private const string CZECHREPUBLIC_CAPITAL = "Prague";
8+
private const string CZECHREPUBLIC_OFFICIAL_NAME = "Czech Republic";
9+
private const string CZECHREPUBLIC_ISO2_CODE = "CZ";
10+
private const string CZECHREPUBLIC_ISO3_CODE = "CZE";
11+
private const int CZECHREPUBLIC_NUMERIC_CODE = 203;
12+
private const string CZECHREPUBLIC_CALLING_CODE = "+420";
13+
private const int CZECHREPUBLIC_STATE_COUNT = 14;
14+
private static readonly string[] VALID_STATE_TYPES = { "Region", "Capital City" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCzechRepublic()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.CzechRepublic;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
// Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(CZECHREPUBLIC_COUNTRY_NAME, country.Name);
29+
Assert.Equal(CZECHREPUBLIC_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(CZECHREPUBLIC_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(CZECHREPUBLIC_CAPITAL, country.Capital);
32+
Assert.Equal(CZECHREPUBLIC_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(CZECHREPUBLIC_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(CZECHREPUBLIC_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(CZECHREPUBLIC_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(CZECHREPUBLIC_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}

src/World.Net/Countries/Croatia.cs

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Croatia : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Croatia;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Croatia";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Croatia";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Hrvatska";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Zagreb";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 191;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "HR";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "HRV";
28+
29+
//<inheritdoc/>
30+
public string CallingCode { get; } = "+385";
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Bjelovar-Bilogora", "HR-07", "County"),
36+
new("Brod-Posavina", "HR-12", "County"),
37+
new("Dubrovnik-Neretva", "HR-19", "County"),
38+
new("Istria", "HR-18", "County"),
39+
new("Karlovac", "HR-04", "County"),
40+
new("Koprivnica-Križevci", "HR-06", "County"),
41+
new("Krapina-Zagorje", "HR-02", "County"),
42+
new("Lika-Senj", "HR-09", "County"),
43+
new("Međimurje", "HR-20", "County"),
44+
new("Osijek-Baranja", "HR-14", "County"),
45+
new("Požega-Slavonia", "HR-11", "County"),
46+
new("Primorje-Gorski Kotar", "HR-08", "County"),
47+
new("Šibenik-Knin", "HR-15", "County"),
48+
new("Sisak-Moslavina", "HR-03", "County"),
49+
new("Split-Dalmatia", "HR-17", "County"),
50+
new("Varaždin", "HR-05", "County"),
51+
new("Virovitica-Podravina", "HR-10", "County"),
52+
new("Vukovar-Syrmia", "HR-16", "County"),
53+
new("Zadar", "HR-13", "County"),
54+
new("Zagreb", "HR-21", "City"),
55+
new("Zagreb County", "HR-01", "County")
56+
];
57+
}

src/World.Net/Countries/Cuba.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Cuba : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Cuba;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Cuba";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Cuba";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Cuba";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Havana";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 192;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "CU";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "CUB";
28+
29+
//<inheritdoc/>
30+
public string CallingCode { get; } = "+53";
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Artemisa", "CU-15", "Province"),
36+
new("Camagüey", "CU-09", "Province"),
37+
new("Ciego de Ávila", "CU-08", "Province"),
38+
new("Cienfuegos", "CU-06", "Province"),
39+
new("Granma", "CU-12", "Province"),
40+
new("Guantánamo", "CU-14", "Province"),
41+
new("Holguín", "CU-11", "Province"),
42+
new("Isla de la Juventud", "CU-99", "Special Municipality"),
43+
new("La Habana", "CU-03", "Province"),
44+
new("Las Tunas", "CU-10", "Province"),
45+
new("Matanzas", "CU-04", "Province"),
46+
new("Mayabeque", "CU-16", "Province"),
47+
new("Pinar del Río", "CU-01", "Province"),
48+
new("Sancti Spíritus", "CU-07", "Province"),
49+
new("Santiago de Cuba", "CU-13", "Province"),
50+
new("Villa Clara", "CU-05", "Province")
51+
];
52+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Curaçao : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Curacao;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Curaçao";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Country of Curaçao";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Kòrsou";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Willemstad";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 531;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "CW";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "CUW";
28+
29+
//<inheritdoc/>
30+
public string CallingCode { get; } = "+599";
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Curaçao", "CW", "Country")
36+
];
37+
}

src/World.Net/Countries/Cyprus.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Cyprus : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Cyprus;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Cyprus";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Cyprus";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Κύπρος";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Nicosia";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 196;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "CY";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "CYP";
28+
29+
//<inheritdoc/>
30+
public string CallingCode { get; } = "+357";
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Famagusta", "CY-04", "District"),
36+
new("Kyrenia", "CY-06", "District"),
37+
new("Larnaca", "CY-03", "District"),
38+
new("Limassol", "CY-02", "District"),
39+
new("Nicosia", "CY-01", "District"),
40+
new("Paphos", "CY-05", "District")
41+
];
42+
}

0 commit comments

Comments
 (0)