Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/World.Net.UnitTests/Countries/UgandaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
namespace World.Net.UnitTests.Countries;

public sealed class UgandaTest : AssertCountryTestBase
{
private const string COUNTRY_NAME = "Uganda";
private const string NATIVE_NAME = "Uganda";
private const string CAPITAL = "Kampala";
private const string OFFICIAL_NAME = "Republic of Uganda";
private const string ISO2_CODE = "UG";
private const string ISO3_CODE = "UGA";
private const int NUMERIC_CODE = 800;
private readonly string[] CALLING_CODE = ["+256"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Uganda;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
{
("Central", "UG-C", "Region"),
("Eastern", "UG-E", "Region"),
("Northern", "UG-N", "Region"),
("Western", "UG-W", "Region")
};

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForUganda()
{
var country = CountryProvider.GetCountry(EXPECTEDID);

AssertCorrectInformation(
country,
EXPECTEDID,
COUNTRY_NAME,
OFFICIAL_NAME,
NATIVE_NAME,
CAPITAL,
NUMERIC_CODE,
ISO2_CODE,
ISO3_CODE,
CALLING_CODE,
EXPECTED_STATES
);
}
}
65 changes: 65 additions & 0 deletions src/World.Net.UnitTests/Countries/UkraineTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
namespace World.Net.UnitTests.Countries;

public sealed class UkraineTest : AssertCountryTestBase
{
private const string COUNTRY_NAME = "Ukraine";
private const string NATIVE_NAME = "Україна";
private const string CAPITAL = "Kyiv";
private const string OFFICIAL_NAME = "Ukraine";
private const string ISO2_CODE = "UA";
private const string ISO3_CODE = "UKR";
private const int NUMERIC_CODE = 804;
private readonly string[] CALLING_CODE = ["+380"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.Ukraine;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
{
("Cherkasy", "UA-CK", "Oblast"),
("Chernihiv", "UA-CH", "Oblast"),
("Chernivtsi", "UA-CV", "Oblast"),
("Dnipropetrovsk", "UA-DP", "Oblast"),
("Donetsk", "UA-DO", "Oblast"),
("Ivano-Frankivsk", "UA-IF", "Oblast"),
("Kharkiv", "UA-KH", "Oblast"),
("Kherson", "UA-KH", "Oblast"),
("Khmelnytskyi", "UA-KM", "Oblast"),
("Kirovohrad", "UA-KR", "Oblast"),
("Kyiv", "UA-KY", "City"),
("Kyiv Oblast", "UA-KY", "Oblast"),
("Luhansk", "UA-LU", "Oblast"),
("Lviv", "UA-LV", "Oblast"),
("Mykolaiv", "UA-MK", "Oblast"),
("Odessa", "UA-OD", "Oblast"),
("Poltava", "UA-PL", "Oblast"),
("Rivne", "UA-RV", "Oblast"),
("Sevastopol", "UA-SE", "City"),
("Sumy", "UA-SU", "Oblast"),
("Ternopil", "UA-TE", "Oblast"),
("Vinnytsia", "UA-VI", "Oblast"),
("Volyn", "UA-VO", "Oblast"),
("Zakarpattia", "UA-ZA", "Oblast"),
("Zaporizhzhia", "UA-ZP", "Oblast"),
("Zhytomyr", "UA-ZH", "Oblast"),
("Autonomous Republic of Crimea", "UA-CR", "Autonomous Republic")
};

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForUkraine()
{
var country = CountryProvider.GetCountry(EXPECTEDID);

AssertCorrectInformation(
country,
EXPECTEDID,
COUNTRY_NAME,
OFFICIAL_NAME,
NATIVE_NAME,
CAPITAL,
NUMERIC_CODE,
ISO2_CODE,
ISO3_CODE,
CALLING_CODE,
EXPECTED_STATES
);
}
}
53 changes: 53 additions & 0 deletions src/World.Net.UnitTests/Countries/UnitedArabEmiratesTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace World.Net.UnitTests.Countries
{
public sealed class UnitedArabEmiratesTest : AssertCountryTestBase
{
private const string COUNTRY_NAME = "United Arab Emirates";
private const string NATIVE_NAME = "الإمارات العربية المتحدة";
private const string CAPITAL = "Abu Dhabi";
private const string OFFICIAL_NAME = "United Arab Emirates";
private const string ISO2_CODE = "AE";
private const string ISO3_CODE = "ARE";
private const int NUMERIC_CODE = 784;
private readonly string[] CALLING_CODE = ["+971"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.UnitedArabEmirates;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
{
("Abu Dhabi", "AE-AZ", "Emirate"),
("Ajman", "AE-AJ", "Emirate"),
("Dubai", "AE-DU", "Emirate"),
("Fujairah", "AE-FU", "Emirate"),
("Ras Al Khaimah", "AE-RK", "Emirate"),
("Sharjah", "AE-SH", "Emirate"),
("Umm Al Quwain", "AE-UQ", "Emirate")
};

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForUAE()
{
var country = CountryProvider.GetCountry(EXPECTEDID);

AssertCorrectInformation(
country,
EXPECTEDID,
COUNTRY_NAME,
OFFICIAL_NAME,
NATIVE_NAME,
CAPITAL,
NUMERIC_CODE,
ISO2_CODE,
ISO3_CODE,
CALLING_CODE,
EXPECTED_STATES
);
}
}

}
50 changes: 50 additions & 0 deletions src/World.Net.UnitTests/Countries/UnitedKingdomTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace World.Net.UnitTests.Countries
{
public sealed class UnitedKingdomTest : AssertCountryTestBase
{
private const string COUNTRY_NAME = "United Kingdom";
private const string NATIVE_NAME = "United Kingdom";
private const string CAPITAL = "London";
private const string OFFICIAL_NAME = "United Kingdom of Great Britain and Northern Ireland";
private const string ISO2_CODE = "GB";
private const string ISO3_CODE = "GBR";
private const int NUMERIC_CODE = 826;
private readonly string[] CALLING_CODE = ["+44"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.UnitedKingdom;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
{
("England", "GB-ENG", "Country"),
("Scotland", "GB-SCT", "Country"),
("Wales", "GB-WLS", "Country"),
("Northern Ireland", "GB-NIR", "Country")
};

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForUnitedKingdom()
{
var country = CountryProvider.GetCountry(EXPECTEDID);

AssertCorrectInformation(
country,
EXPECTEDID,
COUNTRY_NAME,
OFFICIAL_NAME,
NATIVE_NAME,
CAPITAL,
NUMERIC_CODE,
ISO2_CODE,
ISO3_CODE,
CALLING_CODE,
EXPECTED_STATES
);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace World.Net.UnitTests.Countries
{
public sealed class UnitedStatesMinorOutlyingIslandsTest : AssertCountryTestBase
{
private const string COUNTRY_NAME = "United States Minor Outlying Islands";
private const string NATIVE_NAME = "United States Minor Outlying Islands";
private const string CAPITAL = null;
private const string OFFICIAL_NAME = "United States Minor Outlying Islands";
private const string ISO2_CODE = "UM";
private const string ISO3_CODE = "UMI";
private const int NUMERIC_CODE = 581;
private readonly string[] CALLING_CODE = ["+1"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.UnitedStatesMinorOutlyingIslands;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES = Array.Empty<(string, string, string)>();

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForUSMinorOutlyingIslands()
{
var country = CountryProvider.GetCountry(EXPECTEDID);

AssertCorrectInformation(
country,
EXPECTEDID,
COUNTRY_NAME,
OFFICIAL_NAME,
NATIVE_NAME,
CAPITAL,
NUMERIC_CODE,
ISO2_CODE,
ISO3_CODE,
CALLING_CODE,
EXPECTED_STATES
);
}
}

}
97 changes: 97 additions & 0 deletions src/World.Net.UnitTests/Countries/UnitedStatesTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace World.Net.UnitTests.Countries
{
public sealed class UnitedStatesTest : AssertCountryTestBase
{
private const string COUNTRY_NAME = "United States";
private const string NATIVE_NAME = "United States";
private const string CAPITAL = "Washington, D.C.";
private const string OFFICIAL_NAME = "United States of America";
private const string ISO2_CODE = "US";
private const string ISO3_CODE = "USA";
private const int NUMERIC_CODE = 840;
private readonly string[] CALLING_CODE = ["+1"];
private const CountryIdentifier EXPECTEDID = CountryIdentifier.UnitedStates;

private static readonly (string Name, string IsoCode, string Type)[] EXPECTED_STATES =
{
("Alabama", "US-AL", "State"),
("Alaska", "US-AK", "State"),
("Arizona", "US-AZ", "State"),
("Arkansas", "US-AR", "State"),
("California", "US-CA", "State"),
("Colorado", "US-CO", "State"),
("Connecticut", "US-CT", "State"),
("Delaware", "US-DE", "State"),
("Florida", "US-FL", "State"),
("Georgia", "US-GA", "State"),
("Hawaii", "US-HI", "State"),
("Idaho", "US-ID", "State"),
("Illinois", "US-IL", "State"),
("Indiana", "US-IN", "State"),
("Iowa", "US-IA", "State"),
("Kansas", "US-KS", "State"),
("Kentucky", "US-KY", "State"),
("Louisiana", "US-LA", "State"),
("Maine", "US-ME", "State"),
("Maryland", "US-MD", "State"),
("Massachusetts", "US-MA", "State"),
("Michigan", "US-MI", "State"),
("Minnesota", "US-MN", "State"),
("Mississippi", "US-MS", "State"),
("Missouri", "US-MO", "State"),
("Montana", "US-MT", "State"),
("Nebraska", "US-NE", "State"),
("Nevada", "US-NV", "State"),
("New Hampshire", "US-NH", "State"),
("New Jersey", "US-NJ", "State"),
("New Mexico", "US-NM", "State"),
("New York", "US-NY", "State"),
("North Carolina", "US-NC", "State"),
("North Dakota", "US-ND", "State"),
("Ohio", "US-OH", "State"),
("Oklahoma", "US-OK", "State"),
("Oregon", "US-OR", "State"),
("Pennsylvania", "US-PA", "State"),
("Rhode Island", "US-RI", "State"),
("South Carolina", "US-SC", "State"),
("South Dakota", "US-SD", "State"),
("Tennessee", "US-TN", "State"),
("Texas", "US-TX", "State"),
("Utah", "US-UT", "State"),
("Vermont", "US-VT", "State"),
("Virginia", "US-VA", "State"),
("Washington", "US-WA", "State"),
("West Virginia", "US-WV", "State"),
("Wisconsin", "US-WI", "State"),
("Wyoming", "US-WY", "State"),
("District of Columbia", "US-DC", "Federal District")
};

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForUnitedStates()
{
var country = CountryProvider.GetCountry(EXPECTEDID);

AssertCorrectInformation(
country,
EXPECTEDID,
COUNTRY_NAME,
OFFICIAL_NAME,
NATIVE_NAME,
CAPITAL,
NUMERIC_CODE,
ISO2_CODE,
ISO3_CODE,
CALLING_CODE,
EXPECTED_STATES
);
}
}

}
Loading