Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Clifftech123 authored Nov 11, 2024
2 parents 62a32b8 + 8ec2394 commit 03f0971
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 55 deletions.
Binary file added Assets/CountryData.Net.Logo.Small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@

<!-- logo -->

![Logo](./Assets/CountryData.Net.Logo.png)
<img src="./Assets/CountryData.Net.Logo.Small.png" alt="Logo" width="250" height="200"/>

A cross-platform library designed to provide seamless access to global country data for .NET applications without making any http calls.
Our aim is to simplify the process of integrating standardised global data into your applications, making it an ideal tool for developers who require international data.

### Project Status

| | |
|-|-|
Expand Down Expand Up @@ -127,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
70 changes: 21 additions & 49 deletions src/CountryData.Standard/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -11712,60 +11712,32 @@
],
"regions": [
{
"name": "Bagmati",
"shortCode": "BA"
"name": "Koshi",
"shortCode": "1"
},
{
"name": "Bheri",
"shortCode": "BH"
"name": "Madhesh",
"shortCode": "2"
},
{
"name": "Dhawalagiri",
"shortCode": "DH"
"name": "Bagmati",
"shortCode": "3"
},
{
"name": "Gandaki",
"shortCode": "GA"
},
{
"name": "Janakpur",
"shortCode": "JA"
},
{
"name": "Karnali",
"shortCode": "KA"
},
{
"name": "Kosi",
"shortCode": "KO"
"shortCode": "4"
},
{
"name": "Lumbini",
"shortCode": "LU"
},
{
"name": "Mahakali",
"shortCode": "MA"
},
{
"name": "Mechi",
"shortCode": "ME"
},
{
"name": "Narayani",
"shortCode": "NA"
},
{
"name": "Rapti",
"shortCode": "RA"
"shortCode": "5"
},
{
"name": "Sagarmatha",
"shortCode": "SA"
"name": "Karnali",
"shortCode": "6"
},
{
"name": "Seti",
"shortCode": "SE"
"name": "Sudurpashchim",
"shortCode": "7"
}
]
},
Expand Down Expand Up @@ -16526,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 03f0971

Please sign in to comment.