Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e57de56
add estonia
selfmadecode May 24, 2025
0439d65
resolve merge conflicts
selfmadecode May 24, 2025
84bc92c
initialize estonia
selfmadecode May 24, 2025
983c251
add Ethiopia details
selfmadecode May 24, 2025
42615bc
rename estonia test class
selfmadecode May 24, 2025
3ea2802
add ethiopia test class
selfmadecode May 24, 2025
511d7d2
add FalklandIslands details
selfmadecode May 24, 2025
ffe2b65
add FalklandIslands tests
selfmadecode May 24, 2025
1c7d0b9
add Eswatini
selfmadecode May 24, 2025
0b6237e
add Eswatini test class
selfmadecode May 24, 2025
48b0366
add el salvador
selfmadecode May 24, 2025
a6b7d9f
add equatorial
selfmadecode May 24, 2025
ee912f3
add eritrea
selfmadecode May 24, 2025
1882ff5
resolve merge conflict
selfmadecode May 24, 2025
fd2f505
update initializer
selfmadecode May 24, 2025
b04bd06
remove duplicate keys
selfmadecode May 24, 2025
6608815
Merge branch 'main' into feat/add-countries
selfmadecode Sep 10, 2025
3d9de0c
add Kazakhstan details
selfmadecode Sep 10, 2025
fb386cf
add unit tests for Kazakhstan
selfmadecode Sep 10, 2025
47bb5a3
update initializer
selfmadecode Sep 10, 2025
9acdd5a
Merge branch 'main' into feat/add-countries
selfmadecode Sep 11, 2025
ac0b1d4
update copilot prompt file
selfmadecode Sep 11, 2025
4e10df5
add kenya details
selfmadecode Sep 11, 2025
9807581
initialize kenya
selfmadecode Sep 11, 2025
3b8b3de
add kiribati details
selfmadecode Sep 11, 2025
979b905
initialize kiribati
selfmadecode Sep 11, 2025
fd6963b
add kosovo details
selfmadecode Sep 11, 2025
4b3e1e3
add unit test for kosovo
selfmadecode Sep 11, 2025
c64f018
add kuwait
selfmadecode Sep 11, 2025
19cf6c4
add Kyrgyzstan
selfmadecode Sep 11, 2025
290a1da
initialize states
selfmadecode Sep 11, 2025
c04ceba
resolve merge conflict
selfmadecode Sep 11, 2025
41a3bdc
update tests
selfmadecode Sep 11, 2025
e064106
update kuwait
selfmadecode Sep 11, 2025
b184d48
remove unused
selfmadecode Oct 4, 2025
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
54 changes: 54 additions & 0 deletions src/World.Net.UnitTests/Countries/KosovoTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using World.Net;
using World.Net.Countries;
using World.Net.Helpers;
using Xunit;

