Skip to content

Commit

Permalink
Albania (#13)
Browse files Browse the repository at this point in the history
* Albania

* Albania - Treat comments

Co-authored-by: Reagan Reuben <Reagan.Reuben@Sterling.ng>
  • Loading branch information
ReaganDev and Reagan Reuben authored Jan 27, 2025
1 parent 344d2a9 commit 8b7ef99
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 1 deletion.
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/AlbaniaTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries;

public sealed class AlbaniaTests
{
private const string ALBANIA_NAME = "Albania";
private const int ALBANIA_STATE_COUNT = 47;
private const string ALBANIA_OFFICIAL_NAME = "Republic of Albania";
private const string ALBANIA_NATIVE_NAME = "Republika e Shqipërisë";
private const string ALBANIA_CAPITAL = "Tirana";
private const int ALBANIA_NUMERIC_CODE = 008;
private const string ALBANIA_ISO2_CODE = "AL";
private const string ALBANIA_ISO3_CODE = "ALB";
private const string ALBANIA_CALLING_CODE = "+355";


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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(ALBANIA_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(ALBANIA_STATE_COUNT, country.States.Count());
Assert.Equal(ALBANIA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(ALBANIA_NATIVE_NAME, country.NativeName);
Assert.Equal(ALBANIA_CAPITAL, country.Capital);
Assert.Equal(ALBANIA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(ALBANIA_ISO2_CODE, country.ISO2Code);
Assert.Equal(ALBANIA_ISO3_CODE, country.ISO3Code);
Assert.Equal(ALBANIA_CALLING_CODE, country.CallingCode);
}
}
83 changes: 83 additions & 0 deletions src/World.Net/Countries/Albania.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
namespace World.Net.Countries;

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

///<inheritdoc/>
public string Name => nameof(Albania);

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

///<inheritdoc/>
public string NativeName { get; } = "Republika e Shqipërisë";

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

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

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

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

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

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Berat", "AL-BR", "District"),
new("Berat", "AL-01", "County"),
new("Bulqizë", "AL-BU", "District"),
new("Delvinë", "AL-DL", "District"),
new("Devoll", "AL-DV", "District"),
new("Dibër", "AL-09", "County"),
new("Dibër", "AL-DI", "District"),
new("Durrës", "AL-DR", "District"),
new("Durrës", "AL-02", "County"),
new("Elbasan", "AL-03", "County"),
new("Fier", "AL-FR", "District"),
new("Fier", "AL-04", "County"),
new("Gjirokastër", "AL-GJ", "District"),
new("Gjirokastër", "AL-05", "County"),
new("Gramsh", "AL-GR", "District"),
new("Has", "AL-HA", "District"),
new("Kavajë", "AL-KA", "District"),
new("Kolonjë", "AL-ER", "District"),
new("Korçë", "AL-06", "County"),
new("Korçë", "AL-KO", "District"),
new("Krujë", "AL-KR", "District"),
new("Kuçovë", "AL-KC", "District"),
new("Kukës", "AL-KU", "District"),
new("Kukës", "AL-07", "County"),
new("Kurbin", "AL-KB", "District"),
new("Lezhë", "AL-08", "County"),
new("Lezhë", "AL-LE", "District"),
new("Librazhd", "AL-LB", "District"),
new("Lushnjë", "AL-LU", "District"),
new("Malësi e Madhe", "AL-MM", "District"),
new("Mallakastër", "AL-MK", "District"),
new("Mat", "AL-MT", "District"),
new("Mirditë", "AL-MR", "District"),
new("Peqin", "AL-PQ", "District"),
new("Përmet", "AL-PR", "District"),
new("Pogradec", "AL-PG", "District"),
new("Pukë", "AL-PU", "District"),
new("Sarandë", "AL-SR", "District"),
new("Shkodër", "AL-10", "County"),
new("Shkodër", "AL-SH", "District"),
new("Skrapar", "AL-SK", "District"),
new("Tepelenë", "AL-TE", "District"),
new("Tirana", "AL-TR", "District"),
new("Tirana", "AL-11", "County"),
new("Tropojë", "AL-TP", "District"),
new("Vlorë", "AL-12", "County"),
new("Vlorë", "AL-VL", "District"),
];
}
3 changes: 2 additions & 1 deletion src/World.Net/Helpers/CountryInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ public static Dictionary<int, ICountry> Initialize()
return new Dictionary<int, ICountry>
{
{ CountryIdentifier.AfghanistanId, new Afghanistan() },
{ CountryIdentifier.AlandIslands, new AlandIslands() }
{ CountryIdentifier.AlandIslands, new AlandIslands() },
{ CountryIdentifier.Albania, new Albania() }
// Future countries can be added here in the same format.
};
}
Expand Down

0 comments on commit 8b7ef99

Please sign in to comment.