Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e1d3266
AlandIsland country details
deanology Jan 21, 2025
d81a641
Merge branch 'main' into Aland-Islands
deanology Jan 21, 2025
6be6af2
added unit test to validate AlandIslands details
deanology Jan 21, 2025
aa5c162
Resolved merge conflict
deanology Jan 22, 2025
dd5af72
Added details for Algeria and Test
deanology Jan 25, 2025
7054593
Merge remote-tracking branch 'origin/main'
deanology Jan 25, 2025
af9a8c6
Merge branch 'main' into More-Countries
deanology Jan 25, 2025
d308b1a
Algeria and American Samao country details
deanology Jan 25, 2025
764008b
Merge remote-tracking branch 'origin/main'
deanology Jan 25, 2025
edcd45b
Merge branch 'main' into More-Countries
deanology Jan 25, 2025
1962f2a
resolved merge conflict
deanology Jan 25, 2025
c30bb48
Modified Algeria Unit test to the new approach
deanology Jan 25, 2025
36f06a7
Andorra country details
deanology Jan 25, 2025
60bea80
PR Comments addressed
deanology Jan 27, 2025
c6f7b46
Merge remote-tracking branch 'origin/main'
deanology Jan 27, 2025
9fb5686
Merge branch 'main' into More-Countries
deanology Jan 27, 2025
95ced88
resolved merge conflict
deanology Jan 27, 2025
4b99965
Removed unnecessary test case
deanology Jan 28, 2025
8212fe5
Merge remote-tracking branch 'origin/main'
deanology Jan 28, 2025
bdc5e78
Merge remote-tracking branch 'origin/main'
deanology Jan 30, 2025
2beb82c
Merge remote-tracking branch 'origin/main'
deanology Jan 31, 2025
e94c980
Merge branch 'main' into More-Countries
deanology Jan 31, 2025
e32c778
added details for Bangladesh, Barbados and Belarus
deanology Jan 31, 2025
434ef6a
Merge pull request #1 from deanology/More-Countries
deanology Feb 3, 2025
7a1b541
Merge branch 'main' into main
deanology Feb 4, 2025
27c51fa
Merge branch 'main' into main
deanology Feb 4, 2025
93ae03d
updated CountryInitializer.cs
deanology Feb 4, 2025
c30fe46
Merge branch 'selfmadecode:main' into main
deanology Feb 5, 2025
1bebb8e
Merge branch 'selfmadecode:main' into main
deanology Feb 7, 2025
30edd26
Merge branch 'selfmadecode:main' into main
deanology Feb 12, 2025
66ed78f
Merge branch 'selfmadecode:main' into main
deanology Feb 17, 2025
d00bf9b
Added country information for Burundi, Cambodia, Canada, Cameroon and…
deanology Feb 17, 2025
125b901
Merge pull request #2 from deanology/BCCCC
deanology Feb 17, 2025
884128b
added line space to test files
deanology Feb 18, 2025
b2a301e
Merge branch 'main' into main
selfmadecode Feb 22, 2025
1c5abb0
fix missing comma
selfmadecode Feb 22, 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
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/BurundiTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class BurundiTest
{
private const string BURUNDI_COUNTRY_NAME = "Burundi";
private const string BURUNDI_NATIVE_NAME = "Uburundi";
private const string BURUNDI_CAPITAL = "Gitega";
private const string BURUNDI_OFFICIAL_NAME = "Republic of Burundi";
private const string BURUNDI_ISO2_CODE = "BI";
private const string BURUNDI_ISO3_CODE = "BDI";
private const int BURUNDI_NUMERIC_CODE = 108;
private const string BURUNDI_CALLING_CODE = "+257";
private const int BURUNDI_STATE_COUNT = 18;
private static readonly string[] VALID_STATE_TYPES = { "Province" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForBurundi()
{
// Arrange
int existingCountryId = CountryIdentifier.Burundi;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(BURUNDI_COUNTRY_NAME, country.Name);
Assert.Equal(BURUNDI_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(BURUNDI_NATIVE_NAME, country.NativeName);
Assert.Equal(BURUNDI_CAPITAL, country.Capital);
Assert.Equal(BURUNDI_NUMERIC_CODE, country.NumericCode);
Assert.Equal(BURUNDI_ISO2_CODE, country.ISO2Code);
Assert.Equal(BURUNDI_ISO3_CODE, country.ISO3Code);
Assert.Equal(BURUNDI_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(BURUNDI_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CambodiaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CambodiaTest
{
private const string CAMBODIA_COUNTRY_NAME = "Cambodia";
private const string CAMBODIA_NATIVE_NAME = "កម្ពុជា";
private const string CAMBODIA_CAPITAL = "Phnom Penh";
private const string CAMBODIA_OFFICIAL_NAME = "Kingdom of Cambodia";
private const string CAMBODIA_ISO2_CODE = "KH";
private const string CAMBODIA_ISO3_CODE = "KHM";
private const int CAMBODIA_NUMERIC_CODE = 116;
private const string CAMBODIA_CALLING_CODE = "+855";
private const int CAMBODIA_STATE_COUNT = 25;
private static readonly string[] VALID_STATE_TYPES = { "Province", "Municipality" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCambodia()
{
// Arrange
int existingCountryId = CountryIdentifier.Cambodia;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CAMBODIA_COUNTRY_NAME, country.Name);
Assert.Equal(CAMBODIA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CAMBODIA_NATIVE_NAME, country.NativeName);
Assert.Equal(CAMBODIA_CAPITAL, country.Capital);
Assert.Equal(CAMBODIA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CAMBODIA_ISO2_CODE, country.ISO2Code);
Assert.Equal(CAMBODIA_ISO3_CODE, country.ISO3Code);
Assert.Equal(CAMBODIA_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CAMBODIA_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CameroonTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CameroonTest
{
private const string CAMEROON_COUNTRY_NAME = "Cameroon";
private const string CAMEROON_NATIVE_NAME = "République du Cameroun";
private const string CAMEROON_CAPITAL = "Yaoundé";
private const string CAMEROON_OFFICIAL_NAME = "Republic of Cameroon";
private const string CAMEROON_ISO2_CODE = "CM";
private const string CAMEROON_ISO3_CODE = "CMR";
private const int CAMEROON_NUMERIC_CODE = 120;
private const string CAMEROON_CALLING_CODE = "+237";
private const int CAMEROON_STATE_COUNT = 10;
private static readonly string[] VALID_STATE_TYPES = { "Region" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCameroon()
{
// Arrange
int existingCountryId = CountryIdentifier.Cameroon;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CAMEROON_COUNTRY_NAME, country.Name);
Assert.Equal(CAMEROON_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CAMEROON_NATIVE_NAME, country.NativeName);
Assert.Equal(CAMEROON_CAPITAL, country.Capital);
Assert.Equal(CAMEROON_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CAMEROON_ISO2_CODE, country.ISO2Code);
Assert.Equal(CAMEROON_ISO3_CODE, country.ISO3Code);
Assert.Equal(CAMEROON_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CAMEROON_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CanadaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CanadaTest
{
private const string CANADA_COUNTRY_NAME = "Canada";
private const string CANADA_NATIVE_NAME = "Canada";
private const string CANADA_CAPITAL = "Ottawa";
private const string CANADA_OFFICIAL_NAME = "Canada";
private const string CANADA_ISO2_CODE = "CA";
private const string CANADA_ISO3_CODE = "CAN";
private const int CANADA_NUMERIC_CODE = 124;
private const string CANADA_CALLING_CODE = "+1";
private const int CANADA_STATE_COUNT = 13;
private static readonly string[] VALID_STATE_TYPES = { "Province", "Territory" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCanada()
{
// Arrange
int existingCountryId = CountryIdentifier.Canada;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CANADA_COUNTRY_NAME, country.Name);
Assert.Equal(CANADA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CANADA_NATIVE_NAME, country.NativeName);
Assert.Equal(CANADA_CAPITAL, country.Capital);
Assert.Equal(CANADA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CANADA_ISO2_CODE, country.ISO2Code);
Assert.Equal(CANADA_ISO3_CODE, country.ISO3Code);
Assert.Equal(CANADA_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CANADA_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
40 changes: 40 additions & 0 deletions src/World.Net.UnitTests/Countries/CapeVerdeTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace World.Net.UnitTests.Countries;

public sealed class CapeVerdeTest
{
private const string CAPEVERDE_COUNTRY_NAME = "Cape Verde";
private const string CAPEVERDE_NATIVE_NAME = "Cabo Verde";
private const string CAPEVERDE_CAPITAL = "Praia";
private const string CAPEVERDE_OFFICIAL_NAME = "Republic of Cabo Verde";
private const string CAPEVERDE_ISO2_CODE = "CV";
private const string CAPEVERDE_ISO3_CODE = "CPV";
private const int CAPEVERDE_NUMERIC_CODE = 132;
private const string CAPEVERDE_CALLING_CODE = "+238";
private const int CAPEVERDE_STATE_COUNT = 22;
private static readonly string[] VALID_STATE_TYPES = { "Municipality" };

[Fact]
public void GetCountry_ReturnsCorrectInformation_ForCapeVerde()
{
// Arrange
int existingCountryId = CountryIdentifier.CapeVerde;

// Act
var country = CountryProvider.GetCountry(existingCountryId);

// Assert
Assert.NotNull(country);
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(CAPEVERDE_COUNTRY_NAME, country.Name);
Assert.Equal(CAPEVERDE_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(CAPEVERDE_NATIVE_NAME, country.NativeName);
Assert.Equal(CAPEVERDE_CAPITAL, country.Capital);
Assert.Equal(CAPEVERDE_NUMERIC_CODE, country.NumericCode);
Assert.Equal(CAPEVERDE_ISO2_CODE, country.ISO2Code);
Assert.Equal(CAPEVERDE_ISO3_CODE, country.ISO3Code);
Assert.Equal(CAPEVERDE_CALLING_CODE, country.CallingCode);
Assert.NotNull(country.States);
Assert.Equal(CAPEVERDE_STATE_COUNT, country.States.Count());
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
}
}
54 changes: 54 additions & 0 deletions src/World.Net/Countries/Burundi.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace World.Net.Countries;

internal sealed class Burundi : ICountry
{
//<inheritdoc/>
public int Id => CountryIdentifier.Burundi;

//<inheritdoc/>
public string Name { get; } = "Burundi";

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

//<inheritdoc/>
public string NativeName => "Uburundi";

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

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

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

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

//<inheritdoc/>
public string CallingCode { get; } = "+257";

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Bubanza", "BB"),
new("Bujumbura Mairie", "BM"),
new("Bujumbura Rural", "BR"),
new("Bururi", "BU"),
new("Cankuzo", "CA"),
new("Cibitoke", "CI"),
new("Gitega", "GI"),
new("Karuzi", "KR"),
new("Kayanza", "KY"),
new("Kirundo", "KI"),
new("Makamba", "MA"),
new("Muramvya", "MU"),
new("Muyinga", "MY"),
new("Mwaro", "MW"),
new("Ngozi", "NG"),
new("Rumonge", "RM"),
new("Rutana", "RT"),
new("Ruyigi", "RY")
];
}
61 changes: 61 additions & 0 deletions src/World.Net/Countries/Cambodia.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
namespace World.Net.Countries;

internal sealed class Cambodia : ICountry
{
//<inheritdoc/>
public int Id => CountryIdentifier.Cambodia;

//<inheritdoc/>
public string Name { get; } = "Cambodia";

//<inheritdoc/>
public string OfficialName { get; } = "Kingdom of Cambodia";

//<inheritdoc/>
public string NativeName => "កម\u17d2ព\u17bbជ\u17b6";

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

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

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

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

//<inheritdoc/>
public string CallingCode { get; } = "+855";

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Banteay Meanchey", "1"),
new("Battambang", "2"),
new("Kampong Cham", "3"),
new("Kampong Chhnang", "4"),
new("Kampong Speu", "5"),
new("Kampong Thom", "6"),
new("Kampot", "7"),
new("Kandal", "8"),
new("Koh Kong", "9"),
new("Kratié", "10"),
new("Mondulkiri", "11"),
new("Phnom Penh", "12", "Municipality"),
new("Preah Vihear", "13"),
new("Prey Veng", "14"),
new("Pursat", "15"),
new("Ratanakiri", "16"),
new("Siem Reap", "17"),
new("Preah Sihanouk", "18"),
new("Stung Treng", "19"),
new("Svay Rieng", "20"),
new("Takéo", "21"),
new("Oddar Meanchey", "22"),
new("Kep", "23"),
new("Pailin", "24"),
new("Tbong Khmum", "25")
];
}
46 changes: 46 additions & 0 deletions src/World.Net/Countries/Cameroon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
namespace World.Net.Countries;

internal sealed class Cameroon : ICountry
{
//<inheritdoc/>
public int Id => CountryIdentifier.Cameroon;

//<inheritdoc/>
public string Name { get; } = "Cameroon";

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

//<inheritdoc/>
public string NativeName => "République du Cameroun";

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

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

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

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

//<inheritdoc/>
public string CallingCode { get; } = "+237";

//<inheritdoc/>
public IEnumerable<State> States =>
[
new("Adamawa", "AD", "Region"),
new("Centre", "CE", "Region"),
new("East", "ES", "Region"),
new("Far North", "FN", "Region"),
new("Littoral", "LT", "Region"),
new("North", "NO", "Region"),
new("North West", "NW", "Region"),
new("West", "OU", "Region"),
new("South", "SU", "Region"),
new("South West", "SW", "Region")
];
}
Loading