Skip to content

Commit 99cb9a1

Browse files
authored
Merge pull request #38 from poorna-soysa/master
Update Sri Lanka Province Names to English and Add Test Method
2 parents 658891c + 225e180 commit 99cb9a1

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

src/CountryData.Standard/data.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16526,39 +16526,39 @@
1652616526
],
1652716527
"regions": [
1652816528
{
16529-
"name": "Basnahira",
16529+
"name": "Western Province",
1653016530
"shortCode": "1"
1653116531
},
1653216532
{
16533-
"name": "Dakunu",
16533+
"name": "Southern Province",
1653416534
"shortCode": "3"
1653516535
},
1653616536
{
16537-
"name": "Madhyama",
16537+
"name": "Central Province",
1653816538
"shortCode": "2"
1653916539
},
1654016540
{
16541-
"name": "Naegenahira",
16541+
"name": "Eastern Province",
1654216542
"shortCode": "5"
1654316543
},
1654416544
{
16545-
"name": "Sabaragamuwa",
16545+
"name": "Sabaragamuwa Province",
1654616546
"shortCode": "9"
1654716547
},
1654816548
{
16549-
"name": "Uturu",
16549+
"name": "Northern Province",
1655016550
"shortCode": "4"
1655116551
},
1655216552
{
16553-
"name": "Uturumaeda",
16553+
"name": "North Central Province",
1655416554
"shortCode": "7"
1655516555
},
1655616556
{
16557-
"name": "Vayamba",
16557+
"name": "North Western Province",
1655816558
"shortCode": "6"
1655916559
},
1656016560
{
16561-
"name": "Uva",
16561+
"name": "Uva Province",
1656216562
"shortCode": "8"
1656316563
}
1656416564
]

test/CountryData.UnitTests/CountryHelperTests.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,7 @@ public void GetCountriesByPhoneCode_WithCorrectPhoneCode_ShouldReturnCountries(s
130130
countries.Any(c => c.CountryShortCode == expectedShortCode).Should().BeTrue();
131131
}
132132

133-
134-
135-
/// <summary>
133+
/// <summary>
136134
/// Tests the GetCurrencyCodesByCountryCode method in the CountryHelper class.
137135
/// This test verifies if the method correctly returns the primary currency (code and name) for a given country's short code.
138136
/// Assumes that each country has one primary currency for simplicity.
@@ -210,7 +208,24 @@ public void GetCountryByCurrencyCode_WhenCountryDataIsNotInitialized_ShouldThrow
210208
act.Should().Throw<InvalidOperationException>().WithMessage("Country data is not initialized.");
211209
}
212210

211+
/// <summary>
212+
/// Tests the GetRegionByCountryCode method in the CountryHelper class.
213+
/// This test verifies if the method correctly returns the regions associated with a given country's short code.
214+
/// </summary>
215+
/// <param name="shortCode">The short code of the country for which the regions are to be retrieved.</param>
213216

217+
[Theory]
218+
[InlineData("LK")]
219+
public void GetRegions_WithCorrectCode_ShouldReturnCountryRegions(string shortCode)
220+
{
221+
//Act
222+
var regions = _countryHelper.GetRegionByCountryCode(shortCode);
214223

215-
224+
//Assert
225+
regions.Should().NotBeNull();
226+
if (shortCode == "LK")
227+
{
228+
regions.Should().HaveCount(9);
229+
}
230+
}
216231
}

0 commit comments

Comments
 (0)