Skip to content

Commit 3cc446b

Browse files
authored
add country details for France, FrenchGuiana and FrenchPolynesia (#56)
* add country details for France, FrenchGuiana and FrenchPolynesia * resolved comments
1 parent 55ebe0e commit 3cc446b

7 files changed

Lines changed: 341 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+
public sealed class FranceTest
3+
{
4+
private const string FRANCE_NAME = "France";
5+
private const int FRANCE_STATE_COUNT = 116;
6+
private const string FRANCE_OFFICIAL_NAME = "French Republic";
7+
private const string FRANCE_NATIVE_NAME = "France";
8+
private const string FRANCE_CAPITAL = "Paris";
9+
private const int FRANCE_NUMERIC_CODE = 250;
10+
private const string FRANCE_ISO2_CODE = "FR";
11+
private static readonly string[] VALID_STATE_TYPES = { "metropolitan department", "European collectivity", "metropolitan region", "dependency", "metropolitan collectivity with special status", "overseas region", "overseas collectivity", "overseas territory", "overseas region", "metropolitan department", "metropolitan department", };
12+
private const string FRANCE_ISO3_CODE = "FRA";
13+
private readonly string[] FRANCE_CALLING_CODE = ["+33"];
14+
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForFrance()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.France;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.Equal(existingCountryId, country.Id);
27+
Assert.Equal(FRANCE_NAME, country.Name);
28+
Assert.NotNull(country.States);
29+
Assert.Equal(FRANCE_STATE_COUNT, country.States.Count());
30+
Assert.Equal(FRANCE_OFFICIAL_NAME, country.OfficialName);
31+
Assert.Equal(FRANCE_NATIVE_NAME, country.NativeName);
32+
Assert.Equal(FRANCE_CAPITAL, country.Capital);
33+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
34+
Assert.Equal(FRANCE_NUMERIC_CODE, country.NumericCode);
35+
Assert.Equal(FRANCE_ISO2_CODE, country.ISO2Code);
36+
Assert.Equal(FRANCE_ISO3_CODE, country.ISO3Code);
37+
Assert.Equal(FRANCE_CALLING_CODE, country.CallingCode);
38+
}
39+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
namespace World.Net.UnitTests.Countries;
2+
public sealed class FrenchGuianaTest
3+
{
4+
private const string FRENCH_GUIANA_NAME = "French Guiana";
5+
private const string FRENCH_GUIANA_OFFICIAL_NAME = "Guyane française";
6+
private const string FRENCH_GUIANA_NATIVE_NAME = "Guyane française";
7+
private const string FRENCH_GUIANA_CAPITAL = "Cayenne";
8+
private const int FRENCH_GUIANA_NUMERIC_CODE = 254;
9+
private const string FRENCH_GUIANA_ISO2_CODE = "GF";
10+
private const string FRENCH_GUIANA_ISO3_CODE = "GUF";
11+
private readonly string[] FRENCH_GUIANA_CALLING_CODE = ["+594"];
12+
13+
14+
[Fact]
15+
public void GetCountry_ReturnsCorrectInformation_ForFrench_Guiana()
16+
{
17+
// Arrange
18+
CountryIdentifier existingCountryId = CountryIdentifier.FrenchGuiana;
19+
20+
// Act
21+
var country = CountryProvider.GetCountry(existingCountryId);
22+
23+
//Assert
24+
Assert.Equal(existingCountryId, country.Id);
25+
Assert.Equal(FRENCH_GUIANA_NAME, country.Name);
26+
Assert.NotNull(country.States);
27+
Assert.Empty(country.States);
28+
Assert.Equal(FRENCH_GUIANA_OFFICIAL_NAME, country.OfficialName);
29+
Assert.Equal(FRENCH_GUIANA_NATIVE_NAME, country.NativeName);
30+
Assert.Equal(FRENCH_GUIANA_CAPITAL, country.Capital);
31+
Assert.Equal(FRENCH_GUIANA_NUMERIC_CODE, country.NumericCode);
32+
Assert.Equal(FRENCH_GUIANA_ISO2_CODE, country.ISO2Code);
33+
Assert.Equal(FRENCH_GUIANA_ISO3_CODE, country.ISO3Code);
34+
Assert.Equal(FRENCH_GUIANA_CALLING_CODE, country.CallingCode);
35+
}
36+
}
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+
public sealed class FrenchPolynesiaTest
3+
{
4+
private const string FRENCH_POLYNESIA_NAME = "French Polynesia";
5+
private const int FRENCH_POLYNESIA_STATE_COUNT = 5;
6+
private const string FRENCH_POLYNESIA_OFFICIAL_NAME = "Polynésie française";
7+
private const string FRENCH_POLYNESIA_NATIVE_NAME = "Polynésie française";
8+
private const string FRENCH_POLYNESIA_CAPITAL = "Papeete";
9+
private const int FRENCH_POLYNESIA_NUMERIC_CODE = 258;
10+
private const string FRENCH_POLYNESIA_ISO2_CODE = "PF";
11+
private const string FRENCH_POLYNESIA_ISO3_CODE = "PYF";
12+
private static readonly string[] VALID_STATE_TYPES = { "division" };
13+
private readonly string[] FRENCH_POLYNESIA_CALLING_CODE = ["+689"];
14+
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForFrench_Polynesia()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.FrenchPolynesia;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.Equal(existingCountryId, country.Id);
27+
Assert.Equal(FRENCH_POLYNESIA_NAME, country.Name);
28+
Assert.NotNull(country.States);
29+
Assert.Equal(FRENCH_POLYNESIA_STATE_COUNT, country.States.Count());
30+
Assert.Equal(FRENCH_POLYNESIA_OFFICIAL_NAME, country.OfficialName);
31+
Assert.Equal(FRENCH_POLYNESIA_NATIVE_NAME, country.NativeName);
32+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
33+
Assert.Equal(FRENCH_POLYNESIA_CAPITAL, country.Capital);
34+
Assert.Equal(FRENCH_POLYNESIA_NUMERIC_CODE, country.NumericCode);
35+
Assert.Equal(FRENCH_POLYNESIA_ISO2_CODE, country.ISO2Code);
36+
Assert.Equal(FRENCH_POLYNESIA_ISO3_CODE, country.ISO3Code);
37+
Assert.Equal(FRENCH_POLYNESIA_CALLING_CODE, country.CallingCode);
38+
}
39+
}

