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

public sealed class HungaryTest : AssertCountryTestBase
{
private const string HUNGARY_COUNTRY_NAME = "Hungary";
private const string HUNGARY_NATIVE_NAME = "Magyarország";
private const string HUNGARY_CAPITAL = "Budapest";
private const string HUNGARY_OFFICIAL_NAME = "Hungary";
private const string HUNGARY_ISO2_CODE = "HU";
private const string HUNGARY_ISO3_CODE = "HUN";
private const int HUNGARY_NUMERIC_CODE = 348;
private readonly string[] HUNGARY_CALLING_CODE = ["+36"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Hungary;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Budapest", "HU-BU", "Capital City"),
new("Bács-Kiskun", "HU-BK", "County"),
new("Baranya", "HU-BA", "County"),
new("Békés", "HU-BE", "County"),
new("Borsod-Abaúj-Zemplén", "HU-BO", "County"),
new("Csongrád-Csanád", "HU-CS", "County"),
new("Fejér", "HU-FE", "County"),
new("Győr-Moson-Sopron", "HU-GS", "County"),
new("Hajdú-Bihar", "HU-HB", "County"),
new("Heves", "HU-HE", "County"),
new("Jász-Nagykun-Szolnok", "HU-JN", "County"),
new("Komárom-Esztergom", "HU-KM", "County"),
new("Nógrád", "HU-NO", "County"),
new("Pest", "HU-PE", "County"),
new("Somogy", "HU-SO", "County"),
new("Szabolcs-Szatmár-Bereg", "HU-SZ", "County"),
new("Tolna", "HU-TO", "County"),
new("Vas", "HU-VA", "County"),
new("Veszprém", "HU-VE", "County"),
new("Zala", "HU-ZA", "County")
];

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

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
HUNGARY_COUNTRY_NAME,
HUNGARY_OFFICIAL_NAME,
HUNGARY_NATIVE_NAME,
HUNGARY_CAPITAL,
HUNGARY_NUMERIC_CODE,
HUNGARY_ISO2_CODE,
HUNGARY_ISO3_CODE,
HUNGARY_CALLING_CODE,
EXPECTED_STATES
);
}
}
49 changes: 49 additions & 0 deletions src/World.Net.UnitTests/Countries/IcelandTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace World.Net.UnitTests.Countries;

public sealed class IcelandTest : AssertCountryTestBase
{
private const string ICELAND_COUNTRY_NAME = "Iceland";
private const string ICELAND_NATIVE_NAME = "Ísland";
private const string ICELAND_CAPITAL = "Reykjavík";
private const string ICELAND_OFFICIAL_NAME = "Republic of Iceland";
private const string ICELAND_ISO2_CODE = "IS";
private const string ICELAND_ISO3_CODE = "ISL";
private const int ICELAND_NUMERIC_CODE = 352;
private readonly string[] ICELAND_CALLING_CODE = ["+354"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Iceland;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Capital Region", "IS-1", "Region"),
new("Southern Peninsula", "IS-2", "Region"),
new("West", "IS-3", "Region"),
new("Westfjords", "IS-4", "Region"),
new("North", "IS-5", "Region"),
new("Northwest", "IS-6", "Region"),
new("East", "IS-7", "Region"),
new("South", "IS-8", "Region")
];

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

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
ICELAND_COUNTRY_NAME,
ICELAND_OFFICIAL_NAME,
ICELAND_NATIVE_NAME,
ICELAND_CAPITAL,
ICELAND_NUMERIC_CODE,
ICELAND_ISO2_CODE,
ICELAND_ISO3_CODE,
ICELAND_CALLING_CODE,
EXPECTED_STATES
);
}
}
77 changes: 77 additions & 0 deletions src/World.Net.UnitTests/Countries/IndiaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
namespace World.Net.UnitTests.Countries;

public sealed class IndiaTest : AssertCountryTestBase
{
private const string INDIA_COUNTRY_NAME = "India";
private const string INDIA_NATIVE_NAME = "भारत";
private const string INDIA_CAPITAL = "New Delhi";
private const string INDIA_OFFICIAL_NAME = "Republic of India";
private const string INDIA_ISO2_CODE = "IN";
private const string INDIA_ISO3_CODE = "IND";
private const int INDIA_NUMERIC_CODE = 356;
private readonly string[] INDIA_CALLING_CODE = ["+91"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.India;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Andhra Pradesh", "IN-AP", "State"),
new("Arunachal Pradesh", "IN-AR", "State"),
new("Assam", "IN-AS", "State"),
new("Bihar", "IN-BR", "State"),
new("Chhattisgarh", "IN-CT", "State"),
new("Goa", "IN-GA", "State"),
new("Gujarat", "IN-GJ", "State"),
new("Haryana", "IN-HR", "State"),
new("Himachal Pradesh", "IN-HP", "State"),
new("Jharkhand", "IN-JH", "State"),
new("Karnataka", "IN-KA", "State"),
new("Kerala", "IN-KL", "State"),
new("Madhya Pradesh", "IN-MP", "State"),
new("Maharashtra", "IN-MH", "State"),
new("Manipur", "IN-MN", "State"),
new("Meghalaya", "IN-ML", "State"),
new("Mizoram", "IN-MZ", "State"),
new("Nagaland", "IN-NL", "State"),
new("Odisha", "IN-OR", "State"),
new("Punjab", "IN-PB", "State"),
new("Rajasthan", "IN-RJ", "State"),
new("Sikkim", "IN-SK", "State"),
new("Tamil Nadu", "IN-TN", "State"),
new("Telangana", "IN-TG", "State"),
new("Tripura", "IN-TR", "State"),
new("Uttar Pradesh", "IN-UP", "State"),
new("Uttarakhand", "IN-UT", "State"),
new("West Bengal", "IN-WB", "State"),
new("Andaman and Nicobar Islands", "IN-AN", "Union Territory"),
new("Chandigarh", "IN-CH", "Union Territory"),
new("Dadra and Nagar Haveli and Daman and Diu", "IN-DN", "Union Territory"),
new("Delhi", "IN-DL", "Union Territory"),
new("Jammu and Kashmir", "IN-JK", "Union Territory"),
new("Ladakh", "IN-LA", "Union Territory"),
new("Lakshadweep", "IN-LD", "Union Territory"),
new("Puducherry", "IN-PY", "Union Territory")
];

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

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
INDIA_COUNTRY_NAME,
INDIA_OFFICIAL_NAME,
INDIA_NATIVE_NAME,
INDIA_CAPITAL,
INDIA_NUMERIC_CODE,
INDIA_ISO2_CODE,
INDIA_ISO3_CODE,
INDIA_CALLING_CODE,
EXPECTED_STATES
);
}
}
75 changes: 75 additions & 0 deletions src/World.Net.UnitTests/Countries/IndonesiaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
namespace World.Net.UnitTests.Countries;

public sealed class IndonesiaTest : AssertCountryTestBase
{
private const string INDONESIA_COUNTRY_NAME = "Indonesia";
private const string INDONESIA_NATIVE_NAME = "Indonesia";
private const string INDONESIA_CAPITAL = "Jakarta";
private const string INDONESIA_OFFICIAL_NAME = "Republic of Indonesia";
private const string INDONESIA_ISO2_CODE = "ID";
private const string INDONESIA_ISO3_CODE = "IDN";
private const int INDONESIA_NUMERIC_CODE = 360;
private readonly string[] INDONESIA_CALLING_CODE = ["+62"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Indonesia;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Aceh", "ID-AC", "Special Region"),
new("Bali", "ID-BA", "Province"),
new("Banten", "ID-BT", "Province"),
new("Bengkulu", "ID-BE", "Province"),
new("Central Java", "ID-JT", "Province"),
new("Central Kalimantan", "ID-KT", "Province"),
new("Central Sulawesi", "ID-ST", "Province"),
new("East Java", "ID-JI", "Province"),
new("East Kalimantan", "ID-KI", "Province"),
new("East Nusa Tenggara", "ID-NT", "Province"),
new("Gorontalo", "ID-GO", "Province"),
new("Jakarta", "ID-JK", "Special Capital Region"),
new("Jambi", "ID-JA", "Province"),
new("Lampung", "ID-LA", "Province"),
new("Maluku", "ID-MA", "Province"),
new("North Kalimantan", "ID-KU", "Province"),
new("North Maluku", "ID-MU", "Province"),
new("North Sulawesi", "ID-SA", "Province"),
new("North Sumatra", "ID-SU", "Province"),
new("Papua", "ID-PA", "Province"),
new("Riau", "ID-RI", "Province"),
new("Riau Islands", "ID-KR", "Province"),
new("Southeast Sulawesi", "ID-SG", "Province"),
new("South Kalimantan", "ID-KS", "Province"),
new("South Sulawesi", "ID-SN", "Province"),
new("South Sumatra", "ID-SS", "Province"),
new("Special Region of Yogyakarta", "ID-YO", "Special Region"),
new("West Java", "ID-JB", "Province"),
new("West Kalimantan", "ID-KB", "Province"),
new("West Nusa Tenggara", "ID-NB", "Province"),
new("West Papua", "ID-PA", "Province"),
new("West Sulawesi", "ID-SB", "Province"),
new("West Sumatra", "ID-SB", "Province"),
new("South East Sulawesi", "ID-SG", "Province")
];

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

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
INDONESIA_COUNTRY_NAME,
INDONESIA_OFFICIAL_NAME,
INDONESIA_NATIVE_NAME,
INDONESIA_CAPITAL,
INDONESIA_NUMERIC_CODE,
INDONESIA_ISO2_CODE,
INDONESIA_ISO3_CODE,
INDONESIA_CALLING_CODE,
EXPECTED_STATES
);
}
}
72 changes: 72 additions & 0 deletions src/World.Net.UnitTests/Countries/IranTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
namespace World.Net.UnitTests.Countries;

