Skip to content

Commit d52cf05

Browse files
authored
Merge pull request #44 from ReaganDev/Congo_CookIslands_CostaRica_CoteDIvoire
add details for congo, Cook Islands, Costa Rica, Cote D''Ivoire
2 parents 296f33f + 19b1de7 commit d52cf05

9 files changed

Lines changed: 355 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace World.Net.UnitTests.Countries
2+
{
3+
public sealed class CongoTest
4+
{
5+
private const string CONGO_NAME = "Congo";
6+
private const int CONGO_STATE_COUNT = 12;
7+
private const string CONGO_OFFICIAL_NAME = "Democratic Republic of the Congo";
8+
private const string CONGO_NATIVE_NAME = "République du Congo";
9+
private const string CONGO_CAPITAL = "Brazzaville";
10+
private const int CONGO_NUMERIC_CODE = 178;
11+
private const string CONGO_ISO2_CODE = "CG";
12+
private const string CONGO_ISO3_CODE = "COG";
13+
private const string CONGO_CALLING_CODE = "+242";
14+
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCongo()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.Congo;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.Equal(existingCountryId, country.Id);
27+
Assert.Equal(CONGO_NAME, country.Name);
28+
Assert.NotNull(country.States);
29+
Assert.Equal(CONGO_STATE_COUNT, country.States.Count());
30+
Assert.Equal(CONGO_OFFICIAL_NAME, country.OfficialName);
31+
Assert.Equal(CONGO_NATIVE_NAME, country.NativeName);
32+
Assert.Equal(CONGO_CAPITAL, country.Capital);
33+
Assert.Equal(CONGO_NUMERIC_CODE, country.NumericCode);
34+
Assert.Equal(CONGO_ISO2_CODE, country.ISO2Code);
35+
Assert.Equal(CONGO_ISO3_CODE, country.ISO3Code);
36+
Assert.Equal(CONGO_CALLING_CODE, country.CallingCode);
37+
}
38+
}
39+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
namespace World.Net.UnitTests.Countries
2+
{
3+
public sealed class CookIslandsTest
4+
{
5+
private const string COOKISLANDS_NAME = "Cook Islands";
6+
private const string COOKISLANDS_OFFICIAL_NAME = "Cook Islands";
7+
private const string COOKISLANDS_NATIVE_NAME = "Cook Islands";
8+
private const string COOKISLANDS_CAPITAL = "Avarua";
9+
private const int COOKISLANDS_NUMERIC_CODE = 184;
10+
private const string COOKISLANDS_ISO2_CODE = "CK";
11+
private const string COOKISLANDS_ISO3_CODE = "COK";
12+
private const string COOKISLANDS_CALLING_CODE = "+682";
13+
14+
15+
[Fact]
16+
public void GetCountry_ReturnsCorrectInformation_ForCookIslands()
17+
{
18+
// Arrange
19+
CountryIdentifier existingCountryId = CountryIdentifier.CookIslands;
20+
21+
// Act
22+
var country = CountryProvider.GetCountry(existingCountryId);
23+
24+
//Assert
25+
Assert.Equal(existingCountryId, country.Id);
26+
Assert.Equal(COOKISLANDS_NAME, country.Name);
27+
Assert.NotNull(country.States);
28+
Assert.Empty(country.States);
29+
Assert.Equal(COOKISLANDS_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(COOKISLANDS_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(COOKISLANDS_CAPITAL, country.Capital);
32+
Assert.Equal(COOKISLANDS_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(COOKISLANDS_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(COOKISLANDS_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(COOKISLANDS_CALLING_CODE, country.CallingCode);
36+
}
37+
}
38+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace World.Net.UnitTests.Countries
2+
{
3+
public sealed class CostaRicaTest
4+
{
5+
private const string COSTARICA_NAME = "Costa Rica";
6+
private const int COSTARICA_STATE_COUNT = 7;
7+
private const string COSTARICA_OFFICIAL_NAME = "Republic of Costa Rica";
8+
private const string COSTARICA_NATIVE_NAME = "Costa Rica";
9+
private const string COSTARICA_CAPITAL = "San Jose";
10+
private const int COSTARICA_NUMERIC_CODE = 188;
11+
private const string COSTARICA_ISO2_CODE = "CR";
12+
private const string COSTARICA_ISO3_CODE = "CRI";
13+
private const string COSTARICA_CALLING_CODE = "+506";
14+
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCostaRica()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.CostaRica;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.Equal(existingCountryId, country.Id);
27+
Assert.Equal(COSTARICA_NAME, country.Name);
28+
Assert.NotNull(country.States);
29+
Assert.Equal(COSTARICA_STATE_COUNT, country.States.Count());
30+
Assert.Equal(COSTARICA_OFFICIAL_NAME, country.OfficialName);
31+
Assert.Equal(COSTARICA_NATIVE_NAME, country.NativeName);
32+
Assert.Equal(COSTARICA_CAPITAL, country.Capital);
33+
Assert.Equal(COSTARICA_NUMERIC_CODE, country.NumericCode);
34+
Assert.Equal(COSTARICA_ISO2_CODE, country.ISO2Code);
35+
Assert.Equal(COSTARICA_ISO3_CODE, country.ISO3Code);
36+
Assert.Equal(COSTARICA_CALLING_CODE, country.CallingCode);
37+
}
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace World.Net.UnitTests.Countries
2+
{
3+
public sealed class CoteDIvoireTest
4+
{
5+
private const string COTEDIVOIRE_NAME = "Ivory Coast";
6+
private const int COTEDIVOIRE_STATE_COUNT = 31;
7+
private const string COTEDIVOIRE_OFFICIAL_NAME = "Republic of Côte d'Ivoire";
8+
private const string COTEDIVOIRE_NATIVE_NAME = "Côte d'Ivoire";
9+
private const string COTEDIVOIRE_CAPITAL = "Yamoussoukro";
10+
private const int COTEDIVOIRE_NUMERIC_CODE = 384;
11+
private const string COTEDIVOIRE_ISO2_CODE = "CI";
12+
private const string COTEDIVOIRE_ISO3_CODE = "CIV";
13+
private const string COTEDIVOIRE_CALLING_CODE = "+225";
14+
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForCookIslands()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.CoteDIvoire;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.Equal(existingCountryId, country.Id);
27+
Assert.Equal(COTEDIVOIRE_NAME, country.Name);
28+
Assert.NotNull(country.States);
29+
Assert.Equal(COTEDIVOIRE_STATE_COUNT, country.States.Count());
30+
Assert.Equal(COTEDIVOIRE_OFFICIAL_NAME, country.OfficialName);
31+
Assert.Equal(COTEDIVOIRE_NATIVE_NAME, country.NativeName);
32+
Assert.Equal(COTEDIVOIRE_CAPITAL, country.Capital);
33+
Assert.Equal(COTEDIVOIRE_NUMERIC_CODE, country.NumericCode);
34+
Assert.Equal(COTEDIVOIRE_ISO2_CODE, country.ISO2Code);
35+
Assert.Equal(COTEDIVOIRE_ISO3_CODE, country.ISO3Code);
36+
Assert.Equal(COTEDIVOIRE_CALLING_CODE, country.CallingCode);
37+
}
38+
}
39+
}

src/World.Net/Countries/Congo.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
namespace World.Net.Countries
2+
{
3+
internal sealed class Congo : ICountry
4+
{
5+
///<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Congo;
7+
8+
///<inheritdoc/>
9+
public string Name => nameof(Congo);
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = "Democratic Republic of the Congo";
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = "République du Congo";
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = "Brazzaville";
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 178;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "CG";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "COG";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+242";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States { get; } =
34+
[
35+
new("Bouenza", "CG-11", "Department"),
36+
new("Brazzaville", "CG-BZV", "Department"),
37+
new("Cuvette", "CG-8", "Department"),
38+
new("Cuvette-Ouest", "CG-15", "Department"),
39+
new("Kouilou", "CG-5", "Department"),
40+
new("Lékoumou", "CG-2", "Department"),
41+
new("Likouala", "CG-7", "Department"),
42+
new("Niari", "CG-9", "Department"),
43+
new("Plateaux", "CG-14", "Department"),
44+
new("Pointe-Noire", "CG-16", "Department"),
45+
new("Pool", "CG-12", "Department"),
46+
new("Sangha", "CG-13", "Department"),
47+
];
48+
}
49+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace World.Net.Countries
2+
{
3+
internal sealed class CookIslands : ICountry
4+
{
5+
///<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.CookIslands;
7+
8+
///<inheritdoc/>
9+
public string Name => "Cook Islands";
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = "Cook Islands";
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = "Cook Islands";
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = "Avarua";
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 184;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "CK";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "COK";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+682";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States { get; } = [];
34+
}
35+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
namespace World.Net.Countries
2+
{
3+
internal sealed class CostaRica : ICountry
4+
{
5+
///<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.CostaRica;
7+
8+
///<inheritdoc/>
9+
public string Name => "Costa Rica";
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Costa Rica";
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = "Costa Rica";
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = "San Jose";
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 188;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "CR";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "CRI";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+506";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States { get; } =
34+
[
35+
new("Alajuela", "CR-A", "Province"),
36+
new("Cartago", "CR-C", "Province"),
37+
new("Guanacaste", "CR-G", "Province"),
38+
new("Heredia", "CR-H", "Province"),
39+
new("Limón", "CR-L", "Province"),
40+
new("Puntarenas", "CR-P", "Province"),
41+
new("San José", "CR-SJ", "Province"),
42+
];
43+
}
44+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
namespace World.Net.Countries
2+
{
3+
internal sealed class CoteDIvoire : ICountry
4+
{
5+
///<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.CoteDIvoire;
7+
8+
///<inheritdoc/>
9+
public string Name => "Ivory Coast";
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Côte d'Ivoire";
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = "Côte d'Ivoire";
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = "Yamoussoukro";
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 384;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "CI";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "CIV";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+225";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States { get; } =
34+
[
35+
new("Abidjan", "CI-AB", "Autonomous District"),
36+
new("Agnéby", "CI-16", "Region"),
37+
new("Bafing", "CI-17", "Region"),
38+
new("Bas-Sassandra", "CI-BS", "District"),
39+
new("Bas-Sassandra", "CI-09", "Region"),
40+
new("Comoé", "CI-CM", "District"),
41+
new("Denguélé", "CI-DN", "District"),
42+
new("Denguélé", "CI-10", "Region"),
43+
new("Dix-Huit Montagnes", "CI-06", "Region"),
44+
new("Fromager", "CI-18", "Region"),
45+
new("Gôh-Djiboua", "CI-GD", "District"),
46+
new("Haut-Sassandra", "CI-02", "Region"),
47+
new("Lacs", "CI-07", "Region"),
48+
new("Lacs", "CI-LC", "District"),
49+
new("Lagunes", "CI-01", "Region"),
50+
new("Lagunes", "CI-LG", "District"),
51+
new("Marahoué", "CI-12", "Region"),
52+
new("Montagnes", "CI-MG", "District"),
53+
new("Moyen-Cavally", "CI-19", "Region"),
54+
new("Moyen-Comoé", "CI-05", "Region"),
55+
new("N'zi-Comoé", "CI-11", "Region"),
56+
new("Sassandra-Marahoué", "CI-SM", "District"),
57+
new("Savanes", "CI-03", "Region"),
58+
new("Sud-Bandama", "CI-15", "Region"),
59+
new("Sud-Comoé", "CI-13", "Region"),
60+
new("Vallée du Bandama", "CI-04", "Region"),
61+
new("Vallée du Bandama", "CI-VB", "District"),
62+
new("Woroba", "CI-WR", "District"),
63+
new("Worodougou", "CI-14", "Region"),
64+
new("Yamoussoukro", "CI-YM", "District"),
65+
new("Zanzan", "CI-ZZ", "District"),
66+
];
67+
}
68+
}

src/World.Net/Helpers/CountryInitializer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
5555
{ CountryIdentifier.CocosKeelingIslands, new CocosKeelingIslands() },
5656
{ CountryIdentifier.Colombia, new Colombia() },
5757
{ CountryIdentifier.Comoros, new Comoros() },
58+
{ CountryIdentifier.Congo, new Congo() },
59+
{ CountryIdentifier.CostaRica, new CostaRica() },
60+
{ CountryIdentifier.CookIslands, new CookIslands() },
61+
{ CountryIdentifier.CoteDIvoire, new CoteDIvoire() },
5862
{ CountryIdentifier.Croatia, new Croatia() },
5963
{ CountryIdentifier.Cuba, new Cuba() },
6064
{ CountryIdentifier.Curacao, new Curaçao() },

0 commit comments

Comments
 (0)