diff --git a/README.md b/README.md
index adcc848..cf8306b 100644
--- a/README.md
+++ b/README.md
@@ -100,7 +100,7 @@ The CountryData.Standard library provides a set of methods that allow you to ret
|--------|-------------|
| [`GetCountryData()`](./docs/README.md) | Returns all country data including region, short code, and country name. |
| [`GetCountryByCode(string shortCode)`](./docs/README.md) | Returns a single country's data by its short code. |
-| [`GetCountryFlag(string shortCode)`](./docs/README.md) | Gets the flag of the country, represented as an emoji, by the country's short code. |
+| [`GetCountryEmojiFlag(string shortCode)`](./docs/README.md) | Gets the flag of the country, represented as an emoji, by the country's short code. |
| [`GetRegionByCountryCode(string ShortCode)`](./docs/README.md) | Selects and returns a list of regions for a particular country identified by its short code. |
| [`GetCountries()`](./docs/README.md) | Gets the list of all country names. |
| [`GetPhoneCodeByCountryShortCode(string shortCode)`](./docs/README.md) | Returns a single country's phone code by its short code. |
diff --git a/docs/README.md b/docs/README.md
index c758582..0288689 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -116,9 +116,9 @@ This method is particularly useful for applications that need to display or anal
-### GetCountryFlag (string shortCode)
+### GetCountryEmojiFlag (string shortCode)
-The `GetCountryFlag ()` method is designed to fetch the flag of a specific country using its ISO 3166-1 alpha-2 code. This method provides a simple and effective way to visually represent countries in your application.
+The `GetCountryEmojiFlag ()` method is designed to fetch the flag of a specific country using its ISO 3166-1 alpha-2 code. This method provides a simple and effective way to visually represent countries in your application.
Here's the method signature in C#:
diff --git a/sample/CountryData.Sample.Console/Program.cs b/sample/CountryData.Sample.Console/Program.cs
index f158139..ee16da7 100644
--- a/sample/CountryData.Sample.Console/Program.cs
+++ b/sample/CountryData.Sample.Console/Program.cs
@@ -83,7 +83,7 @@ static void GetRegionsByCountryCode(string countryCode)
/// The country short code.
static void GetCountryFlag(string shortCode)
{
- var flag = _helper.GetCountryFlag(shortCode);
+ var flag = _helper.GetCountryEmojiFlag(shortCode);
Console.WriteLine($"Flag for {shortCode}:");
Console.WriteLine(flag);
}
diff --git a/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs b/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
index 03688ea..b0ecaf5 100644
--- a/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
+++ b/sample/CountryData.Sample.Web.API/Controllers/CountryController.cs
@@ -105,9 +105,9 @@ public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
[HttpGet("flag")]
[ProducesResponseType(typeof(string), 200)]
[ProducesResponseType(404)]
- public IActionResult GetCountryFlag([FromQuery] string countryCode)
+ public IActionResult GetCountryEmojiFlag([FromQuery] string countryCode)
{
- var flag = _helper.GetCountryFlag(countryCode);
+ var flag = _helper.GetCountryEmojiFlag(countryCode);
if (flag == null)
{
return NotFound();
diff --git a/sample/CountryData.Sample.Web.API/Program.cs b/sample/CountryData.Sample.Web.API/Program.cs
index 6ab64b9..85b3201 100644
--- a/sample/CountryData.Sample.Web.API/Program.cs
+++ b/sample/CountryData.Sample.Web.API/Program.cs
@@ -1,19 +1,12 @@
var builder = WebApplication.CreateBuilder(args);
-static void NewMethod(WebApplication app)
-{
- app.Run();
-}
-
// Add services to the container.
-
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
-
-
+// Register CountryHelper service
builder.Services.AddScoped();
var app = builder.Build();
@@ -31,4 +24,5 @@ static void NewMethod(WebApplication app)
app.MapControllers();
-NewMethod(app);
\ No newline at end of file
+// Start the application
+app.Run();
\ No newline at end of file
diff --git a/src/CountryData.Standard/CountryHelper.cs b/src/CountryData.Standard/CountryHelper.cs
index d4d829f..7bb1e49 100644
--- a/src/CountryData.Standard/CountryHelper.cs
+++ b/src/CountryData.Standard/CountryHelper.cs
@@ -17,7 +17,7 @@ public CountryHelper()
_Countries = JsonConvert.DeserializeObject>(json);
foreach (var country in _Countries)
{
- country.CountryFlag = GetCountryFlag(country.CountryShortCode);
+ country.CountryFlag = GetCountryEmojiFlag(country.CountryShortCode);
}
}
@@ -67,7 +67,7 @@ public Country GetCountryByCode(string shortCode)
///
///
///
- public string GetCountryFlag (string shortCode)
+ public string GetCountryEmojiFlag(string shortCode)
{
return string.Concat(shortCode.ToUpper().Select(x => char.ConvertFromUtf32(x + 0x1F1A5)));
}
diff --git a/test/CountryData.UnitTests/CountryHelperTests.cs b/test/CountryData.UnitTests/CountryHelperTests.cs
index 2caced4..7691aad 100644
--- a/test/CountryData.UnitTests/CountryHelperTests.cs
+++ b/test/CountryData.UnitTests/CountryHelperTests.cs
@@ -55,7 +55,7 @@ public void GetCountryByCode_WithCorrectCode_ShouldReturnCountry(string shortCod
public void GetCountryFlagByCode_WithCorrectCode_ShouldReturnEmojiFlag(string shortCode)
{
//Act
- var countryFlag = _countryHelper.GetCountryFlag(shortCode);
+ var countryFlag = _countryHelper.GetCountryEmojiFlag(shortCode);
//Assert
countryFlag.Should().NotBeNull();