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
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/IraqTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;
public sealed class IraqTest
{
private const string IRAQ_COUNTRY_NAME = "Iraq";
private const string IRAQ_NATIVE_NAME = "العراق";
private const string IRAQ_CAPITAL = "Baghdad";
private const string IRAQ_OFFICIAL_NAME = "Republic of Iraq";
private const string IRAQ_ISO2_CODE = "IQ";
private const string IRAQ_ISO3_CODE = "IRQ";
private const int IRAQ_NUMERIC_CODE = 368;
private readonly string[] IRAQ_CALLING_CODE = ["+964"];
private const int IRAQ_STATE_COUNT = 18;
private static readonly string[] VALID_STATE_TYPES = { "Governorate" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForIraq()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Iraq;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(IRAQ_COUNTRY_NAME, country.Name);
Assert.Equal(IRAQ_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(IRAQ_NATIVE_NAME, country.NativeName);
Assert.Equal(IRAQ_CAPITAL, country.Capital);
Assert.Equal(IRAQ_NUMERIC_CODE, country.NumericCode);
Assert.Equal(IRAQ_ISO2_CODE, country.ISO2Code);
Assert.Equal(IRAQ_ISO3_CODE, country.ISO3Code);
Assert.Equal(IRAQ_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(IRAQ_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}

39 changes: 39 additions & 0 deletions src/World.Net.UnitTests/Countries/IrelandTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace World.Net.UnitTests.Countries;
public sealed class IrelandTest
{
private const string IRELAND_COUNTRY_NAME = "Ireland";
private const string IRELAND_NATIVE_NAME = "Éire";
private const string IRELAND_CAPITAL = "Dublin";
private const string IRELAND_OFFICIAL_NAME = "Republic of Ireland";
private const string IRELAND_ISO2_CODE = "IE";
private const string IRELAND_ISO3_CODE = "IRL";
private const int IRELAND_NUMERIC_CODE = 372;
private readonly string[] IRELAND_CALLING_CODE = ["+353"];
private const int IRELAND_STATE_COUNT = 30;
private static readonly string[] VALID_STATE_TYPES = { "County", "Province" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForIreland()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Ireland;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(IRELAND_COUNTRY_NAME, country.Name);
Assert.Equal(IRELAND_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(IRELAND_NATIVE_NAME, country.NativeName);
Assert.Equal(IRELAND_CAPITAL, country.Capital);
Assert.Equal(IRELAND_NUMERIC_CODE, country.NumericCode);
Assert.Equal(IRELAND_ISO2_CODE, country.ISO2Code);
Assert.Equal(IRELAND_ISO3_CODE, country.ISO3Code);
Assert.Equal(IRELAND_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(IRELAND_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
39 changes: 39 additions & 0 deletions src/World.Net.UnitTests/Countries/IsraelTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace World.Net.UnitTests.Countries;
public sealed class IsraelTest
{
private const string ISRAEL_COUNTRY_NAME = "Israel";
private const string ISRAEL_NATIVE_NAME = "יִשְׂרָאֵל";
private const string ISRAEL_CAPITAL = "Jerusalem";
private const string ISRAEL_OFFICIAL_NAME = "State of Israel";
private const string ISRAEL_ISO2_CODE = "IL";
private const string ISRAEL_ISO3_CODE = "ISR";
private const int ISRAEL_NUMERIC_CODE = 376;
private readonly string[] ISRAEL_CALLING_CODE = ["+972"];
private const int ISRAEL_STATE_COUNT = 6;
private static readonly string[] VALID_STATE_TYPES = { "District" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForIsrael()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Israel;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(ISRAEL_COUNTRY_NAME, country.Name);
Assert.Equal(ISRAEL_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(ISRAEL_NATIVE_NAME, country.NativeName);
Assert.Equal(ISRAEL_CAPITAL, country.Capital);
Assert.Equal(ISRAEL_NUMERIC_CODE, country.NumericCode);
Assert.Equal(ISRAEL_ISO2_CODE, country.ISO2Code);
Assert.Equal(ISRAEL_ISO3_CODE, country.ISO3Code);
Assert.Equal(ISRAEL_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(ISRAEL_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
39 changes: 39 additions & 0 deletions src/World.Net.UnitTests/Countries/ItalyTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
namespace World.Net.UnitTests.Countries;
public sealed class ItalyTest
{
private const string ITALY_COUNTRY_NAME = "Italy";
private const string ITALY_NATIVE_NAME = "Italia";
private const string ITALY_CAPITAL = "Rome";
private const string ITALY_OFFICIAL_NAME = "Italian Republic";
private const string ITALY_ISO2_CODE = "IT";
private const string ITALY_ISO3_CODE = "ITA";
private const int ITALY_NUMERIC_CODE = 380;
private readonly string[] ITALY_CALLING_CODE = ["+39"];
private const int ITALY_STATE_COUNT = 111;
private static readonly string[] VALID_STATE_TYPES = { "Decentralized Regional Entity", "Metropolitan City", "Autonomous Region", "Free Municipal Consortium", "Province", "Region", };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForItaly()
{
// Arrange
CountryIdentifier existingCountryId = CountryIdentifier.Italy;

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

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(ITALY_COUNTRY_NAME, country.Name);
Assert.Equal(ITALY_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(ITALY_NATIVE_NAME, country.NativeName);
Assert.Equal(ITALY_CAPITAL, country.Capital);
Assert.Equal(ITALY_NUMERIC_CODE, country.NumericCode);
Assert.Equal(ITALY_ISO2_CODE, country.ISO2Code);
Assert.Equal(ITALY_ISO3_CODE, country.ISO3Code);
Assert.Equal(ITALY_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(ITALY_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
52 changes: 52 additions & 0 deletions src/World.Net/Countries/Iraq.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace World.Net.Countries;
internal sealed class Iraq : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Iraq;

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

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

//<inheritdoc/>
public string NativeName => "العراق";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Al Anbar", "IQ-AN", "Governorate"),
new("Al Muthanna", "IQ-MU", "Governorate"),
new("Al-Qādisiyyah", "IQ-QA", "Governorate"),
new("Babylon", "IQ-BB", "Governorate"),
new("Baghdad", "IQ-BG", "Governorate"),
new("Basra", "IQ-BA", "Governorate"),
new("Dhi Qar", "IQ-DQ", "Governorate"),
new("Diyala", "IQ-DI", "Governorate"),
new("Dohuk", "IQ-DA", "Governorate"),
new("Erbil", "IQ-AR", "Governorate"),
new("Karbala", "IQ-KA", "Governorate"),
new("Kirkuk", "IQ-KI", "Governorate"),
new("Maysan", "IQ-MA", "Governorate"),
new("Najaf", "IQ-NA", "Governorate"),
new("Nineveh", "IQ-NI", "Governorate"),
new("Saladin", "IQ-SD", "Governorate"),
new("Sulaymaniyah", "IQ-SU", "Governorate"),
new("Wasit", "IQ-WA", "Governorate")
];
}
65 changes: 65 additions & 0 deletions src/World.Net/Countries/Ireland.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace World.Net.Countries;
internal sealed class Ireland : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Ireland;

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

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

//<inheritdoc/>
public string NativeName => "Éire";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Carlow", "IE-CW", "County"),
new("Cavan", "IE-CN", "County"),
new("Clare", "IE-CE", "County"),
new("Connacht", "IE-C", "Province"),
new("Cork", "IE-CO", "County"),
new("Donegal", "IE-DL", "County"),
new("Dublin", "IE-D", "County"),
new("Galway", "IE-G", "County"),
new("Kerry", "IE-KY", "County"),
new("Kildare", "IE-KE", "County"),
new("Kilkenny", "IE-KK", "County"),
new("Laois", "IE-LS", "County"),
new("Leinster", "IE-L", "Province"),
new("Leitrim", "IE-LM", "County"),
new("Limerick", "IE-LK", "County"),
new("Longford", "IE-LD", "County"),
new("Louth", "IE-LH", "County"),
new("Mayo", "IE-MO", "County"),
new("Meath", "IE-MH", "County"),
new("Monaghan", "IE-MN", "County"),
new("Munster", "IE-M", "Province"),
new("Offaly", "IE-OY", "County"),
new("Roscommon", "IE-RN", "County"),
new("Sligo", "IE-SO", "County"),
new("Tipperary", "IE-TA", "County"),
new("Ulster", "IE-U", "Province"),
new("Waterford", "IE-WD", "County"),
new("Westmeath", "IE-WH", "County"),
new("Wexford", "IE-WX", "County"),
new("Wicklow", "IE-WW", "County")
];

}
40 changes: 40 additions & 0 deletions src/World.Net/Countries/Israel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.Countries;
internal sealed class Israel : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Israel;

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

//<inheritdoc/>
public string OfficialName { get; } = "State of Israel";

//<inheritdoc/>
public string NativeName => "יִשְׂרָאֵל";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Central", "IL-M", "District"),
new("Haifa", "IL-HA", "District"),
new("Jerusalem", "IL-JM", "District"),
new("Northern", "IL-Z", "District"),
new("Southern", "IL-D", "District"),
new("Tel Aviv", "IL-TA", "District")
];
}
Loading