src/World.Net/Countries/France.cs

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
namespace World.Net.Countries;
2+
internal sealed class France : ICountry
3+
{
4+
///<inheritdoc/>
5+
public CountryIdentifier Id => CountryIdentifier.France;
6+
7+
///<inheritdoc/>
8+
public string Name => nameof(France);
9+
10+
///<inheritdoc/>
11+
public string OfficialName { get; } = "French Republic";
12+
13+
///<inheritdoc/>
14+
public string NativeName { get; } = "France";
15+
16+
///<inheritdoc/>
17+
public string Capital { get; } = "Paris";
18+
19+
///<inheritdoc/>
20+
public int NumericCode { get; } = 250;
21+
22+
///<inheritdoc/>
23+
public string ISO2Code { get; } = "FR";
24+
25+
///<inheritdoc/>
26+
public string ISO3Code { get; } = "FRA";
27+
28+
///<inheritdoc/>
29+
public string[] CallingCode { get; } = ["+33"];
30+
31+
///<inheritdoc/>
32+
public IEnumerable<State> States { get; } =
33+
[
34+
new("Ain", "FR-01", "metropolitan department"),
35+
new("Aisne", "FR-02", "metropolitan department"),
36+
new("Allier", "FR-03", "metropolitan department"),
37+
new("Alpes-de-Haute-Provence", "FR-04", "metropolitan department"),
38+
new("Alpes-Maritimes", "FR-06", "metropolitan department"),
39+
new("Alsace", "FR-6AE", "European collectivity"),
40+
new("Ardèche", "FR-07", "metropolitan department"),
41+
new("Ardennes", "FR-08", "metropolitan department"),
42+
new("Ariège", "FR-09", "metropolitan department"),
43+
new("Aube", "FR-10", "metropolitan department"),
44+
new("Aude", "FR-11", "metropolitan department"),
45+
new("Auvergne-Rhône-Alpes", "FR-ARA", "metropolitan region"),
46+
new("Aveyron", "FR-12", "metropolitan department"),
47+
new("Bas-Rhin", "FR-67", "metropolitan department"),
48+
new("Bouches-du-Rhône", "FR-13", "metropolitan department"),
49+
new("Bourgogne-Franche-Comté", "FR-BFC", "metropolitan region"),
50+
new("Bretagne", "FR-BRE", "metropolitan region"),
51+
new("Calvados", "FR-14", "metropolitan department"),
52+
new("Cantal", "FR-15", "metropolitan department"),
53+
new("Centre-Val de Loire", "FR-CVL", "metropolitan region"),
54+
new("Charente", "FR-16", "metropolitan department"),
55+
new("Charente-Maritime", "FR-17", "metropolitan department"),
56+
new("Cher", "FR-18", "metropolitan department"),
57+
new("Clipperton", "FR-CP", "dependency"),
58+
new("Corrèze", "FR-19", "metropolitan department"),
59+
new("Corse", "FR-20R", "metropolitan collectivity with special status"),
60+
new("Corse-du-Sud", "FR-2A", "metropolitan department"),
61+
new("Côte-d'Or", "FR-21", "metropolitan department"),
62+
new("Côtes-d'Armor", "FR-22", "metropolitan department"),
63+
new("Creuse", "FR-23", "metropolitan department"),
64+
new("Deux-Sèvres", "FR-79", "metropolitan department"),
65+
new("Dordogne", "FR-24", "metropolitan department"),
66+
new("Doubs", "FR-25", "metropolitan department"),
67+
new("Drôme", "FR-26", "metropolitan department"),
68+
new("Essonne", "FR-91", "metropolitan department"),
69+
new("Eure", "FR-27", "metropolitan department"),
70+
new("Eure-et-Loir", "FR-28", "metropolitan department"),
71+
new("Finistère", "FR-29", "metropolitan department"),
72+
new("French Guiana", "FR-973", "overseas region"),
73+
new("French Polynesia", "FR-PF", "overseas collectivity"),
74+
new("French Southern and Antarctic Lands", "FR-TF", "overseas territory"),
75+
new("Gard", "FR-30", "metropolitan department"),
76+
new("Gers", "FR-32", "metropolitan department"),
77+
new("Gironde", "FR-33", "metropolitan department"),
78+
new("Grand-Est", "FR-GES", "metropolitan region"),
79+
new("Guadeloupe", "FR-971", "overseas region"),
80+
new("Haut-Rhin", "FR-68", "metropolitan department"),
81+
new("Haute-Corse", "FR-2B", "metropolitan department"),
82+
new("Haute-Garonne", "FR-31", "metropolitan department"),
83+
new("Haute-Loire", "FR-43", "metropolitan department"),
84+
new("Haute-Marne", "FR-52", "metropolitan department"),
85+
new("Haute-Saône", "FR-70", "metropolitan department"),
86+
new("Haute-Savoie", "FR-74", "metropolitan department"),
87+
new("Haute-Vienne", "FR-87", "metropolitan department"),
88+
new("Hautes-Alpes", "FR-05", "metropolitan department"),
89+
new("Hautes-Pyrénées", "FR-65", "metropolitan department"),
90+
new("Hauts-de-France", "FR-HDF", "metropolitan region"),
91+
new("Hauts-de-Seine", "FR-92", "metropolitan department"),
92+
new("Hérault", "FR-34", "metropolitan department"),
93+
new("Île-de-France", "FR-IDF", "metropolitan region"),
94+
new("Ille-et-Vilaine", "FR-35", "metropolitan department"),
95+
new("Indre", "FR-36", "metropolitan department"),
96+
new("Indre-et-Loire", "FR-37", "metropolitan department"),
97+
new("Isère", "FR-38", "metropolitan department"),
98+
new("Jura", "FR-39", "metropolitan department"),
99+
new("La Réunion", "FR-974", "overseas region"),
100+
new("Landes", "FR-40", "metropolitan department"),
101+
new("Loir-et-Cher", "FR-41", "metropolitan department"),
102+
new("Loire", "FR-42", "metropolitan department"),
103+
new("Loire-Atlantique", "FR-44", "metropolitan department"),
104+
new("Loiret", "FR-45", "metropolitan department"),
105+
new("Lot", "FR-46", "metropolitan department"),
106+
new("Lot-et-Garonne", "FR-47", "metropolitan department"),
107+
new("Lozère", "FR-48", "metropolitan department"),
108+
new("Maine-et-Loire", "FR-49", "metropolitan department"),
109+
new("Manche", "FR-50", "metropolitan department"),
110+
new("Marne", "FR-51", "metropolitan department"),
111+
new("Martinique", "FR-972", "overseas region"),
112+
new("Mayenne", "FR-53", "metropolitan department"),
113+
new("Mayotte", "FR-976", "overseas region"),
114+
new("Métropole de Lyon", "FR-69M", "metropolitan department"),
115+
new("Meurthe-et-Moselle", "FR-54", "metropolitan department"),
116+
new("Meuse", "FR-55", "metropolitan department"),
117+
new("Morbihan", "FR-56", "metropolitan department"),
118+
new("Moselle", "FR-57", "metropolitan department"),
119+
new("Nièvre", "FR-58", "metropolitan department"),
120+
new("Nord", "FR-59", "metropolitan department"),
121+
new("Oise", "FR-60", "metropolitan department"),
122+
new("Oléron", "FR-OL", "dependency"),
123+
new("Orne", "FR-61", "metropolitan department"),
124+
new("Paris", "FR-75", "metropolitan department"),
125+
new("Pas-de-Calais", "FR-62", "metropolitan department"),
126+
new("Puy-de-Dôme", "FR-63", "metropolitan department"),
127+
new("Pyrénées-Atlantiques", "FR-64", "metropolitan department"),
128+
new("Pyrénées-Orientales", "FR-66", "metropolitan department"),
129+
new("Réunion", "FR-974", "overseas region"),
130+
new("Rhône", "FR-69", "metropolitan department"),
131+
new("Saône-et-Loire", "FR-71", "metropolitan department"),
132+
new("Sarthe", "FR-72", "metropolitan department"),
133+
new("Savoie", "FR-73", "metropolitan department"),
134+
new("Seine-et-Marne", "FR-77", "metropolitan department"),
135+
new("Seine-Maritime", "FR-76", "metropolitan department"),
136+
new("Yvelines", "FR-78", "metropolitan department"),
137+
new("Somme", "FR-80", "metropolitan department"),
138+
new("Tarn", "FR-81", "metropolitan department"),
139+
new("Tarn-et-Garonne", "FR-82", "metropolitan department"),
140+
new("Territoire de Belfort", "FR-90", "metropolitan department"),
141+
new("Val-de-Marne", "FR-94", "metropolitan department"),
142+
new("Val-d'Oise", "FR-95", "metropolitan department"),
143+
new("Var", "FR-83", "metropolitan department"),
144+
new("Vaucluse", "FR-84", "metropolitan department"),
145+
new("Vendée", "FR-85", "metropolitan department"),
146+
new("Vienne", "FR-86", "metropolitan department"),
147+
new("Vosges", "FR-88", "metropolitan department"),
148+
new("Yonne", "FR-89", "metropolitan department"),
149+
new("Yvelines", "FR-78", "metropolitan department")
150+
];
151+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
namespace World.Net.Countries;
2+
internal sealed class FrenchGuiana : ICountry
3+
{
4+
//<inheritdoc/>
5+
public CountryIdentifier Id => CountryIdentifier.FrenchGuiana;
6+
7+
//<inheritdoc/>
8+
public string Name { get; } = "French Guiana";
9+
10+
//<inheritdoc/>
11+
public string OfficialName { get; } = "Guyane française";
12+
13+
//<inheritdoc/>
14+
public string NativeName => "Guyane française";
15+
16+
//<inheritdoc/>
17+
public string Capital { get; } = "Cayenne";
18+
19+
//<inheritdoc/>
20+
public int NumericCode { get; } = 254;
21+
22+
//<inheritdoc/>
23+
public string ISO2Code { get; } = "GF";
24+
25+
//<inheritdoc/>
26+
public string ISO3Code { get; } = "GUF";
27+
28+
//<inheritdoc/>
29+
public string[] CallingCode { get; } = ["+594"];
30+
31+
//<inheritdoc/>
32+
public IEnumerable<State> States => [];
33+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.Countries;
2+
internal sealed class FrenchPolynesia : ICountry
3+
{
4+
//<inheritdoc/>
5+
public CountryIdentifier Id => CountryIdentifier.FrenchPolynesia;
6+
7+
//<inheritdoc/>
8+
public string Name { get; } = "French Polynesia";
9+
10+
//<inheritdoc/>
11+
public string OfficialName { get; } = "Polynésie française";
12+
13+
//<inheritdoc/>
14+
public string NativeName => "Polynésie française";
15+
16+
//<inheritdoc/>
17+
public string Capital { get; } = "Papeete";
18+
19+
//<inheritdoc/>
20+
public int NumericCode { get; } = 258;
21+
22+
//<inheritdoc/>
23+
public string ISO2Code { get; } = "PF";
24+
25+
//<inheritdoc/>
26+
public string ISO3Code { get; } = "PYF";
27+
28+
//<inheritdoc/>
29+
public string[] CallingCode { get; } = ["+689"];
30+
31+
//<inheritdoc/>
32+
public IEnumerable<State> States =>
33+
[
34+
new("N'Austral Islands", "PF-01", "division"),
35+
new("Leeward Islands", "PF-02", "division"),
36+
new("Marquesas Islands", "PF-03", "division"),
37+
new("Tuamotu-Gambier", "PF-04", "division"),
38+
new("Windward Islands", "PF-05", "division"),
39+
];
40+
}

src/World.Net/Helpers/CountryInitializer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
7171
{ CountryIdentifier.Denmark, new Denmark() },
7272
{ CountryIdentifier.Djibouti, new Djibouti() },
7373
{ CountryIdentifier.Dominica, new Dominica() },
74+
{ CountryIdentifier.France, new France() },
75+
{ CountryIdentifier.FrenchGuiana, new FrenchGuiana() },
76+
{ CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() },
7477

7578
// Future countries can be added here in the same format.
7679
};

0 commit comments

Comments
 (0)