Skip to content

Commit 5aaee0f

Browse files
authored
Georgia country and unit test (#81)
1 parent 84270a1 commit 5aaee0f

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class GeorgiaTest : AssertCountryTestBase
4+
{
5+
private const string GEORGIA_COUNTRY_NAME = "Georgia";
6+
private const string GEORGIA_NATIVE_NAME = "საქართველო";
7+
private const string GEORGIA_CAPITAL = "Tbilisi";
8+
private const string GEORGIA_OFFICIAL_NAME = "Georgia";
9+
private const string GEORGIA_ISO2_CODE = "GE";
10+
private const string GEORGIA_ISO3_CODE = "GEO";
11+
private const int GEORGIA_NUMERIC_CODE = 268;
12+
private readonly string[] GEORGIA_CALLING_CODE = ["+995"];
13+
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Georgia;
14+
15+
private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
16+
[
17+
// Autonomous Republics
18+
new("Abkhazia", "GE-AB", "Autonomous Republic"),
19+
new("Adjara", "GE-AJ", "Autonomous Republic"),
20+
21+
// Regions
22+
new("Guria", "GE-GU", "Region"),
23+
new("Imereti", "GE-IM", "Region"),
24+
new("Kakheti", "GE-KA", "Region"),
25+
new("Kvemo Kartli", "GE-KK", "Region"),
26+
new("Mtskheta-Mtianeti", "GE-MM", "Region"),
27+
new("Racha-Lechkhumi and Kvemo Svaneti", "GE-RL", "Region"),
28+
new("Samegrelo-Zemo Svaneti", "GE-SZ", "Region"),
29+
new("Samtskhe-Javakheti", "GE-SJ", "Region"),
30+
new("Shida Kartli", "GE-SK", "Region"),
31+
32+
// Capital city
33+
new("Tbilisi", "GE-TB", "City")
34+
];
35+
36+
[Fact]
37+
public void GetCountry_ReturnsCorrectInformation_ForGeorgia()
38+
{
39+
// Arrange
40+
// Act
41+
var country = CountryProvider.GetCountry(EXPECTEDID);
42+
43+
// Assert
44+
AssertCorrectInformation(
45+
country,
46+
EXPECTEDID,
47+
GEORGIA_COUNTRY_NAME,
48+
GEORGIA_OFFICIAL_NAME,
49+
GEORGIA_NATIVE_NAME,
50+
GEORGIA_CAPITAL,
51+
GEORGIA_NUMERIC_CODE,
52+
GEORGIA_ISO2_CODE,
53+
GEORGIA_ISO3_CODE,
54+
GEORGIA_CALLING_CODE,
55+
EXPECTED_STATES
56+
);
57+
}
58+
}
59+

src/World.Net/Countries/Georgia.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Georgia : ICountry
4+
{
5+
//<inheritdoc/>
6+
public CountryIdentifier Id => CountryIdentifier.Georgia;
7+
8+
//<inheritdoc/>
9+
public string Name { get; } = "Georgia";
10+
11+
//<inheritdoc/>
12+
public string OfficialName { get; } = "Georgia";
13+
14+
//<inheritdoc/>
15+
public string NativeName => "საქართველო";
16+
17+
//<inheritdoc/>
18+
public string Capital { get; } = "Tbilisi";
19+
20+
//<inheritdoc/>
21+
public int NumericCode { get; } = 268;
22+
23+
//<inheritdoc/>
24+
public string ISO2Code { get; } = "GE";
25+
26+
//<inheritdoc/>
27+
public string ISO3Code { get; } = "GEO";
28+
29+
//<inheritdoc/>
30+
public string[] CallingCode { get; } = ["+995"];
31+
32+
//<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
// Autonomous Republics
36+
new("Abkhazia", "GE-AB", "Autonomous Republic"),
37+
new("Adjara", "GE-AJ", "Autonomous Republic"),
38+
39+
// Regions
40+
new("Guria", "GE-GU", "Region"),
41+
new("Imereti", "GE-IM", "Region"),
42+
new("Kakheti", "GE-KA", "Region"),
43+
new("Kvemo Kartli", "GE-KK", "Region"),
44+
new("Mtskheta-Mtianeti", "GE-MM", "Region"),
45+
new("Racha-Lechkhumi and Kvemo Svaneti", "GE-RL", "Region"),
46+
new("Samegrelo-Zemo Svaneti", "GE-SZ", "Region"),
47+
new("Samtskhe-Javakheti", "GE-SJ", "Region"),
48+
new("Shida Kartli", "GE-SK", "Region"),
49+
50+
// Capital city
51+
new("Tbilisi", "GE-TB", "City")
52+
];
53+
}

src/World.Net/Helpers/CountryInitializer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
8585
{ CountryIdentifier.FrenchGuiana, new FrenchGuiana() },
8686
{ CountryIdentifier.FrenchPolynesia, new FrenchPolynesia() },
8787
{ CountryIdentifier.Gabon, new Gabon() },
88+
{ CountryIdentifier.Georgia, new Georgia() },
8889
{ CountryIdentifier.Iraq, new Iraq() },
8990
{ CountryIdentifier.Ireland, new Ireland() },
9091
{ CountryIdentifier.Israel, new Israel() },

0 commit comments

Comments
 (0)