Skip to content

Commit 82afb66

Browse files
Reagan ReubenReagan Reuben
authored andcommitted
fixed conflicts
2 parents 80966a8 + b5fa87a commit 82afb66

File tree

8 files changed

+258
-2
lines changed

8 files changed

+258
-2
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class AngolaTest
4+
{
5+
private const string ANGOLA_COUNTRY_NAME = "Angola";
6+
private const string ANGOLA_NATIVE_NAME = "Angola";
7+
private const string ANGOLA_CAPITAL = "Luanda";
8+
private const string ANGOLA_OFFICIAL_NAME = "Republic of Angola";
9+
private const string ANGOLA_ISO2_CODE = "AO";
10+
private const string ANGOLA_ISO3_CODE = "AGO";
11+
private const int ANGOLA_NUMERIC_CODE = 024;
12+
private const string ANGOLA_CALLING_CODE = "+244";
13+
private const string ANGOLA_STATE_TYPE = "Province";
14+
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForAngola()
18+
{
19+
// Arrange
20+
int existingCountryId = CountryIdentifier.Angola;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(ANGOLA_COUNTRY_NAME, country.Name);
29+
Assert.Equal(ANGOLA_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(ANGOLA_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(ANGOLA_CAPITAL, country.Capital);
32+
Assert.Equal(ANGOLA_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(ANGOLA_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(ANGOLA_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(ANGOLA_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(17, country.States.Count());
38+
Assert.All(country.States, state => Assert.Equal(ANGOLA_STATE_TYPE, state.Type));
39+
}
40+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public sealed class AnguillaTest
4+
{
5+
private const string ANGUILLA_COUNTRY_NAME = "Anguilla";
6+
private const string ANGUILLA_NATIVE_NAME = "Anguilla";
7+
private const string ANGUILLA_CAPITAL = "The Valley";
8+
private const string ANGUILLA_OFFICIAL_NAME = "Anguilla";
9+
private const string ANGUILLA_ISO2_CODE = "AI";
10+
private const string ANGUILLA_ISO3_CODE = "AIA";
11+
private const int ANGUILLA_NUMERIC_CODE = 660;
12+
private const string ANGUILLA_CALLING_CODE = "+1-264";
13+
private const int ANGUILLA_DISTRICT_COUNT = 14;
14+
private const string ANGUILLA_STATE_TYPE = "District";
15+
16+
[Fact]
17+
public void GetCountry_ReturnsCorrectInformation_ForAnguilla()
18+
{
19+
// Arrange
20+
int existingCountryId = CountryIdentifier.Anguilla;
21+
22+
// Act
23+
var country = CountryProvider.GetCountry(existingCountryId);
24+
25+
//Assert
26+
Assert.NotNull(country);
27+
Assert.Equal(existingCountryId, country.Id);
28+
Assert.Equal(ANGUILLA_COUNTRY_NAME, country.Name);
29+
Assert.Equal(ANGUILLA_OFFICIAL_NAME, country.OfficialName);
30+
Assert.Equal(ANGUILLA_NATIVE_NAME, country.NativeName);
31+
Assert.Equal(ANGUILLA_CAPITAL, country.Capital);
32+
Assert.Equal(ANGUILLA_NUMERIC_CODE, country.NumericCode);
33+
Assert.Equal(ANGUILLA_ISO2_CODE, country.ISO2Code);
34+
Assert.Equal(ANGUILLA_ISO3_CODE, country.ISO3Code);
35+
Assert.Equal(ANGUILLA_CALLING_CODE, country.CallingCode);
36+
Assert.NotNull(country.States);
37+
Assert.Equal(ANGUILLA_DISTRICT_COUNT, country.States.Count());
38+
Assert.All(country.States, state => Assert.Equal(ANGUILLA_STATE_TYPE, state.Type));
39+
}
40+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
namespace World.Net.UnitTests.Countries;
2+
3+
public class AntarticaTest
4+
{
5+
private const string ANTARCTICA_COUNTRY_NAME = "Antarctica";
6+
private const string ANTARCTICA_NATIVE_NAME = "Antarctica";
7+
private const string ANTARCTICA_CAPITAL = ""; // Antarctica has no capital
8+
private const string ANTARCTICA_OFFICIAL_NAME = "Antarctica";
9+
private const string ANTARCTICA_ISO2_CODE = "AQ";
10+
private const string ANTARCTICA_ISO3_CODE = "ATA";
11+
private const int ANTARCTICA_NUMERIC_CODE = 10;
12+
private const string ANTARCTICA_CALLING_CODE = "+672";
13+
14+
[Fact]
15+
public void GetCountry_ReturnsCorrectInformation_ForAntarctica()
16+
{
17+
// Arrange
18+
int existingCountryId = CountryIdentifier.Antarctica;
19+
20+
// Act
21+
var country = CountryProvider.GetCountry(existingCountryId);
22+
23+
// Assert
24+
Assert.NotNull(country);
25+
Assert.Equal(existingCountryId, country.Id);
26+
Assert.Equal(ANTARCTICA_COUNTRY_NAME, country.Name);
27+
Assert.Equal(ANTARCTICA_OFFICIAL_NAME, country.OfficialName);
28+
Assert.Equal(ANTARCTICA_NATIVE_NAME, country.NativeName);
29+
Assert.Equal(ANTARCTICA_CAPITAL, country.Capital);
30+
Assert.Equal(ANTARCTICA_NUMERIC_CODE, country.NumericCode);
31+
Assert.Equal(ANTARCTICA_ISO2_CODE, country.ISO2Code);
32+
Assert.Equal(ANTARCTICA_ISO3_CODE, country.ISO3Code);
33+
Assert.Equal(ANTARCTICA_CALLING_CODE, country.CallingCode);
34+
Assert.NotNull(country.States);
35+
Assert.Empty(country.States);
36+
}
37+
}

src/World.Net/Countries/AlandIslands.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-

2-
namespace World.Net.Countries;
1+
namespace World.Net.Countries;
32

43
internal sealed class AlandIslands : ICountry
54
{

src/World.Net/Countries/Angola.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Angola : ICountry
4+
{
5+
///<inheritdoc/>
6+
public int Id => CountryIdentifier.Angola;
7+
8+
///<inheritdoc/>
9+
public string Name { get; } = nameof(Angola);
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = "Republic of Angola";
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = nameof(Angola);
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = "Luanda";
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 024;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "AO";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "AGO";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+244";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new("Bengo", "BGO"),
36+
new("Benguela", "BGU"),
37+
new ("Bié", "BIE"),
38+
new ("Cabinda", "CAB"),
39+
new ("Cuando Cubango", "CCU"),
40+
new ("Cuanza", "CUS"),
41+
new ("Cuanza Norte", "CNO"),
42+
new ("Cunene", "CNN"),
43+
new ("Huambo", "HUA"),
44+
new ("Huíla", "HUI"),
45+
new ("Luanda", "LUA"),
46+
new ("Lunda Norte", "LNO"),
47+
new ("Lunda Sul", "LSU"),
48+
new ("Malanje", "MAL"),
49+
new ("Moxico", "MOX"),
50+
new ("Uíge", "UIG"),
51+
new ("Zaire", "ZAI")
52+
];
53+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Anguilla : ICountry
4+
{
5+
///<inheritdoc/>
6+
public int Id { get; } = CountryIdentifier.Anguilla;
7+
8+
///<inheritdoc/>
9+
public string Name { get; } = nameof(Anguilla);
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = nameof(Anguilla);
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = nameof(Anguilla);
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = "The Valley";
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 660;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "AI";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "AIA";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+1-264";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States =>
34+
[
35+
new State("Blowing Point", string.Empty, "District"),
36+
new State("East End", string.Empty, "District"),
37+
new State("George Hill", string.Empty, "District"),
38+
new State("Island Harbour", string.Empty, "District"),
39+
new State("North Hill", string.Empty, "District"),
40+
new State("North Side", string.Empty, "District"),
41+
new State("Sandy Ground", string.Empty, "District"),
42+
new State("Sandy Hill", string.Empty, "District"),
43+
new State("South Hill", string.Empty, "District"),
44+
new State("Stoney Ground", string.Empty, "District"),
45+
new State("The Farrington", string.Empty, "District"),
46+
new State("The Quarter", string.Empty, "District"),
47+
new State("The Valley", string.Empty, "District"),
48+
new State("West End", string.Empty, "District")
49+
];
50+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
namespace World.Net.Countries;
2+
3+
internal sealed class Antarctica : ICountry
4+
{
5+
///<inheritdoc/>
6+
public int Id { get; } = CountryIdentifier.Antarctica;
7+
8+
///<inheritdoc/>
9+
public string Name { get; } = nameof(Antarctica);
10+
11+
///<inheritdoc/>
12+
public string OfficialName { get; } = nameof(Antarctica);
13+
14+
///<inheritdoc/>
15+
public string NativeName { get; } = nameof(Antarctica);
16+
17+
///<inheritdoc/>
18+
public string Capital { get; } = string.Empty;
19+
20+
///<inheritdoc/>
21+
public int NumericCode { get; } = 010;
22+
23+
///<inheritdoc/>
24+
public string ISO2Code { get; } = "AQ";
25+
26+
///<inheritdoc/>
27+
public string ISO3Code { get; } = "ATA";
28+
29+
///<inheritdoc/>
30+
public string CallingCode { get; } = "+672";
31+
32+
///<inheritdoc/>
33+
public IEnumerable<State> States { get; } = [];
34+
}

src/World.Net/Helpers/CountryInitializer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ public static Dictionary<int, ICountry> Initialize()
1515
{ CountryIdentifier.AntiguaAndBarbuda, new AntiguaAndBarbuda() },
1616
{ CountryIdentifier.Armenia, new Armenia() },
1717
{ CountryIdentifier.Argentina, new Argentina() },
18+
{ CountryIdentifier.Angola, new Angola() },
19+
{ CountryIdentifier.Anguilla, new Anguilla() },
20+
{ CountryIdentifier.Antarctica, new Antarctica() }
1821
// Future countries can be added here in the same format.
1922
};
2023
}

0 commit comments

Comments
 (0)