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

public sealed class GermanyTest : AssertCountryTestBase
{
private const string GERMANY_COUNTRY_NAME = "Germany";
private const string GERMANY_NATIVE_NAME = "Deutschland";
private const string GERMANY_CAPITAL = "Berlin";
private const string GERMANY_OFFICIAL_NAME = "Federal Republic of Germany";
private const string GERMANY_ISO2_CODE = "DE";
private const string GERMANY_ISO3_CODE = "DEU";
private const int GERMANY_NUMERIC_CODE = 276;
private readonly string[] GERMANY_CALLING_CODE = ["+49"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Germany;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Baden-Württemberg", "DE-BW", "State"),
new("Bavaria", "DE-BY", "State"),
new("Berlin", "DE-BE", "State"),
new("Brandenburg", "DE-BB", "State"),
new("Bremen", "DE-HB", "State"),
new("Hamburg", "DE-HH", "State"),
new("Hesse", "DE-HE", "State"),
new("Lower Saxony", "DE-NI", "State"),
new("Mecklenburg-Vorpommern", "DE-MV", "State"),
new("North Rhine-Westphalia", "DE-NW", "State"),
new("Rhineland-Palatinate", "DE-RP", "State"),
new("Saarland", "DE-SL", "State"),
new("Saxony", "DE-SN", "State"),
new("Saxony-Anhalt", "DE-ST", "State"),
new("Schleswig-Holstein", "DE-SH", "State"),
new("Thuringia", "DE-TH", "State")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForGermany()
{
// Arrange
// Act
var country = CountryProvider.GetCountry(EXPECTEDID);

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
GERMANY_COUNTRY_NAME,
GERMANY_OFFICIAL_NAME,
GERMANY_NATIVE_NAME,
GERMANY_CAPITAL,
GERMANY_NUMERIC_CODE,
GERMANY_ISO2_CODE,
GERMANY_ISO3_CODE,
GERMANY_CALLING_CODE,
EXPECTED_STATES
);
}
}
57 changes: 57 additions & 0 deletions src/World.Net.UnitTests/Countries/GhanaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
namespace World.Net.UnitTests.Countries;

public sealed class GhanaTest : AssertCountryTestBase
{
private const string GHANA_COUNTRY_NAME = "Ghana";
private const string GHANA_NATIVE_NAME = "Ghana";
private const string GHANA_CAPITAL = "Accra";
private const string GHANA_OFFICIAL_NAME = "Republic of Ghana";
private const string GHANA_ISO2_CODE = "GH";
private const string GHANA_ISO3_CODE = "GHA";
private const int GHANA_NUMERIC_CODE = 288;
private readonly string[] GHANA_CALLING_CODE = ["+233"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Ghana;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Ahafo", "GH-AF", "Region"),
new("Ashanti", "GH-AH", "Region"),
new("Bono", "GH-BO", "Region"),
new("Bono East", "GH-BE", "Region"),
new("Central", "GH-CP", "Region"),
new("Eastern", "GH-EP", "Region"),
new("Greater Accra", "GH-AA", "Region"),
new("North East", "GH-NE", "Region"),
new("Northern", "GH-NP", "Region"),
new("Oti", "GH-OT", "Region"),
new("Savannah", "GH-SV", "Region"),
new("Upper East", "GH-UE", "Region"),
new("Upper West", "GH-UW", "Region"),
new("Volta", "GH-TV", "Region"),
new("Western", "GH-WP", "Region"),
new("Western North", "GH-WN", "Region")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForGhana()
{
// Arrange
// Act
var country = CountryProvider.GetCountry(EXPECTEDID);

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
GHANA_COUNTRY_NAME,
GHANA_OFFICIAL_NAME,
GHANA_NATIVE_NAME,
GHANA_CAPITAL,
GHANA_NUMERIC_CODE,
GHANA_ISO2_CODE,
GHANA_ISO3_CODE,
GHANA_CALLING_CODE,
EXPECTED_STATES
);
}
}
39 changes: 39 additions & 0 deletions src/World.Net.UnitTests/Countries/GibraltarTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace World.Net.UnitTests.Countries;

public sealed class GibraltarTest : AssertCountryTestBase
{
private const string GIBRALTAR_COUNTRY_NAME = "Gibraltar";
private const string GIBRALTAR_NATIVE_NAME = "Gibraltar";
private const string GIBRALTAR_CAPITAL = "Gibraltar";
private const string GIBRALTAR_OFFICIAL_NAME = "Gibraltar";
private const string GIBRALTAR_ISO2_CODE = "GI";
private const string GIBRALTAR_ISO3_CODE = "GIB";
private const int GIBRALTAR_NUMERIC_CODE = 292;
private readonly string[] GIBRALTAR_CALLING_CODE = ["+350"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Gibraltar;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = [];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForGibraltar()
{
// Arrange
// Act
var country = CountryProvider.GetCountry(EXPECTEDID);

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
GIBRALTAR_COUNTRY_NAME,
GIBRALTAR_OFFICIAL_NAME,
GIBRALTAR_NATIVE_NAME,
GIBRALTAR_CAPITAL,
GIBRALTAR_NUMERIC_CODE,
GIBRALTAR_ISO2_CODE,
GIBRALTAR_ISO3_CODE,
GIBRALTAR_CALLING_CODE,
EXPECTED_STATES
);
}
}
54 changes: 54 additions & 0 deletions src/World.Net.UnitTests/Countries/GreeceTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace World.Net.UnitTests.Countries;