public sealed class IranTest : AssertCountryTestBase
{
private const string IRAN_COUNTRY_NAME = "Iran";
private const string IRAN_NATIVE_NAME = "ایران";
private const string IRAN_CAPITAL = "Tehran";
private const string IRAN_OFFICIAL_NAME = "Islamic Republic of Iran";
private const string IRAN_ISO2_CODE = "IR";
private const string IRAN_ISO3_CODE = "IRN";
private const int IRAN_NUMERIC_CODE = 364;
private readonly string[] IRAN_CALLING_CODE = ["+98"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Iran;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
[
new("Alborz", "IR-AL", "Province"),
new("Ardabil", "IR-AR", "Province"),
new("Bushehr", "IR-BU", "Province"),
new("Chaharmahal and Bakhtiari", "IR-CH", "Province"),
new("East Azerbaijan", "IR-ES", "Province"),
new("Fars", "IR-FA", "Province"),
new("Gilan", "IR-GI", "Province"),
new("Golestan", "IR-GO", "Province"),
new("Hamadan", "IR-HM", "Province"),
new("Hormozgan", "IR-HR", "Province"),
new("Ilam", "IR-IL", "Province"),
new("Isfahan", "IR-IS", "Province"),
new("Kerman", "IR-KR", "Province"),
new("Kermanshah", "IR-KS", "Province"),
new("Khorasan North", "IR-KN", "Province"),
new("Khorasan Razavi", "IR-KRZ", "Province"),
new("Khorasan South", "IR-KS", "Province"),
new("Khuzestan", "IR-KH", "Province"),
new("Kohgiluyeh and Boyer-Ahmad", "IR-KB", "Province"),
new("Kurdistan", "IR-KD", "Province"),
new("Lorestan", "IR-LR", "Province"),
new("Markazi", "IR-MK", "Province"),
new("Mazandaran", "IR-MZ", "Province"),
new("Qazvin", "IR-QZ", "Province"),
new("Qom", "IR-QM", "Province"),
new("Semnan", "IR-SM", "Province"),
new("Sistan and Baluchestan", "IR-SB", "Province"),
new("Tehran", "IR-TH", "Province"),
new("West Azerbaijan", "IR-WA", "Province"),
new("Yazd", "IR-YZ", "Province"),
new("Zanjan", "IR-ZN", "Province")
];

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

// Assert
AssertCorrectInformation(
country,
EXPECTEDID,
IRAN_COUNTRY_NAME,
IRAN_OFFICIAL_NAME,
IRAN_NATIVE_NAME,
IRAN_CAPITAL,
IRAN_NUMERIC_CODE,
IRAN_ISO2_CODE,
IRAN_ISO3_CODE,
IRAN_CALLING_CODE,
EXPECTED_STATES
);
}
}
56 changes: 56 additions & 0 deletions src/World.Net/Countries/Hungary.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
namespace World.Net.Countries;

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

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

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

//<inheritdoc/>
public string NativeName => "Magyarország";

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

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

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

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

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

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Budapest", "HU-BU", "Capital City"),
new("Bács-Kiskun", "HU-BK", "County"),
new("Baranya", "HU-BA", "County"),
new("Békés", "HU-BE", "County"),
new("Borsod-Abaúj-Zemplén", "HU-BO", "County"),
new("Csongrád-Csanád", "HU-CS", "County"),
new("Fejér", "HU-FE", "County"),
new("Győr-Moson-Sopron", "HU-GS", "County"),
new("Hajdú-Bihar", "HU-HB", "County"),
new("Heves", "HU-HE", "County"),
new("Jász-Nagykun-Szolnok", "HU-JN", "County"),
new("Komárom-Esztergom", "HU-KM", "County"),
new("Nógrád", "HU-NO", "County"),
new("Pest", "HU-PE", "County"),
new("Somogy", "HU-SO", "County"),
new("Szabolcs-Szatmár-Bereg", "HU-SZ", "County"),
new("Tolna", "HU-TO", "County"),
new("Vas", "HU-VA", "County"),
new("Veszprém", "HU-VE", "County"),
new("Zala", "HU-ZA", "County")
];
}
Loading