diff --git a/src/World.Net.UnitTests/Countries/KazakhstanTest.cs b/src/World.Net.UnitTests/Countries/KazakhstanTest.cs new file mode 100644 index 0000000..d498c7d --- /dev/null +++ b/src/World.Net.UnitTests/Countries/KazakhstanTest.cs @@ -0,0 +1,47 @@ +namespace World.Net.UnitTests.Countries; + +internal static class KazakhstanTestData +{ + internal const string COUNTRY_NAME = "Kazakhstan"; + internal const string NATIVE_NAME = "?????????"; + internal const string CAPITAL = "Astana"; + internal const string OFFICIAL_NAME = "Republic of Kazakhstan"; + internal const string ISO2_CODE = "KZ"; + internal const string ISO3_CODE = "KAZ"; + internal const int NUMERIC_CODE = 398; + internal static readonly string[] CALLING_CODE = ["+7"]; + internal const string REGION_TYPE = "Region"; + internal const string CITY_TYPE = "City"; + internal const int EXPECTED_REGION_COUNT = 14; + internal const int EXPECTED_CITY_COUNT = 3; +} + +public sealed class KazakhstanTest +{ + [Fact] + public void GetCountry_ReturnsCorrectInformation_ForKazakhstan() + { + // Arrange + CountryIdentifier existingCountryId = CountryIdentifier.Kazakhstan; + + // Act + var country = CountryProvider.GetCountry(existingCountryId); + + // Assert + Assert.NotNull(country); + Assert.Equal(existingCountryId, country.Id); + Assert.Equal(KazakhstanTestData.COUNTRY_NAME, country.Name); + Assert.Equal(KazakhstanTestData.OFFICIAL_NAME, country.OfficialName); + Assert.Equal(KazakhstanTestData.NATIVE_NAME, country.NativeName); + Assert.Equal(KazakhstanTestData.CAPITAL, country.Capital); + Assert.Equal(KazakhstanTestData.NUMERIC_CODE, country.NumericCode); + Assert.Equal(KazakhstanTestData.ISO2_CODE, country.ISO2Code); + Assert.Equal(KazakhstanTestData.ISO3_CODE, country.ISO3Code); + Assert.Equal(KazakhstanTestData.CALLING_CODE, country.CallingCode); + + Assert.NotNull(country.States); + Assert.Equal(KazakhstanTestData.EXPECTED_REGION_COUNT + KazakhstanTestData.EXPECTED_CITY_COUNT, country.States.Count()); + Assert.Equal(KazakhstanTestData.EXPECTED_REGION_COUNT, country.States.Count(s => s.Type == KazakhstanTestData.REGION_TYPE)); + Assert.Equal(KazakhstanTestData.EXPECTED_CITY_COUNT, country.States.Count(s => s.Type == KazakhstanTestData.CITY_TYPE)); + } +} diff --git a/src/World.Net/Countries/Kazakhstan.cs b/src/World.Net/Countries/Kazakhstan.cs new file mode 100644 index 0000000..2fca4ee --- /dev/null +++ b/src/World.Net/Countries/Kazakhstan.cs @@ -0,0 +1,53 @@ +namespace World.Net.Countries; + +internal sealed class Kazakhstan : ICountry +{ + /// + public CountryIdentifier Id => CountryIdentifier.Kazakhstan; + + /// + public string Name => "Kazakhstan"; + + /// + public string OfficialName { get; } = "Republic of Kazakhstan"; + + /// + public string NativeName { get; } = "?????????"; + + /// + public string Capital { get; } = "Astana"; + + /// + public int NumericCode { get; } = 398; + + /// + public string ISO2Code { get; } = "KZ"; + + /// + public string ISO3Code { get; } = "KAZ"; + + /// + public string[] CallingCode { get; } = ["+7"]; + + /// + public IEnumerable States { get; } = + [ + new("Akmola", "KZ-AKM", "Region"), + new("Aktobe", "KZ-AKT", "Region"), + new("Almaty", "KZ-ALM", "Region"), + new("Atyrau", "KZ-ATY", "Region"), + new("East Kazakhstan", "KZ-VOS", "Region"), + new("Jambyl", "KZ-ZHA", "Region"), + new("Karaganda", "KZ-KAR", "Region"), + new("Kostanay", "KZ-KUS", "Region"), + new("Kyzylorda", "KZ-KZY", "Region"), + new("Mangystau", "KZ-MAN", "Region"), + new("Pavlodar", "KZ-PAV", "Region"), + new("North Kazakhstan", "KZ-SEV", "Region"), + new("Turkistan", "KZ-TUR", "Region"), + new("West Kazakhstan", "KZ-ZAP", "Region"), + new("Nur-Sultan", "KZ-NUR", "City"), + new("Almaty City", "KZ-ALA", "City"), + new("Shymkent", "KZ-SHY", "City") + ]; +} diff --git a/src/World.Net/Helpers/CountryInitializer.cs b/src/World.Net/Helpers/CountryInitializer.cs index 673508c..2b22923 100644 --- a/src/World.Net/Helpers/CountryInitializer.cs +++ b/src/World.Net/Helpers/CountryInitializer.cs @@ -91,7 +91,8 @@ public static Dictionary Initialize() { CountryIdentifier.Jamaica, new Jamaica() }, { CountryIdentifier.Japan, new Japan() }, { CountryIdentifier.Jersey, new Jersey() }, - { CountryIdentifier.Jordan, new Jordan() } + { CountryIdentifier.Jordan, new Jordan() }, + { CountryIdentifier.Kazakhstan, new Kazakhstan() } // Future countries can be added here in the same format. };