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

public sealed class FaroeIslandsTest
{
private const string FAROEISLANDS_COUNTRY_NAME = "Faroe Islands";
private const string FAROEISLANDS_NATIVE_NAME = "Føroyar";
private const string FAROEISLANDS_CAPITAL = "Tórshavn";
private const string FAROEISLANDS_OFFICIAL_NAME = "Faroe Islands";
private const string FAROEISLANDS_ISO2_CODE = "FO";
private const string FAROEISLANDS_ISO3_CODE = "FRO";
private const int FAROEISLANDS_NUMERIC_CODE = 234;
private readonly string[] FAROEISLANDS_CALLING_CODE = ["+298"];
private const int FAROEISLANDS_STATE_COUNT = 6; // 6 regions
private static readonly string[] VALID_STATE_TYPES = { "Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForFaroeIslands()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.FaroeIslands;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(FAROEISLANDS_COUNTRY_NAME, country.Name);
Assert.Equal(FAROEISLANDS_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(FAROEISLANDS_NATIVE_NAME, country.NativeName);
Assert.Equal(FAROEISLANDS_CAPITAL, country.Capital);
Assert.Equal(FAROEISLANDS_NUMERIC_CODE, country.NumericCode);
Assert.Equal(FAROEISLANDS_ISO2_CODE, country.ISO2Code);
Assert.Equal(FAROEISLANDS_ISO3_CODE, country.ISO3Code);
Assert.Equal(FAROEISLANDS_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(FAROEISLANDS_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}


42 changes: 42 additions & 0 deletions src/World.Net.UnitTests/Countries/FijiIslandsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.UnitTests.Countries;

public sealed class FijiIslandsTest
{
private const string FIJI_COUNTRY_NAME = "Fiji";
private const string FIJI_NATIVE_NAME = "Matanitu ko Viti";
private const string FIJI_CAPITAL = "Suva";
private const string FIJI_OFFICIAL_NAME = "Republic of Fiji";
private const string FIJI_ISO2_CODE = "FJ";
private const string FIJI_ISO3_CODE = "FJI";
private const int FIJI_NUMERIC_CODE = 242;
private readonly string[] FIJI_CALLING_CODE = ["+679"];
private const int FIJI_STATE_COUNT = 15; // 14 provinces + 1 dependency
private static readonly string[] VALID_STATE_TYPES = { "Province", "Dependency" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForFiji()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.FijiIslands;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(FIJI_COUNTRY_NAME, country.Name);
Assert.Equal(FIJI_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(FIJI_NATIVE_NAME, country.NativeName);
Assert.Equal(FIJI_CAPITAL, country.Capital);
Assert.Equal(FIJI_NUMERIC_CODE, country.NumericCode);
Assert.Equal(FIJI_ISO2_CODE, country.ISO2Code);
Assert.Equal(FIJI_ISO3_CODE, country.ISO3Code);
Assert.Equal(FIJI_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(FIJI_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}


41 changes: 41 additions & 0 deletions src/World.Net.UnitTests/Countries/FinlandTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace World.Net.UnitTests.Countries;

public sealed class FinlandTest
{
private const string FINLAND_COUNTRY_NAME = "Finland";
private const string FINLAND_NATIVE_NAME = "Suomen tasavalta / Republiken Finland";
private const string FINLAND_CAPITAL = "Helsinki";
private const string FINLAND_OFFICIAL_NAME = "Republic of Finland";
private const string FINLAND_ISO2_CODE = "FI";
private const string FINLAND_ISO3_CODE = "FIN";
private const int FINLAND_NUMERIC_CODE = 246;
private readonly string[] FINLAND_CALLING_CODE = ["+358"];
private const int FINLAND_STATE_COUNT = 21;
private static readonly string[] VALID_STATE_TYPES = { "Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForFinland()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Finland;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(FINLAND_COUNTRY_NAME, country.Name);
Assert.Equal(FINLAND_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(FINLAND_NATIVE_NAME, country.NativeName);
Assert.Equal(FINLAND_CAPITAL, country.Capital);
Assert.Equal(FINLAND_NUMERIC_CODE, country.NumericCode);
Assert.Equal(FINLAND_ISO2_CODE, country.ISO2Code);
Assert.Equal(FINLAND_ISO3_CODE, country.ISO3Code);
Assert.Equal(FINLAND_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(FINLAND_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}

42 changes: 42 additions & 0 deletions src/World.Net/Countries/FaroeIslands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.Countries;

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

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

//<inheritdoc/>
public string OfficialName { get; } = "Faroe Islands";

//<inheritdoc/>
public string NativeName => "Føroyar";

//<inheritdoc/>
public string Capital { get; } = "Tórshavn";

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

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

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

//<inheritdoc/>
public string[] CallingCode { get; } = ["+298"];

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Eysturoy", "FO-01", "Region"),
new("Norðoyar", "FO-02", "Region"),
new("Sandoy", "FO-03", "Region"),
new("Streymoy", "FO-04", "Region"),
new("Suðuroy", "FO-05", "Region"),
new("Vágar", "FO-06", "Region")
];
}
51 changes: 51 additions & 0 deletions src/World.Net/Countries/FijiIslands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "Matanitu ko Viti";

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

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

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

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

//<inheritdoc/>
public string[] CallingCode { get; } = ["+679"];

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Ba", "FJ-01"),
new("Bua", "FJ-02"),
new("Cakaudrove", "FJ-03"),
new("Kadavu", "FJ-04"),
new("Lau", "FJ-05"),
new("Lomaiviti", "FJ-06"),
new("Macuata", "FJ-07"),
new("Nadroga-Navosa", "FJ-08"),
new("Naitasiri", "FJ-09"),
new("Namosi", "FJ-10"),
new("Ra", "FJ-11"),
new("Rewa", "FJ-12"),
new("Serua", "FJ-13"),
new("Tailevu", "FJ-14"),
new("Rotuma", "FJ-15", "Dependency")
];
}
57 changes: 57 additions & 0 deletions src/World.Net/Countries/Finland.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "Suomen tasavalta / Republiken Finland";

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

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

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

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

//<inheritdoc/>
public string[] CallingCode { get; } = ["+358"];

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Åland", "FI-01", "Region"),
new("Central Finland", "FI-08", "Region"),
new("Central Ostrobothnia", "FI-07", "Region"),
new("Etelä-Karjala", "FI-02", "Region"),
new("Etelä-Pohjanmaa", "FI-03", "Region"),
new("Etelä-Savo", "FI-04", "Region"),
new("Kainuu", "FI-05", "Region"),
new("Kanta-Häme", "FI-06", "Region"),
new("Keski-Pohjanmaa", "FI-09", "Region"),
new("Keski-Suomi", "FI-10", "Region"),
new("Kymenlaakso", "FI-11", "Region"),
new("Lappi", "FI-12", "Region"),
new("Pirkanmaa", "FI-13", "Region"),
new("Pohjanmaa", "FI-14", "Region"),
new("Pohjois-Karjala", "FI-15", "Region"),
new("Pohjois-Pohjanmaa", "FI-16", "Region"),
new("Pohjois-Savo", "FI-17", "Region"),
new("Päijät-Häme", "FI-18", "Region"),
new("Satakunta", "FI-19", "Region"),
new("Uusimaa", "FI-20", "Region"),
new("Varsinais-Suomi", "FI-21", "Region")
];
}
9 changes: 6 additions & 3 deletions src/World.Net/Helpers/CountryInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,16 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
{ CountryIdentifier.Curacao, new Curaçao() },
{ CountryIdentifier.Cyprus, new Cyprus() },
{ CountryIdentifier.CzechRepublic, new CzechRepublic() },
{ CountryIdentifier.Denmark, new Denmark() },
{ CountryIdentifier.Djibouti, new Djibouti() },
{ CountryIdentifier.Dominica, new Dominica() },
{ CountryIdentifier.DominicanRepublic, new DominicanRepublic() },
{ CountryIdentifier.TimorLeste, new TimorLeste() },
{ CountryIdentifier.Ecuador, new Ecuador() },
{ CountryIdentifier.Egypt, new Egypt() },
{ CountryIdentifier.Denmark, new Denmark() },
{ CountryIdentifier.Djibouti, new Djibouti() },
{ CountryIdentifier.Dominica, new Dominica() },
{ CountryIdentifier.FaroeIslands, new FaroeIslands() },
{ CountryIdentifier.FijiIslands, new FijiIslands() },
{ CountryIdentifier.Finland, new Finland() },
{ CountryIdentifier.France, new France() },
{ CountryIdentifier.FrenchGuiana, new FrenchGuiana() },
{ CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() },
Expand Down