Skip to content

Commit 2d6e952

Browse files
authored
Merge pull request #92 from deanology/NewCountries_4
Hungary, Iceland, India, Indonesia, Iran
2 parents bf738cc + 35a287a commit 2d6e952

File tree

11 files changed

+649
-0
lines changed

11 files changed

+649
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class HungaryTest : AssertCountryTestBase
4+
{
5+
private const string HUNGARY_COUNTRY_NAME = "Hungary";
6+
private const string HUNGARY_NATIVE_NAME = "Magyarország";
7+
private const string HUNGARY_CAPITAL = "Budapest";
8+
private const string HUNGARY_OFFICIAL_NAME = "Hungary";
9+
private const string HUNGARY_ISO2_CODE = "HU";
10+
private const string HUNGARY_ISO3_CODE = "HUN";
11+
private const int HUNGARY_NUMERIC_CODE = 348;
12+
private readonly string[] HUNGARY_CALLING_CODE = ["+36"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Hungary;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Budapest", "HU-BU", "Capital City"),
18+
new("Bács-Kiskun", "HU-BK", "County"),
19+
new("Baranya", "HU-BA", "County"),
20+
new("Békés", "HU-BE", "County"),
21+
new("Borsod-Abaúj-Zemplén", "HU-BO", "County"),
22+
new("Csongrád-Csanád", "HU-CS", "County"),
23+
new("Fejér", "HU-FE", "County"),
24+
new("Győr-Moson-Sopron", "HU-GS", "County"),
25+
new("Hajdú-Bihar", "HU-HB", "County"),
26+
new("Heves", "HU-HE", "County"),
27+
new("Jász-Nagykun-Szolnok", "HU-JN", "County"),
28+
new("Komárom-Esztergom", "HU-KM", "County"),
29+
new("Nógrád", "HU-NO", "County"),
30+
new("Pest", "HU-PE", "County"),
31+
new("Somogy", "HU-SO", "County"),
32+
new("Szabolcs-Szatmár-Bereg", "HU-SZ", "County"),
33+
new("Tolna", "HU-TO", "County"),
34+
new("Vas", "HU-VA", "County"),
35+
new("Veszprém", "HU-VE", "County"),
36+
new("Zala", "HU-ZA", "County")
37+
];
38+
39+
[Fact]
40+
public void GetCountry_ReturnsCorrectInformation_ForHungary()
41+
{
42+
// Arrange
43+
// Act
44+
var country = CountryProvider.GetCountry(EXPECTEDID);
45+
46+
// Assert
47+
AssertCorrectInformation(
48+
country,
49+
EXPECTEDID,
50+
HUNGARY_COUNTRY_NAME,
51+
HUNGARY_OFFICIAL_NAME,
52+
HUNGARY_NATIVE_NAME,
53+
HUNGARY_CAPITAL,
54+
HUNGARY_NUMERIC_CODE,
55+
HUNGARY_ISO2_CODE,
56+
HUNGARY_ISO3_CODE,
57+
HUNGARY_CALLING_CODE,
58+
EXPECTED_STATES
59+
);
60+
}
61+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class IcelandTest : AssertCountryTestBase
4+
{
5+
private const string ICELAND_COUNTRY_NAME = "Iceland";
6+
private const string ICELAND_NATIVE_NAME = "Ísland";
7+
private const string ICELAND_CAPITAL = "Reykjavík";
8+
private const string ICELAND_OFFICIAL_NAME = "Republic of Iceland";
9+
private const string ICELAND_ISO2_CODE = "IS";
10+
private const string ICELAND_ISO3_CODE = "ISL";
11+
private const int ICELAND_NUMERIC_CODE = 352;
12+
private readonly string[] ICELAND_CALLING_CODE = ["+354"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Iceland;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Capital Region", "IS-1", "Region"),
18+
new("Southern Peninsula", "IS-2", "Region"),
19+
new("West", "IS-3", "Region"),
20+
new("Westfjords", "IS-4", "Region"),
21+
new("North", "IS-5", "Region"),
22+
new("Northwest", "IS-6", "Region"),
23+
new("East", "IS-7", "Region"),
24+
new("South", "IS-8", "Region")
25+
];
26+
27+
[Fact]
28+
public void GetCountry_ReturnsCorrectInformation_ForIceland()
29+
{
30+
// Arrange
31+
// Act
32+
var country = CountryProvider.GetCountry(EXPECTEDID);
33+
34+
// Assert
35+
AssertCorrectInformation(
36+
country,
37+
EXPECTEDID,
38+
ICELAND_COUNTRY_NAME,
39+
ICELAND_OFFICIAL_NAME,
40+
ICELAND_NATIVE_NAME,
41+
ICELAND_CAPITAL,
42+
ICELAND_NUMERIC_CODE,
43+
ICELAND_ISO2_CODE,
44+
ICELAND_ISO3_CODE,
45+
ICELAND_CALLING_CODE,
46+
EXPECTED_STATES
47+
);
48+
}
49+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class IndiaTest : AssertCountryTestBase
4+
{
5+
private const string INDIA_COUNTRY_NAME = "India";
6+
private const string INDIA_NATIVE_NAME = "भारत";
7+
private const string INDIA_CAPITAL = "New Delhi";
8+
private const string INDIA_OFFICIAL_NAME = "Republic of India";
9+
private const string INDIA_ISO2_CODE = "IN";
10+
private const string INDIA_ISO3_CODE = "IND";
11+
private const int INDIA_NUMERIC_CODE = 356;
12+
private readonly string[] INDIA_CALLING_CODE = ["+91"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.India;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Andhra Pradesh", "IN-AP", "State"),
18+
new("Arunachal Pradesh", "IN-AR", "State"),
19+
new("Assam", "IN-AS", "State"),
20+
new("Bihar", "IN-BR", "State"),
21+
new("Chhattisgarh", "IN-CT", "State"),
22+
new("Goa", "IN-GA", "State"),
23+
new("Gujarat", "IN-GJ", "State"),
24+
new("Haryana", "IN-HR", "State"),
25+
new("Himachal Pradesh", "IN-HP", "State"),
26+
new("Jharkhand", "IN-JH", "State"),
27+
new("Karnataka", "IN-KA", "State"),
28+
new("Kerala", "IN-KL", "State"),
29+
new("Madhya Pradesh", "IN-MP", "State"),
30+
new("Maharashtra", "IN-MH", "State"),
31+
new("Manipur", "IN-MN", "State"),
32+
new("Meghalaya", "IN-ML", "State"),
33+
new("Mizoram", "IN-MZ", "State"),
34+
new("Nagaland", "IN-NL", "State"),
35+
new("Odisha", "IN-OR", "State"),
36+
new("Punjab", "IN-PB", "State"),
37+
new("Rajasthan", "IN-RJ", "State"),
38+
new("Sikkim", "IN-SK", "State"),
39+
new("Tamil Nadu", "IN-TN", "State"),
40+
new("Telangana", "IN-TG", "State"),
41+
new("Tripura", "IN-TR", "State"),
42+
new("Uttar Pradesh", "IN-UP", "State"),
43+
new("Uttarakhand", "IN-UT", "State"),
44+
new("West Bengal", "IN-WB", "State"),
45+
new("Andaman and Nicobar Islands", "IN-AN", "Union Territory"),
46+
new("Chandigarh", "IN-CH", "Union Territory"),
47+
new("Dadra and Nagar Haveli and Daman and Diu", "IN-DN", "Union Territory"),
48+
new("Delhi", "IN-DL", "Union Territory"),
49+
new("Jammu and Kashmir", "IN-JK", "Union Territory"),
50+
new("Ladakh", "IN-LA", "Union Territory"),
51+
new("Lakshadweep", "IN-LD", "Union Territory"),
52+
new("Puducherry", "IN-PY", "Union Territory")
53+
];
54+
55+
[Fact]
56+
public void GetCountry_ReturnsCorrectInformation_ForIndia()
57+
{
58+
// Arrange
59+
// Act
60+
var country = CountryProvider.GetCountry(EXPECTEDID);
61+
62+
// Assert
63+
AssertCorrectInformation(
64+
country,
65+
EXPECTEDID,
66+
INDIA_COUNTRY_NAME,
67+
INDIA_OFFICIAL_NAME,
68+
INDIA_NATIVE_NAME,
69+
INDIA_CAPITAL,
70+
INDIA_NUMERIC_CODE,
71+
INDIA_ISO2_CODE,
72+
INDIA_ISO3_CODE,
73+
INDIA_CALLING_CODE,
74+
EXPECTED_STATES
75+
);
76+
}
77+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class IndonesiaTest : AssertCountryTestBase
4+
{
5+
private const string INDONESIA_COUNTRY_NAME = "Indonesia";
6+
private const string INDONESIA_NATIVE_NAME = "Indonesia";
7+
private const string INDONESIA_CAPITAL = "Jakarta";
8+
private const string INDONESIA_OFFICIAL_NAME = "Republic of Indonesia";
9+
private const string INDONESIA_ISO2_CODE = "ID";
10+
private const string INDONESIA_ISO3_CODE = "IDN";
11+
private const int INDONESIA_NUMERIC_CODE = 360;
12+
private readonly string[] INDONESIA_CALLING_CODE = ["+62"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Indonesia;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Aceh", "ID-AC", "Special Region"),
18+
new("Bali", "ID-BA", "Province"),
19+
new("Banten", "ID-BT", "Province"),
20+
new("Bengkulu", "ID-BE", "Province"),
21+
new("Central Java", "ID-JT", "Province"),
22+
new("Central Kalimantan", "ID-KT", "Province"),
23+
new("Central Sulawesi", "ID-ST", "Province"),
24+
new("East Java", "ID-JI", "Province"),
25+
new("East Kalimantan", "ID-KI", "Province"),
26+
new("East Nusa Tenggara", "ID-NT", "Province"),
27+
new("Gorontalo", "ID-GO", "Province"),
28+
new("Jakarta", "ID-JK", "Special Capital Region"),
29+
new("Jambi", "ID-JA", "Province"),
30+
new("Lampung", "ID-LA", "Province"),
31+
new("Maluku", "ID-MA", "Province"),
32+
new("North Kalimantan", "ID-KU", "Province"),
33+
new("North Maluku", "ID-MU", "Province"),
34+
new("North Sulawesi", "ID-SA", "Province"),
35+
new("North Sumatra", "ID-SU", "Province"),
36+
new("Papua", "ID-PA", "Province"),
37+
new("Riau", "ID-RI", "Province"),
38+
new("Riau Islands", "ID-KR", "Province"),
39+
new("Southeast Sulawesi", "ID-SG", "Province"),
40+
new("South Kalimantan", "ID-KS", "Province"),
41+
new("South Sulawesi", "ID-SN", "Province"),
42+
new("South Sumatra", "ID-SS", "Province"),
43+
new("Special Region of Yogyakarta", "ID-YO", "Special Region"),
44+
new("West Java", "ID-JB", "Province"),
45+
new("West Kalimantan", "ID-KB", "Province"),
46+
new("West Nusa Tenggara", "ID-NB", "Province"),
47+
new("West Papua", "ID-PA", "Province"),
48+
new("West Sulawesi", "ID-SB", "Province"),
49+
new("West Sumatra", "ID-SB", "Province"),
50+
new("South East Sulawesi", "ID-SG", "Province")
51+
];
52+
53+
[Fact]
54+
public void GetCountry_ReturnsCorrectInformation_ForIndonesia()
55+
{
56+
// Arrange
57+
// Act
58+
var country = CountryProvider.GetCountry(EXPECTEDID);
59+
60+
// Assert
61+
AssertCorrectInformation(
62+
country,
63+
EXPECTEDID,
64+
INDONESIA_COUNTRY_NAME,
65+
INDONESIA_OFFICIAL_NAME,
66+
INDONESIA_NATIVE_NAME,
67+
INDONESIA_CAPITAL,
68+
INDONESIA_NUMERIC_CODE,
69+
INDONESIA_ISO2_CODE,
70+
INDONESIA_ISO3_CODE,
71+
INDONESIA_CALLING_CODE,
72+
EXPECTED_STATES
73+
);
74+
}
75+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class IranTest : AssertCountryTestBase
4+
{
5+
private const string IRAN_COUNTRY_NAME = "Iran";
6+
private const string IRAN_NATIVE_NAME = "ایران";
7+
private const string IRAN_CAPITAL = "Tehran";
8+
private const string IRAN_OFFICIAL_NAME = "Islamic Republic of Iran";
9+
private const string IRAN_ISO2_CODE = "IR";
10+
private const string IRAN_ISO3_CODE = "IRN";
11+
private const int IRAN_NUMERIC_CODE = 364;
12+
private readonly string[] IRAN_CALLING_CODE = ["+98"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Iran;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
new("Alborz", "IR-AL", "Province"),
18+
new("Ardabil", "IR-AR", "Province"),
19+
new("Bushehr", "IR-BU", "Province"),
20+
new("Chaharmahal and Bakhtiari", "IR-CH", "Province"),
21+
new("East Azerbaijan", "IR-ES", "Province"),
22+
new("Fars", "IR-FA", "Province"),
23+
new("Gilan", "IR-GI", "Province"),
24+
new("Golestan", "IR-GO", "Province"),
25+
new("Hamadan", "IR-HM", "Province"),
26+
new("Hormozgan", "IR-HR", "Province"),
27+
new("Ilam", "IR-IL", "Province"),
28+
new("Isfahan", "IR-IS", "Province"),
29+
new("Kerman", "IR-KR", "Province"),
30+
new("Kermanshah", "IR-KS", "Province"),
31+
new("Khorasan North", "IR-KN", "Province"),
32+
new("Khorasan Razavi", "IR-KRZ", "Province"),
33+
new("Khorasan South", "IR-KS", "Province"),
34+
new("Khuzestan", "IR-KH", "Province"),
35+
new("Kohgiluyeh and Boyer-Ahmad", "IR-KB", "Province"),
36+
new("Kurdistan", "IR-KD", "Province"),
37+
new("Lorestan", "IR-LR", "Province"),
38+
new("Markazi", "IR-MK", "Province"),
39+
new("Mazandaran", "IR-MZ", "Province"),
40+
new("Qazvin", "IR-QZ", "Province"),
41+
new("Qom", "IR-QM", "Province"),
42+
new("Semnan", "IR-SM", "Province"),
43+
new("Sistan and Baluchestan", "IR-SB", "Province"),
44+
new("Tehran", "IR-TH", "Province"),
45+
new("West Azerbaijan", "IR-WA", "Province"),
46+
new("Yazd", "IR-YZ", "Province"),
47+
new("Zanjan", "IR-ZN", "Province")
48+
];
49+
50+
[Fact]
51+
public void GetCountry_ReturnsCorrectInformation_ForIran()
52+
{
53+
// Arrange
54+
// Act
55+
var country = CountryProvider.GetCountry(EXPECTEDID);
56+
57+
// Assert
58+
AssertCorrectInformation(
59+
country,
60+
EXPECTEDID,
61+
IRAN_COUNTRY_NAME,
62+
IRAN_OFFICIAL_NAME,
63+
IRAN_NATIVE_NAME,
64+
IRAN_CAPITAL,
65+
IRAN_NUMERIC_CODE,
66+
IRAN_ISO2_CODE,
67+
IRAN_ISO3_CODE,
68+
IRAN_CALLING_CODE,
69+
EXPECTED_STATES
70+
);
71+
}
72+
}

src/World.Net/Countries/Hungary.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Hungary : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Hungary;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Hungary";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Hungary";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "Magyarország";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Budapest";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 348;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "HU";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "HUN";
28+
29+
//<inheritdoc/>
30+
public string[] CallingCode { get; } = ["+36"];
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Budapest", "HU-BU", "Capital City"),
36+
new("Bács-Kiskun", "HU-BK", "County"),
37+
new("Baranya", "HU-BA", "County"),
38+
new("Békés", "HU-BE", "County"),
39+
new("Borsod-Abaúj-Zemplén", "HU-BO", "County"),
40+
new("Csongrád-Csanád", "HU-CS", "County"),
41+
new("Fejér", "HU-FE", "County"),
42+
new("Győr-Moson-Sopron", "HU-GS", "County"),
43+
new("Hajdú-Bihar", "HU-HB", "County"),
44+
new("Heves", "HU-HE", "County"),
45+
new("Jász-Nagykun-Szolnok", "HU-JN", "County"),
46+
new("Komárom-Esztergom", "HU-KM", "County"),
47+
new("Nógrád", "HU-NO", "County"),
48+
new("Pest", "HU-PE", "County"),
49+
new("Somogy", "HU-SO", "County"),
50+
new("Szabolcs-Szatmár-Bereg", "HU-SZ", "County"),
51+
new("Tolna", "HU-TO", "County"),
52+
new("Vas", "HU-VA", "County"),
53+
new("Veszprém", "HU-VE", "County"),
54+
new("Zala", "HU-ZA", "County")
55+
];
56+
}

0 commit comments

Comments
 (0)