Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Clifftech123 authored Nov 11, 2024
2 parents cd3c764 + 99cb9a1 commit ba179e4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ We are committed to fostering a welcoming and respectful community for everyone.


### Comming Soon
* Support for ISO 4217 Currency Codes
* Support for ISO 3166 Country A3 Codes
* Country ShortCode Enums

Expand Down
18 changes: 9 additions & 9 deletions src/CountryData.Standard/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -16498,39 +16498,39 @@
],
"regions": [
{
"name": "Basnahira",
"name": "Western Province",
"shortCode": "1"
},
{
"name": "Dakunu",
"name": "Southern Province",
"shortCode": "3"
},
{
"name": "Madhyama",
"name": "Central Province",
"shortCode": "2"
},
{
"name": "Naegenahira",
"name": "Eastern Province",
"shortCode": "5"
},
{
"name": "Sabaragamuwa",
"name": "Sabaragamuwa Province",
"shortCode": "9"
},
{
"name": "Uturu",
"name": "Northern Province",
"shortCode": "4"
},
{
"name": "Uturumaeda",
"name": "North Central Province",
"shortCode": "7"
},
{
"name": "Vayamba",
"name": "North Western Province",
"shortCode": "6"
},
{
"name": "Uva",
"name": "Uva Province",
"shortCode": "8"
}
]
Expand Down
23 changes: 19 additions & 4 deletions test/CountryData.UnitTests/CountryHelperTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ public void GetCountriesByPhoneCode_WithCorrectPhoneCode_ShouldReturnCountries(s
countries.Any(c => c.CountryShortCode == expectedShortCode).Should().BeTrue();
}



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

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

[Theory]
[InlineData("LK")]
public void GetRegions_WithCorrectCode_ShouldReturnCountryRegions(string shortCode)
{
//Act
var regions = _countryHelper.GetRegionByCountryCode(shortCode);


//Assert
regions.Should().NotBeNull();
if (shortCode == "LK")
{
regions.Should().HaveCount(9);
}
}
}

0 comments on commit ba179e4

Please sign in to comment.