namespace World.Net.UnitTests.Countries
{
public class KosovoTest
{
private const CountryIdentifier ExpectedId = CountryIdentifier.Kosovo;
private const string ExpectedName = "Kosovo";
private const string ExpectedOfficialName = "Republic of Kosovo";
private const string ExpectedNativeName = "Republika e Kosov�s";
private const string ExpectedCapital = "Pristina";
private const int ExpectedNumericCode = 383;
private const string ExpectedISO2Code = "XK";
private const string ExpectedISO3Code = "XKX";
private static readonly string[] ExpectedCallingCode = ["+383"];
private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates =
[
("Ferizaj", "XK-05", "District"),
("Gjakov�", "XK-06", "District"),
("Gjilan", "XK-07", "District"),
("Mitrovic�", "XK-03", "District"),
("Pej�", "XK-02", "District"),
("Prishtin�", "XK-01", "District"),
("Prizren", "XK-04", "District")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForKosovo()
{
var country = CountryProvider.GetCountry(ExpectedId);
Assert.Equal(ExpectedId, country.Id);
Assert.Equal(ExpectedName, country.Name);
Assert.Equal(ExpectedOfficialName, country.OfficialName);
Assert.Equal(ExpectedNativeName, country.NativeName);
Assert.Equal(ExpectedCapital, country.Capital);
Assert.Equal(ExpectedNumericCode, country.NumericCode);
Assert.Equal(ExpectedISO2Code, country.ISO2Code);
Assert.Equal(ExpectedISO3Code, country.ISO3Code);
Assert.Equal(ExpectedCallingCode, country.CallingCode);

var states = country.States.ToArray();
Assert.Equal(ExpectedStates.Length, states.Length);
for (int i = 0; i < states.Length; i++)
{
Assert.Equal(ExpectedStates[i].Name, states[i].Name);
Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode);
Assert.Equal(ExpectedStates[i].Type, states[i].Type);
}
}
}
}
48 changes: 48 additions & 0 deletions src/World.Net.UnitTests/Countries/KuwaitTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace World.Net.UnitTests.Countries
{
public class KuwaitTest
{
private const CountryIdentifier ExpectedId = CountryIdentifier.Kuwait;
private const string ExpectedName = "Kuwait";
private const string ExpectedOfficialName = "State of Kuwait";
private const string ExpectedNativeName = "دولة الكويت";
private const string ExpectedCapital = "Kuwait City";
private const int ExpectedNumericCode = 414;
private const string ExpectedISO2Code = "KW";
private const string ExpectedISO3Code = "KWT";
private static readonly string[] ExpectedCallingCode = ["+965"];
private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates =
[
("Al Ahmadi", "KW-AH", "Governorate"),
("Al Farwaniyah", "KW-FA", "Governorate"),
("Al Asimah", "KW-KU", "Governorate"),
("Al Jahra", "KW-JA", "Governorate"),
("Hawalli", "KW-HA", "Governorate"),
("Mubarak Al-Kabeer", "KW-MU", "Governorate")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForKuwait()
{
var country = CountryProvider.GetCountry(ExpectedId);
Assert.Equal(ExpectedId, country.Id);
Assert.Equal(ExpectedName, country.Name);
Assert.Equal(ExpectedOfficialName, country.OfficialName);
Assert.Equal(ExpectedNativeName, country.NativeName);
Assert.Equal(ExpectedCapital, country.Capital);
Assert.Equal(ExpectedNumericCode, country.NumericCode);
Assert.Equal(ExpectedISO2Code, country.ISO2Code);
Assert.Equal(ExpectedISO3Code, country.ISO3Code);
Assert.Equal(ExpectedCallingCode, country.CallingCode);

var states = country.States.ToArray();
Assert.Equal(ExpectedStates.Length, states.Length);
for (int i = 0; i < states.Length; i++)
{
Assert.Equal(ExpectedStates[i].Name, states[i].Name);
Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode);
Assert.Equal(ExpectedStates[i].Type, states[i].Type);
}
}
}
}
56 changes: 56 additions & 0 deletions src/World.Net.UnitTests/Countries/KyrgyzstanTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using World.Net;
using World.Net.Countries;
using World.Net.Helpers;
using Xunit;

namespace World.Net.UnitTests.Countries
{
public class KyrgyzstanTest
{
private const CountryIdentifier ExpectedId = CountryIdentifier.Kyrgyzstan;
private const string ExpectedName = "Kyrgyzstan";
private const string ExpectedOfficialName = "Kyrgyz Republic";
private const string ExpectedNativeName = "Киргизская Республика";
private const string ExpectedCapital = "Bishkek";
private const int ExpectedNumericCode = 417;
private const string ExpectedISO2Code = "KG";
private const string ExpectedISO3Code = "KGZ";
private static readonly string[] ExpectedCallingCode = ["+996"];
private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates =
[
("Batken", "KG-B", "Region"),
("Chuy", "KG-C", "Region"),
("Jalal-Abad", "KG-J", "Region"),
("Naryn", "KG-N", "Region"),
("Osh", "KG-O", "Region"),
("Talas", "KG-T", "Region"),
("Issyk-Kul", "KG-Y", "Region"),
("Bishkek", "KG-GB", "City"),
("Osh City", "KG-GO", "City")
];

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForKyrgyzstan()
{
var country = CountryProvider.GetCountry(ExpectedId);
Assert.Equal(ExpectedId, country.Id);
Assert.Equal(ExpectedName, country.Name);
Assert.Equal(ExpectedOfficialName, country.OfficialName);
Assert.Equal(ExpectedNativeName, country.NativeName);
Assert.Equal(ExpectedCapital, country.Capital);
Assert.Equal(ExpectedNumericCode, country.NumericCode);
Assert.Equal(ExpectedISO2Code, country.ISO2Code);
Assert.Equal(ExpectedISO3Code, country.ISO3Code);
Assert.Equal(ExpectedCallingCode, country.CallingCode);

var states = country.States.ToArray();
Assert.Equal(ExpectedStates.Length, states.Length);
for (int i = 0; i < states.Length; i++)
{
Assert.Equal(ExpectedStates[i].Name, states[i].Name);
Assert.Equal(ExpectedStates[i].IsoCode, states[i].IsoCode);
Assert.Equal(ExpectedStates[i].Type, states[i].Type);
}
}
}
}
44 changes: 44 additions & 0 deletions src/World.Net/Countries/Kosovo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace World.Net.Countries
{
internal sealed class Kosovo : ICountry
{
///<inheritdoc/>
public CountryIdentifier Id => CountryIdentifier.Kosovo;

///<inheritdoc/>
public string Name => "Kosovo";

///<inheritdoc/>
public string OfficialName { get; } = "Republic of Kosovo";

///<inheritdoc/>
public string NativeName { get; } = "Republika e Kosov�s";

///<inheritdoc/>
public string Capital { get; } = "Pristina";

///<inheritdoc/>
public int NumericCode { get; } = 383;

///<inheritdoc/>
public string ISO2Code { get; } = "XK";

///<inheritdoc/>
public string ISO3Code { get; } = "XKX";

///<inheritdoc/>
public string[] CallingCode { get; } = ["+383"];

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new State("Ferizaj", "XK-05", "District"),
new State("Gjakov�", "XK-06", "District"),
new State("Gjilan", "XK-07", "District"),
new State("Mitrovic�", "XK-03", "District"),
new State("Pej�", "XK-02", "District"),
new State("Prishtin�", "XK-01", "District"),
new State("Prizren", "XK-04", "District")
];
}
}
23 changes: 23 additions & 0 deletions src/World.Net/Countries/Kuwait.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace World.Net.Countries;