public sealed class GreeceTest : AssertCountryTestBase
{
private const string GREECE_COUNTRY_NAME = "Greece";
private const string GREECE_NATIVE_NAME = "Ελλάδα";
private const string GREECE_CAPITAL = "Athens";
private const string GREECE_OFFICIAL_NAME = "Hellenic Republic";
private const string GREECE_ISO2_CODE = "GR";
private const string GREECE_ISO3_CODE = "GRC";
private const int GREECE_NUMERIC_CODE = 300;
private readonly string[] GREECE_CALLING_CODE = ["+30"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Greece;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Attica", "GR-I", "Region"),
new("Central Greece", "GR-H", "Region"),
new("Central Macedonia", "GR-B", "Region"),
new("Crete", "GR-M", "Region"),
new("Eastern Macedonia and Thrace", "GR-A", "Region"),
new("Epirus", "GR-D", "Region"),
new("Ionian Islands", "GR-F", "Region"),
new("North Aegean", "GR-K", "Region"),
new("Peloponnese", "GR-J", "Region"),
new("South Aegean", "GR-L", "Region"),
new("Thessaly", "GR-E", "Region"),
new("Western Greece", "GR-G", "Region"),
new("Western Macedonia", "GR-C", "Region")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForGreece()
{
// Arrange
// Act
var country = CountryProvider.GetCountry(EXPECTEDID);

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
GREECE_COUNTRY_NAME,
GREECE_OFFICIAL_NAME,
GREECE_NATIVE_NAME,
GREECE_CAPITAL,
GREECE_NUMERIC_CODE,
GREECE_ISO2_CODE,
GREECE_ISO3_CODE,
GREECE_CALLING_CODE,
EXPECTED_STATES
);
}
}
46 changes: 46 additions & 0 deletions src/World.Net.UnitTests/Countries/GreenlandTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace World.Net.UnitTests.Countries;

public sealed class GreenlandTest : AssertCountryTestBase
{
private const string GREENLAND_COUNTRY_NAME = "Greenland";
private const string GREENLAND_NATIVE_NAME = "Kalaallit Nunaat";
private const string GREENLAND_CAPITAL = "Nuuk";
private const string GREENLAND_OFFICIAL_NAME = "Greenland";
private const string GREENLAND_ISO2_CODE = "GL";
private const string GREENLAND_ISO3_CODE = "GRL";
private const int GREENLAND_NUMERIC_CODE = 304;
private readonly string[] GREENLAND_CALLING_CODE = ["+299"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Greenland;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Avannaata", "GL-AV", "Municipality"),
new("Kujalleq", "GL-KU", "Municipality"),
new("Qeqertalik", "GL-QT", "Municipality"),
new("Qeqqata", "GL-QE", "Municipality"),
new("Sermersooq", "GL-SM", "Municipality")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForGreenland()
{
// Arrange
// Act
var country = CountryProvider.GetCountry(EXPECTEDID);

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
GREENLAND_COUNTRY_NAME,
GREENLAND_OFFICIAL_NAME,
GREENLAND_NATIVE_NAME,
GREENLAND_CAPITAL,
GREENLAND_NUMERIC_CODE,
GREENLAND_ISO2_CODE,
GREENLAND_ISO3_CODE,
GREENLAND_CALLING_CODE,
EXPECTED_STATES
);
}
}
52 changes: 52 additions & 0 deletions src/World.Net/Countries/Germany.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "Deutschland";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Baden-Württemberg", "DE-BW", "State"),
new("Bavaria", "DE-BY", "State"),
new("Berlin", "DE-BE", "State"),
new("Brandenburg", "DE-BB", "State"),
new("Bremen", "DE-HB", "State"),
new("Hamburg", "DE-HH", "State"),
new("Hesse", "DE-HE", "State"),
new("Lower Saxony", "DE-NI", "State"),
new("Mecklenburg-Vorpommern", "DE-MV", "State"),
new("North Rhine-Westphalia", "DE-NW", "State"),
new("Rhineland-Palatinate", "DE-RP", "State"),
new("Saarland", "DE-SL", "State"),
new("Saxony", "DE-SN", "State"),
new("Saxony-Anhalt", "DE-ST", "State"),
new("Schleswig-Holstein", "DE-SH", "State"),
new("Thuringia", "DE-TH", "State")
];
}
52 changes: 52 additions & 0 deletions src/World.Net/Countries/Ghana.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "Ghana";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Ahafo", "GH-AF", "Region"),
new("Ashanti", "GH-AH", "Region"),
new("Bono", "GH-BO", "Region"),
new("Bono East", "GH-BE", "Region"),
new("Central", "GH-CP", "Region"),
new("Eastern", "GH-EP", "Region"),
new("Greater Accra", "GH-AA", "Region"),
new("North East", "GH-NE", "Region"),
new("Northern", "GH-NP", "Region"),
new("Oti", "GH-OT", "Region"),
new("Savannah", "GH-SV", "Region"),
new("Upper East", "GH-UE", "Region"),
new("Upper West", "GH-UW", "Region"),
new("Volta", "GH-TV", "Region"),
new("Western", "GH-WP", "Region"),
new("Western North", "GH-WN", "Region")
];
}
34 changes: 34 additions & 0 deletions src/World.Net/Countries/Gibraltar.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "Gibraltar";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States => [];
}
Loading