-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from frankodoom/test
Test
- Loading branch information
Showing
4 changed files
with
102 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters