Skip to content

Commit c3cf9d6

Browse files
committed
Reverts the last commit, moving changes back to the working directory without discarding them. This affects the following files, marking them as modified in the working directory:
- README.md: Main project documentation. - docs/README.md: Additional documentation located in the docs directory. - sample/CountryData.Sample.Console/Program.cs: Console application sample code demonstrating usage. - sample/CountryData.Sample.Web.API/Controllers/CountryController.cs: Web API sample controller for country data. - sample/CountryData.Sample.Web.API/Program.cs: Entry point for the Web API sample application. - src/CountryData.Standard/CountryHelper.cs: Core library code for country data manipulation. - test/CountryData.UnitTests/CountryHelperTests.cs: Unit tests for the CountryHelper class.
1 parent 3a65201 commit c3cf9d6

7 files changed

Lines changed: 12 additions & 18 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The CountryData.Standard library provides a set of methods that allow you to ret
100100
|--------|-------------|
101101
| [`GetCountryData()`](./docs/README.md) | Returns all country data including region, short code, and country name. |
102102
| [`GetCountryByCode(string shortCode)`](./docs/README.md) | Returns a single country's data by its short code. |
103-
| [`GetCountryFlag(string shortCode)`](./docs/README.md) | Gets the flag of the country, represented as an emoji, by the country's short code. |
103+
| [`GetCountryEmojiFlag(string shortCode)`](./docs/README.md) | Gets the flag of the country, represented as an emoji, by the country's short code. |
104104
| [`GetRegionByCountryCode(string ShortCode)`](./docs/README.md) | Selects and returns a list of regions for a particular country identified by its short code. |
105105
| [`GetCountries()`](./docs/README.md) | Gets the list of all country names. |
106106
| [`GetPhoneCodeByCountryShortCode(string shortCode)`](./docs/README.md) | Returns a single country's phone code by its short code. |

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ This method is particularly useful for applications that need to display or anal
116116

117117

118118

119-
### GetCountryFlag (string shortCode)
119+
### GetCountryEmojiFlag (string shortCode)
120120

121-
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.
121+
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.
122122

123123
Here's the method signature in C#:
124124

sample/CountryData.Sample.Console/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void GetRegionsByCountryCode(string countryCode)
8383
/// <param name="shortCode">The country short code.</param>
8484
static void GetCountryFlag(string shortCode)
8585
{
86-
var flag = _helper.GetCountryFlag(shortCode);
86+
var flag = _helper.GetCountryEmojiFlag(shortCode);
8787
Console.WriteLine($"Flag for {shortCode}:");
8888
Console.WriteLine(flag);
8989
}

sample/CountryData.Sample.Web.API/Controllers/CountryController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ public IActionResult GetRegionsByCountryCode([FromQuery] string countryCode)
105105
[HttpGet("flag")]
106106
[ProducesResponseType(typeof(string), 200)]
107107
[ProducesResponseType(404)]
108-
public IActionResult GetCountryFlag([FromQuery] string countryCode)
108+
public IActionResult GetCountryEmojiFlag([FromQuery] string countryCode)
109109
{
110-
var flag = _helper.GetCountryFlag(countryCode);
110+
var flag = _helper.GetCountryEmojiFlag(countryCode);
111111
if (flag == null)
112112
{
113113
return NotFound();

sample/CountryData.Sample.Web.API/Program.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
var builder = WebApplication.CreateBuilder(args);
22

3-
static void NewMethod(WebApplication app)
4-
{
5-
app.Run();
6-
}
7-
83
// Add services to the container.
9-
104
builder.Services.AddControllers();
115
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
126
builder.Services.AddEndpointsApiExplorer();
137
builder.Services.AddSwaggerGen();
148

15-
16-
9+
// Register CountryHelper service
1710
builder.Services.AddScoped<CountryData.Standard.CountryHelper>();
1811

1912
var app = builder.Build();
@@ -31,4 +24,5 @@ static void NewMethod(WebApplication app)
3124

3225
app.MapControllers();
3326

34-
NewMethod(app);
27+
// Start the application
28+
app.Run();

src/CountryData.Standard/CountryHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public CountryHelper()
1717
_Countries = JsonConvert.DeserializeObject<List<Country>>(json);
1818
foreach (var country in _Countries)
1919
{
20-
country.CountryFlag = GetCountryFlag(country.CountryShortCode);
20+
country.CountryFlag = GetCountryEmojiFlag(country.CountryShortCode);
2121
}
2222
}
2323

@@ -67,7 +67,7 @@ public Country GetCountryByCode(string shortCode)
6767
/// </summary>
6868
/// <param name="country"></param>
6969
/// <returns></returns>
70-
public string GetCountryFlag (string shortCode)
70+
public string GetCountryEmojiFlag(string shortCode)
7171
{
7272
return string.Concat(shortCode.ToUpper().Select(x => char.ConvertFromUtf32(x + 0x1F1A5)));
7373
}

test/CountryData.UnitTests/CountryHelperTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void GetCountryByCode_WithCorrectCode_ShouldReturnCountry(string shortCod
5555
public void GetCountryFlagByCode_WithCorrectCode_ShouldReturnEmojiFlag(string shortCode)
5656
{
5757
//Act
58-
var countryFlag = _countryHelper.GetCountryFlag(shortCode);
58+
var countryFlag = _countryHelper.GetCountryEmojiFlag(shortCode);
5959

6060
//Assert
6161
countryFlag.Should().NotBeNull();

0 commit comments

Comments
 (0)