Skip to content

Commit d345a08

Browse files
authored
Merge pull request #34 from frankodoom/test
Test
2 parents 212eb3e + 0f340b9 commit d345a08

4 files changed

Lines changed: 102 additions & 102 deletions

File tree

CountryData.Standard.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Standard", "src
2222
EndProject
2323
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{BBA69DE8-BE26-498E-9A62-131EB2494972}"
2424
EndProject
25-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.Console", "sample\CountryData.Sample.Console\CountryData.Sample.Console.csproj", "{397666FE-700B-446E-B4EC-13ACF0DDDEBE}"
25+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.ConsoleProject", "sample\CountryData.Sample.Console\CountryData.Sample.ConsoleProject.csproj", "{397666FE-700B-446E-B4EC-13ACF0DDDEBE}"
2626
EndProject
2727
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{131F8946-7828-4AB1-A0B7-279CD142F7E1}"
2828
ProjectSection(SolutionItems) = preProject

sample/CountryData.Sample.Console/CountryData.Sample.Console.csproj renamed to sample/CountryData.Sample.Console/CountryData.Sample.ConsoleProject.csproj

File renamed without changes.
Lines changed: 95 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,116 @@
1-

2-
using CountryData.Standard;
1+
using CountryData.Standard;
32

4-
/// <summary>
5-
/// Main program class for demonstrating the use of the CountryData library.
6-
/// </summary>
7-
class Program
3+
namespace CountryData.Sample.CountryConsoleProject
84
{
95
/// <summary>
10-
/// Static instance of CountryHelper used throughout the program.
6+
/// Main program class for demonstrating the use of the CountryData library.
117
/// </summary>
12-
private static readonly CountryHelper _helper = new CountryHelper();
13-
14-
/// <summary>
15-
/// Entry point of the program.
16-
/// </summary>
17-
public static void Main()
18-
{
19-
GetCountries();
20-
GetCountryByCode("US");
21-
GetCountryData();
22-
GetRegionsByCountryCode("US");
23-
GetCountryFlag("US");
24-
GetPhoneCodeByCountryShortCode("AF");
25-
GetCountryByPhoneCode("+233");
26-
27-
28-
}
29-
30-
/// <summary>
31-
/// Retrieves a list of all countries and prints them to the console.
32-
/// </summary>
33-
static void GetCountries()
8+
public static class Program
349
{
35-
var countries = _helper.GetCountries();
36-
Console.WriteLine("Countries:");
37-
foreach (var country in countries)
10+
/// <summary>
11+
/// Static instance of CountryHelper used throughout the program.
12+
/// </summary>
13+
private static readonly CountryHelper _helper = new CountryHelper();
14+
15+
/// <summary>
16+
/// Entry point of the program.
17+
/// </summary>
18+
public static void Main()
3819
{
39-
Console.WriteLine(country);
20+
GetCountries();
21+
GetCountryByCode("US");
22+
GetCountryData();
23+
GetRegionsByCountryCode("US");
24+
GetCountryFlag("US");
25+
GetPhoneCodeByCountryShortCode("AF");
26+
GetCountryByPhoneCode("+233");
4027
}
41-
}
42-
43-
/// <summary>
44-
/// Retrieves the data for a given country code and prints it to the console.
45-
/// </summary>
46-
/// <param name="countryCode">The ISO country code.</param>
47-
static void GetCountryByCode(string countryCode)
48-
{
49-
var country = _helper.GetCountryByCode(countryCode);
50-
Console.WriteLine($"Country data for {countryCode}:");
51-
Console.WriteLine(country.CountryName);
52-
}
5328

54-
/// <summary>
55-
/// Retrieves comprehensive data for all countries and prints it to the console.
56-
/// </summary>
57-
static void GetCountryData()
58-
{
59-
var countryData = _helper.GetCountryData();
60-
Console.WriteLine("Country data:");
61-
foreach (var data in countryData)
29+
/// <summary>
30+
/// Retrieves a list of all countries and prints them to the console.
31+
/// </summary>
32+
static void GetCountries()
6233
{
63-
Console.WriteLine(data.CountryName);
34+
var countries = _helper.GetCountries();
35+
Console.WriteLine("Countries:");
36+
foreach (var country in countries)
37+
{
38+
Console.WriteLine(country);
39+
}
6440
}
65-
}
6641

67-
/// <summary>
68-
/// Retrieves the regions for a given country code and prints them to the console.
69-
/// </summary>
70-
/// <param name="countryCode">The ISO country code.</param>
71-
static void GetRegionsByCountryCode(string countryCode)
72-
{
73-
var regions = _helper.GetRegionByCountryCode(countryCode);
74-
Console.WriteLine($"Regions for {countryCode}:");
75-
foreach (var region in regions)
42+
/// <summary>
43+
/// Retrieves the data for a given country code and prints it to the console.
44+
/// </summary>
45+
/// <param name="countryCode">The ISO country code.</param>
46+
static void GetCountryByCode(string countryCode)
7647
{
77-
Console.WriteLine(region.Name);
48+
var country = _helper.GetCountryByCode(countryCode);
49+
Console.WriteLine($"Country data for {countryCode}:");
50+
Console.WriteLine(country.CountryName);
7851
}
79-
}
8052

81-
/// <summary>
82-
/// Retrieves the emoji flag for a given country short code and prints it to the console.
83-
/// </summary>
84-
/// <param name="shortCode">The country short code.</param>
85-
static void GetCountryFlag(string shortCode)
86-
{
87-
var flag = _helper.GetCountryEmojiFlag(shortCode);
88-
Console.WriteLine($"Flag for {shortCode}:");
89-
Console.WriteLine(flag);
90-
}
53+
/// <summary>
54+
/// Retrieves comprehensive data for all countries and prints it to the console.
55+
/// </summary>
56+
static void GetCountryData()
57+
{
58+
var countryData = _helper.GetCountryData();
59+
Console.WriteLine("Country data:");
60+
foreach (var data in countryData)
61+
{
62+
Console.WriteLine(data.CountryName);
63+
}
64+
}
9165

66+
/// <summary>
67+
/// Retrieves the regions for a given country code and prints them to the console.
68+
/// </summary>
69+
/// <param name="countryCode">The ISO country code.</param>
70+
static void GetRegionsByCountryCode(string countryCode)
71+
{
72+
var regions = _helper.GetRegionByCountryCode(countryCode);
73+
Console.WriteLine($"Regions for {countryCode}:");
74+
foreach (var region in regions)
75+
{
76+
Console.WriteLine(region.Name);
77+
}
78+
}
9279

80+
/// <summary>
81+
/// Retrieves the emoji flag for a given country short code and prints it to the console.
82+
/// </summary>
83+
/// <param name="shortCode">The country short code.</param>
84+
static void GetCountryFlag(string shortCode)
85+
{
86+
var flag = _helper.GetCountryEmojiFlag(shortCode);
87+
Console.WriteLine($"Flag for {shortCode}:");
88+
Console.WriteLine(flag);
89+
}
9390

94-
/// <summary>
95-
/// Retrieves the phone code for a given country short code and prints it to the console.
96-
/// </summary>
97-
/// <param name="shortCode">The country short code.</param>
98-
static void GetPhoneCodeByCountryShortCode(string shortCode)
99-
{
100-
var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
101-
Console.WriteLine($"Phone code for {shortCode}:");
102-
Console.WriteLine(phoneCode);
103-
}
91+
/// <summary>
92+
/// Retrieves the phone code for a given country short code and prints it to the console.
93+
/// </summary>
94+
/// <param name="shortCode">The country short code.</param>
95+
static void GetPhoneCodeByCountryShortCode(string shortCode)
96+
{
97+
var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
98+
Console.WriteLine($"Phone code for {shortCode}:");
99+
Console.WriteLine(phoneCode);
100+
}
104101

105-
/// <summary>
106-
/// Retrieves the country name for a given phone code and prints it to the console.
107-
/// </summary>
108-
/// <param name="phoneCode">The phone code.</param>
109-
static void GetCountryByPhoneCode(string phoneCode)
110-
{
111-
var countries = _helper.GetCountriesByPhoneCode(phoneCode);
112-
Console.WriteLine($"Countries for phone code {phoneCode}:");
113-
foreach (var country in countries)
102+
/// <summary>
103+
/// Retrieves the country name for a given phone code and prints it to the console.
104+
/// </summary>
105+
/// <param name="phoneCode">The phone code.</param>
106+
static void GetCountryByPhoneCode(string phoneCode)
114107
{
115-
Console.WriteLine(country.CountryName);
108+
var countries = _helper.GetCountriesByPhoneCode(phoneCode);
109+
Console.WriteLine($"Countries for phone code {phoneCode}:");
110+
foreach (var country in countries)
111+
{
112+
Console.WriteLine(country.CountryName);
113+
}
116114
}
117115
}
118-
119-
120-
121-
}
116+
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
var builder = WebApplication.CreateBuilder(args);
22

3+
static void NewMethod(WebApplication app)
4+
{
5+
app.Run();
6+
}
7+
38
// Add services to the container.
49

510
builder.Services.AddControllers();
@@ -26,4 +31,4 @@
2631

2732
app.MapControllers();
2833

29-
app.Run();
34+
NewMethod(app);

0 commit comments

Comments
 (0)