Skip to content

Commit

Permalink
Merge pull request #34 from frankodoom/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
Clifftech123 authored May 31, 2024
2 parents 212eb3e + 0f340b9 commit d345a08
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 102 deletions.
2 changes: 1 addition & 1 deletion CountryData.Standard.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Standard", "src
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sample", "sample", "{BBA69DE8-BE26-498E-9A62-131EB2494972}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.Console", "sample\CountryData.Sample.Console\CountryData.Sample.Console.csproj", "{397666FE-700B-446E-B4EC-13ACF0DDDEBE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CountryData.Sample.ConsoleProject", "sample\CountryData.Sample.Console\CountryData.Sample.ConsoleProject.csproj", "{397666FE-700B-446E-B4EC-13ACF0DDDEBE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{131F8946-7828-4AB1-A0B7-279CD142F7E1}"
ProjectSection(SolutionItems) = preProject
Expand Down
195 changes: 95 additions & 100 deletions sample/CountryData.Sample.Console/Program.cs
Original file line number Diff line number Diff line change
@@ -1,121 +1,116 @@

using CountryData.Standard;
using CountryData.Standard;

/// <summary>
/// Main program class for demonstrating the use of the CountryData library.
/// </summary>
class Program
namespace CountryData.Sample.CountryConsoleProject
{
/// <summary>
/// Static instance of CountryHelper used throughout the program.
/// Main program class for demonstrating the use of the CountryData library.
/// </summary>
private static readonly CountryHelper _helper = new CountryHelper();

/// <summary>
/// Entry point of the program.
/// </summary>
public static void Main()
{
GetCountries();
GetCountryByCode("US");
GetCountryData();
GetRegionsByCountryCode("US");
GetCountryFlag("US");
GetPhoneCodeByCountryShortCode("AF");
GetCountryByPhoneCode("+233");


}

/// <summary>
/// Retrieves a list of all countries and prints them to the console.
/// </summary>
static void GetCountries()
public static class Program
{
var countries = _helper.GetCountries();
Console.WriteLine("Countries:");
foreach (var country in countries)
/// <summary>
/// Static instance of CountryHelper used throughout the program.
/// </summary>
private static readonly CountryHelper _helper = new CountryHelper();

/// <summary>
/// Entry point of the program.
/// </summary>
public static void Main()
{
Console.WriteLine(country);
GetCountries();
GetCountryByCode("US");
GetCountryData();
GetRegionsByCountryCode("US");
GetCountryFlag("US");
GetPhoneCodeByCountryShortCode("AF");
GetCountryByPhoneCode("+233");
}
}

/// <summary>
/// Retrieves the data for a given country code and prints it to the console.
/// </summary>
/// <param name="countryCode">The ISO country code.</param>
static void GetCountryByCode(string countryCode)
{
var country = _helper.GetCountryByCode(countryCode);
Console.WriteLine($"Country data for {countryCode}:");
Console.WriteLine(country.CountryName);
}

/// <summary>
/// Retrieves comprehensive data for all countries and prints it to the console.
/// </summary>
static void GetCountryData()
{
var countryData = _helper.GetCountryData();
Console.WriteLine("Country data:");
foreach (var data in countryData)
/// <summary>
/// Retrieves a list of all countries and prints them to the console.
/// </summary>
static void GetCountries()
{
Console.WriteLine(data.CountryName);
var countries = _helper.GetCountries();
Console.WriteLine("Countries:");
foreach (var country in countries)
{
Console.WriteLine(country);
}
}
}

/// <summary>
/// Retrieves the regions for a given country code and prints them to the console.
/// </summary>
/// <param name="countryCode">The ISO country code.</param>
static void GetRegionsByCountryCode(string countryCode)
{
var regions = _helper.GetRegionByCountryCode(countryCode);
Console.WriteLine($"Regions for {countryCode}:");
foreach (var region in regions)
/// <summary>
/// Retrieves the data for a given country code and prints it to the console.
/// </summary>
/// <param name="countryCode">The ISO country code.</param>
static void GetCountryByCode(string countryCode)
{
Console.WriteLine(region.Name);
var country = _helper.GetCountryByCode(countryCode);
Console.WriteLine($"Country data for {countryCode}:");
Console.WriteLine(country.CountryName);
}
}

/// <summary>
/// Retrieves the emoji flag for a given country short code and prints it to the console.
/// </summary>
/// <param name="shortCode">The country short code.</param>
static void GetCountryFlag(string shortCode)
{
var flag = _helper.GetCountryEmojiFlag(shortCode);
Console.WriteLine($"Flag for {shortCode}:");
Console.WriteLine(flag);
}
/// <summary>
/// Retrieves comprehensive data for all countries and prints it to the console.
/// </summary>
static void GetCountryData()
{
var countryData = _helper.GetCountryData();
Console.WriteLine("Country data:");
foreach (var data in countryData)
{
Console.WriteLine(data.CountryName);
}
}

/// <summary>
/// Retrieves the regions for a given country code and prints them to the console.
/// </summary>
/// <param name="countryCode">The ISO country code.</param>
static void GetRegionsByCountryCode(string countryCode)
{
var regions = _helper.GetRegionByCountryCode(countryCode);
Console.WriteLine($"Regions for {countryCode}:");
foreach (var region in regions)
{
Console.WriteLine(region.Name);
}
}

/// <summary>
/// Retrieves the emoji flag for a given country short code and prints it to the console.
/// </summary>
/// <param name="shortCode">The country short code.</param>
static void GetCountryFlag(string shortCode)
{
var flag = _helper.GetCountryEmojiFlag(shortCode);
Console.WriteLine($"Flag for {shortCode}:");
Console.WriteLine(flag);
}

/// <summary>
/// Retrieves the phone code for a given country short code and prints it to the console.
/// </summary>
/// <param name="shortCode">The country short code.</param>
static void GetPhoneCodeByCountryShortCode(string shortCode)
{
var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
Console.WriteLine($"Phone code for {shortCode}:");
Console.WriteLine(phoneCode);
}
/// <summary>
/// Retrieves the phone code for a given country short code and prints it to the console.
/// </summary>
/// <param name="shortCode">The country short code.</param>
static void GetPhoneCodeByCountryShortCode(string shortCode)
{
var phoneCode = _helper.GetPhoneCodeByCountryShortCode(shortCode);
Console.WriteLine($"Phone code for {shortCode}:");
Console.WriteLine(phoneCode);
}

/// <summary>
/// Retrieves the country name for a given phone code and prints it to the console.
/// </summary>
/// <param name="phoneCode">The phone code.</param>
static void GetCountryByPhoneCode(string phoneCode)
{
var countries = _helper.GetCountriesByPhoneCode(phoneCode);
Console.WriteLine($"Countries for phone code {phoneCode}:");
foreach (var country in countries)
/// <summary>
/// Retrieves the country name for a given phone code and prints it to the console.
/// </summary>
/// <param name="phoneCode">The phone code.</param>
static void GetCountryByPhoneCode(string phoneCode)
{
Console.WriteLine(country.CountryName);
var countries = _helper.GetCountriesByPhoneCode(phoneCode);
Console.WriteLine($"Countries for phone code {phoneCode}:");
foreach (var country in countries)
{
Console.WriteLine(country.CountryName);
}
}
}



}
}
7 changes: 6 additions & 1 deletion sample/CountryData.Sample.Web.API/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
var builder = WebApplication.CreateBuilder(args);

static void NewMethod(WebApplication app)
{
app.Run();
}

// Add services to the container.

builder.Services.AddControllers();
Expand All @@ -26,4 +31,4 @@

app.MapControllers();

app.Run();
NewMethod(app);

0 comments on commit d345a08

Please sign in to comment.