Skip to content

Commit f0889b6

Browse files
authored
Merge pull request #54 from deanology/FaFiFi
Fiji, Faroe Island and Finland Details
2 parents 3cc446b + b16b27e commit f0889b6

7 files changed

Lines changed: 281 additions & 3 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class FaroeIslandsTest
4+
{
5+
private const string FAROEISLANDS_COUNTRY_NAME = "Faroe Islands";
6+
private const string FAROEISLANDS_NATIVE_NAME = "Føroyar";
7+
private const string FAROEISLANDS_CAPITAL = "Tórshavn";
8+
private const string FAROEISLANDS_OFFICIAL_NAME = "Faroe Islands";
9+
private const string FAROEISLANDS_ISO2_CODE = "FO";
10+
private const string FAROEISLANDS_ISO3_CODE = "FRO";
11+
private const int FAROEISLANDS_NUMERIC_CODE = 234;
12+
private readonly string[] FAROEISLANDS_CALLING_CODE = ["+298"];
13+
private const int FAROEISLANDS_STATE_COUNT = 6; // 6 regions
14+
private static readonly string[] VALID_STATE_TYPES = { "Region" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForFaroeIslands()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.FaroeIslands;
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(FAROEISLANDS_COUNTRY_NAME, country.Name);
29+
Assert.Equal(FAROEISLANDS_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(FAROEISLANDS_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(FAROEISLANDS_CAPITAL, country.Capital);
32+
Assert.Equal(FAROEISLANDS_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(FAROEISLANDS_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(FAROEISLANDS_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(FAROEISLANDS_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(FAROEISLANDS_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
41+
42+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class FijiIslandsTest
4+
{
5+
private const string FIJI_COUNTRY_NAME = "Fiji";
6+
private const string FIJI_NATIVE_NAME = "Matanitu ko Viti";
7+
private const string FIJI_CAPITAL = "Suva";
8+
private const string FIJI_OFFICIAL_NAME = "Republic of Fiji";
9+
private const string FIJI_ISO2_CODE = "FJ";
10+
private const string FIJI_ISO3_CODE = "FJI";
11+
private const int FIJI_NUMERIC_CODE = 242;
12+
private readonly string[] FIJI_CALLING_CODE = ["+679"];
13+
private const int FIJI_STATE_COUNT = 15; // 14 provinces + 1 dependency
14+
private static readonly string[] VALID_STATE_TYPES = { "Province", "Dependency" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForFiji()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.FijiIslands;
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(FIJI_COUNTRY_NAME, country.Name);
29+
Assert.Equal(FIJI_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(FIJI_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(FIJI_CAPITAL, country.Capital);
32+
Assert.Equal(FIJI_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(FIJI_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(FIJI_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(FIJI_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(FIJI_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
41+
42+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class FinlandTest
4+
{
5+
private const string FINLAND_COUNTRY_NAME = "Finland";
6+
private const string FINLAND_NATIVE_NAME = "Suomen tasavalta / Republiken Finland";
7+
private const string FINLAND_CAPITAL = "Helsinki";
8+
private const string FINLAND_OFFICIAL_NAME = "Republic of Finland";
9+
private const string FINLAND_ISO2_CODE = "FI";
10+
private const string FINLAND_ISO3_CODE = "FIN";
11+
private const int FINLAND_NUMERIC_CODE = 246;
12+
private readonly string[] FINLAND_CALLING_CODE = ["+358"];
13+
private const int FINLAND_STATE_COUNT = 21;
14+
private static readonly string[] VALID_STATE_TYPES = { "Region" };
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForFinland()
18+
{
19+
// Arrange
20+
CountryIdentifier existingCountryId = CountryIdentifier.Finland;
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(FINLAND_COUNTRY_NAME, country.Name);
29+
Assert.Equal(FINLAND_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(FINLAND_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(FINLAND_CAPITAL, country.Capital);
32+
Assert.Equal(FINLAND_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(FINLAND_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(FINLAND_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(FINLAND_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(FINLAND_STATE_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
39+
}
40+
}
41+
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 FaroeIslands : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.FaroeIslands;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Faroe Islands";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Faroe Islands";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Føroyar";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Tórshavn";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 234;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "FO";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "FRO";
28+
29+
//<inheritdoc/>
30+
public string[] CallingCode { get; } = ["+298"];
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Eysturoy", "FO-01", "Region"),
36+
new("Norðoyar", "FO-02", "Region"),
37+
new("Sandoy", "FO-03", "Region"),
38+
new("Streymoy", "FO-04", "Region"),
39+
new("Suðuroy", "FO-05", "Region"),
40+
new("Vágar", "FO-06", "Region")
41+
];
42+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class FijiIslands : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.FijiIslands;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Fiji";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Fiji";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Matanitu ko Viti";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Suva";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 242;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "FJ";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "FJI";
28+
29+
//<inheritdoc/>
30+
public string[] CallingCode { get; } = ["+679"];
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Ba", "FJ-01"),
36+
new("Bua", "FJ-02"),
37+
new("Cakaudrove", "FJ-03"),
38+
new("Kadavu", "FJ-04"),
39+
new("Lau", "FJ-05"),
40+
new("Lomaiviti", "FJ-06"),
41+
new("Macuata", "FJ-07"),
42+
new("Nadroga-Navosa", "FJ-08"),
43+
new("Naitasiri", "FJ-09"),
44+
new("Namosi", "FJ-10"),
45+
new("Ra", "FJ-11"),
46+
new("Rewa", "FJ-12"),
47+
new("Serua", "FJ-13"),
48+
new("Tailevu", "FJ-14"),
49+
new("Rotuma", "FJ-15", "Dependency")
50+
];
51+
}

src/World.Net/Countries/Finland.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 Finland : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Finland;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Finland";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Finland";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Suomen tasavalta / Republiken Finland";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Helsinki";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 246;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "FI";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "FIN";
28+
29+
//<inheritdoc/>
30+
public string[] CallingCode { get; } = ["+358"];
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Åland", "FI-01", "Region"),
36+
new("Central Finland", "FI-08", "Region"),
37+
new("Central Ostrobothnia", "FI-07", "Region"),
38+
new("Etelä-Karjala", "FI-02", "Region"),
39+
new("Etelä-Pohjanmaa", "FI-03", "Region"),
40+
new("Etelä-Savo", "FI-04", "Region"),
41+
new("Kainuu", "FI-05", "Region"),
42+
new("Kanta-Häme", "FI-06", "Region"),
43+
new("Keski-Pohjanmaa", "FI-09", "Region"),
44+
new("Keski-Suomi", "FI-10", "Region"),
45+
new("Kymenlaakso", "FI-11", "Region"),
46+
new("Lappi", "FI-12", "Region"),
47+
new("Pirkanmaa", "FI-13", "Region"),
48+
new("Pohjanmaa", "FI-14", "Region"),
49+
new("Pohjois-Karjala", "FI-15", "Region"),
50+
new("Pohjois-Pohjanmaa", "FI-16", "Region"),
51+
new("Pohjois-Savo", "FI-17", "Region"),
52+
new("Päijät-Häme", "FI-18", "Region"),
53+
new("Satakunta", "FI-19", "Region"),
54+
new("Uusimaa", "FI-20", "Region"),
55+
new("Varsinais-Suomi", "FI-21", "Region")
56+
];
57+
}

src/World.Net/Helpers/CountryInitializer.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,16 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
6464
{ CountryIdentifier.Curacao, new Curaçao() },
6565
{ CountryIdentifier.Cyprus, new Cyprus() },
6666
{ CountryIdentifier.CzechRepublic, new CzechRepublic() },
67+
{ CountryIdentifier.Denmark, new Denmark() },
68+
{ CountryIdentifier.Djibouti, new Djibouti() },
69+
{ CountryIdentifier.Dominica, new Dominica() },
6770
{ CountryIdentifier.DominicanRepublic, new DominicanRepublic() },
6871
{ CountryIdentifier.TimorLeste, new TimorLeste() },
6972
{ CountryIdentifier.Ecuador, new Ecuador() },
7073
{ CountryIdentifier.Egypt, new Egypt() },
71-
{ CountryIdentifier.Denmark, new Denmark() },
72-
{ CountryIdentifier.Djibouti, new Djibouti() },
73-
{ CountryIdentifier.Dominica, new Dominica() },
74+
{ CountryIdentifier.FaroeIslands, new FaroeIslands() },
75+
{ CountryIdentifier.FijiIslands, new FijiIslands() },
76+
{ CountryIdentifier.Finland, new Finland() },
7477
{ CountryIdentifier.France, new France() },
7578
{ CountryIdentifier.FrenchGuiana, new FrenchGuiana() },
7679
{ CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() },

0 commit comments

Comments
 (0)