internal sealed class Kuwait : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Kuwait;
public string Name { get; } = "Kuwait";
public string OfficialName { get; } = "State of Kuwait";
public string NativeName { get; } = "دولة الكويت";
public string Capital { get; } = "Kuwait City";
public int NumericCode { get; } = 414;
public string ISO2Code { get; } = "KW";
public string ISO3Code { get; } = "KWT";
public string[] CallingCode { get; } = ["+965"];
public IEnumerable<State> States { get; } =
[
new State("Al Ahmadi", "KW-AH", "Governorate"),
new State("Al Farwaniyah", "KW-FA", "Governorate"),
new State("Al Asimah", "KW-KU", "Governorate"),
new State("Al Jahra", "KW-JA", "Governorate"),
new State("Hawalli", "KW-HA", "Governorate"),
new State("Mubarak Al-Kabeer", "KW-MU", "Governorate")
];
}
26 changes: 26 additions & 0 deletions src/World.Net/Countries/Kyrgyzstan.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace World.Net.Countries;

internal sealed class Kyrgyzstan : ICountry
{
public CountryIdentifier Id => CountryIdentifier.Kyrgyzstan;
public string Name { get; } = "Kyrgyzstan";
public string OfficialName { get; } = "Kyrgyz Republic";
public string NativeName { get; } = "Киргизская Республика";
public string Capital { get; } = "Bishkek";
public int NumericCode { get; } = 417;
public string ISO2Code { get; } = "KG";
public string ISO3Code { get; } = "KGZ";
public string[] CallingCode { get; } = ["+996"];
public IEnumerable<State> States { get; } =
[
new State("Batken", "KG-B", "Region"),
new State("Chuy", "KG-C", "Region"),
new State("Jalal-Abad", "KG-J", "Region"),
new State("Naryn", "KG-N", "Region"),
new State("Osh", "KG-O", "Region"),
new State("Talas", "KG-T", "Region"),
new State("Issyk-Kul", "KG-Y", "Region"),
new State("Bishkek", "KG-GB", "City"),
new State("Osh City", "KG-GO", "City")
];
}
18 changes: 9 additions & 9 deletions src/World.Net/Helpers/CountryIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,14 @@ public enum CountryIdentifier
/// </remarks>
Kiribati,

/// <summary>
/// The unique identifier for Kosovo.
/// </summary>
/// <remarks>
/// Use this identifier to reference Kosovo in operations that require a country ID.
/// </remarks>
Kosovo,

/// <summary>
/// The unique identifier for North Korea.
/// </summary>
Expand Down Expand Up @@ -1981,15 +1989,7 @@ public enum CountryIdentifier
/// <remarks>
/// Use this identifier to reference Zimbabwe in operations that require a country ID.
/// </remarks>
Zimbabwe,

/// <summary>
/// The unique identifier for Kosovo.
/// </summary>
/// <remarks>
/// Use this identifier to reference Kosovo in operations that require a country ID.
/// </remarks>
Kosovo,
Zimbabwe,

/// <summary>
/// The unique identifier for Curaçao.
Expand Down
3 changes: 3 additions & 0 deletions src/World.Net/Helpers/CountryInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ public static Dictionary<CountryIdentifier, ICountry> Initialize()
{ CountryIdentifier.Kazakhstan, new Kazakhstan() },
{ CountryIdentifier.Kenya, new Kenya() },
{ CountryIdentifier.Kiribati, new Kiribati() },
{ CountryIdentifier.Kosovo, new Kosovo() },
{ CountryIdentifier.Kuwait, new Kuwait() },
{ CountryIdentifier.Kyrgyzstan, new Kyrgyzstan() },

// Future countries can be added here in the same format.
};
Expand Down