Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Aland islands country details #2

Merged
merged 5 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
166 changes: 149 additions & 17 deletions .vs/world.net/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,42 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\anyan\\source\\repos\\world.net\\",
deanology marked this conversation as resolved.
Show resolved Hide resolved
"WorkspaceRootPath": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|c:\\users\\anyan\\source\\repos\\world.net\\src\\world.net\\class1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|solutionrelative:src\\world.net\\class1.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
"AbsoluteMoniker": "D:0:0:{FD584E36-2331-4DD7-9FAD-0567C5DDD25D}|src\\World.Net.UnitTests\\World.Net.UnitTests.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net.unittests\\countries\\alandislandstest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{FD584E36-2331-4DD7-9FAD-0567C5DDD25D}|src\\World.Net.UnitTests\\World.Net.UnitTests.csproj|solutionrelative:src\\world.net.unittests\\countries\\alandislandstest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
deanology marked this conversation as resolved.
Show resolved Hide resolved
},
{
"AbsoluteMoniker": "D:0:0:{58CE3FC4-6578-4019-8EFB-45DD5BE785CB}|src\\World.Net.Console\\World.Net.Console.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net.console\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{58CE3FC4-6578-4019-8EFB-45DD5BE785CB}|src\\World.Net.Console\\World.Net.Console.csproj|solutionrelative:src\\world.net.console\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net\\countryprovider.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|solutionrelative:src\\world.net\\countryprovider.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{FD584E36-2331-4DD7-9FAD-0567C5DDD25D}|src\\World.Net.UnitTests\\World.Net.UnitTests.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net.unittests\\countryprovidertest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{FD584E36-2331-4DD7-9FAD-0567C5DDD25D}|src\\World.Net.UnitTests\\World.Net.UnitTests.csproj|solutionrelative:src\\world.net.unittests\\countryprovidertest.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net\\helpers\\countryidentifier.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|solutionrelative:src\\world.net\\helpers\\countryidentifier.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net\\helpers\\countryinitializer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|solutionrelative:src\\world.net\\helpers\\countryinitializer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net\\countries\\afghanistan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|solutionrelative:src\\world.net\\countries\\afghanistan.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|c:\\users\\sword\\documents\\projects\\world.net\\src\\world.net\\exceptions\\countrynotfoundexception.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{2550BD61-4CFB-4B16-8413-961D6EECCFBE}|src\\World.Net\\World.Net.csproj|solutionrelative:src\\world.net\\exceptions\\countrynotfoundexception.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{59C370F1-6E5D-488B-B46B-2370B43A69AD}|Solution Items{59C370F1-6E5D-488B-B46B-2370B43A69AD}|C:\\Users\\SWORD\\Documents\\Projects\\world.net\\README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}",
"RelativeMoniker": "D:0:0:{59C370F1-6E5D-488B-B46B-2370B43A69AD}|Solution Items{59C370F1-6E5D-488B-B46B-2370B43A69AD}|solutionrelative:README.md||{EFC0BB08-EA7D-40C6-A696-C870411A895B}"
}
],
"DocumentGroupContainers": [
Expand All @@ -14,15 +46,15 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 6,
"SelectedChildIndex": 5,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:129:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
},
{
"$type": "Bookmark",
"Name": "ST:128:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
"Name": "ST:129:0:{75188d03-9892-4ae2-abf1-207126247ce5}"
},
{
"$type": "Bookmark",
Expand All @@ -37,20 +69,120 @@
"Name": "ST:128:0:{13b12e3e-c1b4-4539-9371-4fe9a0d523fc}"
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
"$type": "Document",
"DocumentIndex": 0,
"Title": "AlandIslandsTest.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net.UnitTests\\Countries\\AlandIslandsTest.cs",
"RelativeDocumentMoniker": "src\\World.Net.UnitTests\\Countries\\AlandIslandsTest.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net.UnitTests\\Countries\\AlandIslandsTest.cs",
"RelativeToolTip": "src\\World.Net.UnitTests\\Countries\\AlandIslandsTest.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAAWAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-21T22:21:22.611Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Class1.cs",
"DocumentMoniker": "C:\\Users\\anyan\\source\\repos\\world.net\\src\\World.Net\\Class1.cs",
"RelativeDocumentMoniker": "src\\World.Net\\Class1.cs",
"ToolTip": "C:\\Users\\anyan\\source\\repos\\world.net\\src\\World.Net\\Class1.cs",
"RelativeToolTip": "src\\World.Net\\Class1.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-13T22:30:51.287Z",
"DocumentIndex": 4,
"Title": "CountryIdentifier.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Helpers\\CountryIdentifier.cs",
"RelativeDocumentMoniker": "src\\World.Net\\Helpers\\CountryIdentifier.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Helpers\\CountryIdentifier.cs",
"RelativeToolTip": "src\\World.Net\\Helpers\\CountryIdentifier.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAABoAAAArAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-21T22:12:19.772Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "CountryInitializer.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Helpers\\CountryInitializer.cs",
"RelativeDocumentMoniker": "src\\World.Net\\Helpers\\CountryInitializer.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Helpers\\CountryInitializer.cs",
"RelativeToolTip": "src\\World.Net\\Helpers\\CountryInitializer.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-21T22:10:23.767Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "CountryProvider.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\CountryProvider.cs",
"RelativeDocumentMoniker": "src\\World.Net\\CountryProvider.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\CountryProvider.cs",
"RelativeToolTip": "src\\World.Net\\CountryProvider.cs",
"ViewState": "AgIAABoAAAAAAAAAAAAQwDAAAAAbAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-21T19:52:02.454Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 7,
"Title": "CountryNotFoundException.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Exceptions\\CountryNotFoundException.cs",
"RelativeDocumentMoniker": "src\\World.Net\\Exceptions\\CountryNotFoundException.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Exceptions\\CountryNotFoundException.cs",
"RelativeToolTip": "src\\World.Net\\Exceptions\\CountryNotFoundException.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-21T19:51:56.58Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Program.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net.Console\\Program.cs",
"RelativeDocumentMoniker": "src\\World.Net.Console\\Program.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net.Console\\Program.cs",
"RelativeToolTip": "src\\World.Net.Console\\Program.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-19T14:54:17.251Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 6,
"Title": "Afghanistan.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Countries\\Afghanistan.cs",
"RelativeDocumentMoniker": "src\\World.Net\\Countries\\Afghanistan.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net\\Countries\\Afghanistan.cs",
"RelativeToolTip": "src\\World.Net\\Countries\\Afghanistan.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAYAAAAEAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-19T14:47:55.722Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"Title": "CountryProviderTest.cs",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net.UnitTests\\CountryProviderTest.cs",
"RelativeDocumentMoniker": "src\\World.Net.UnitTests\\CountryProviderTest.cs",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\src\\World.Net.UnitTests\\CountryProviderTest.cs",
"RelativeToolTip": "src\\World.Net.UnitTests\\CountryProviderTest.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAFAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-01-19T14:46:24.029Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 8,
"Title": "README.md",
"DocumentMoniker": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\README.md",
"RelativeDocumentMoniker": "README.md",
"ToolTip": "C:\\Users\\SWORD\\Documents\\Projects\\world.net\\README.md",
"RelativeToolTip": "README.md",
"ViewState": "AgIAABUAAAAAAAAAAAAAABwAAABPAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001818|",
"WhenOpened": "2025-01-19T14:45:57.566Z",
"EditorCaption": ""
}
]
Expand Down
28 changes: 28 additions & 0 deletions src/World.Net.UnitTests/Countries/AlandIslandsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using World.Net.Helpers;
deanology marked this conversation as resolved.
Show resolved Hide resolved

namespace World.Net.UnitTests.Countries;

public sealed class AlandIslandsTest
{
[Fact]
public void AlandIslands_HasExpectedInformation()
deanology marked this conversation as resolved.
Show resolved Hide resolved
{
// Arrange
int existingCountryId = CountryIdentifier.AlandIslands;

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

//Assert
Assert.Equal(2, country.Id);
Assert.Equal("AlandIslands", country.Name);
Assert.Equal("Åland Islands", country.OfficialName);
Assert.Equal("Åland", country.NativeName);
Assert.Equal("Mariehamn", country.Capital);
Assert.Equal(248, country.NumericCode);
Assert.Equal("AX", country.ISO2Code);
Assert.Equal("ALA", country.ISO3Code);
Assert.Equal("+358", country.CallingCode);
}

deanology marked this conversation as resolved.
Show resolved Hide resolved
}
53 changes: 53 additions & 0 deletions src/World.Net/Countries/AlandIslands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

namespace World.Net.Countries;

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

///<inheritdoc/>
public string Name { get; } = nameof(AlandIslands);

///<inheritdoc/>
public string OfficialName { get; } = "Åland Islands";

///<inheritdoc/>
public string NativeName { get; } = "Åland";

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

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

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

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

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

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Mariehamn", "", "Municipality"),
new("Jomala", "", "Municipality"),
new("Finström", "", "Municipality"),
new("Lemland", "", "Municipality"),
new("Saltvik", "", "Municipality"),
new("Hammarland", "", "Municipality"),
new("Sund", "", "Municipality"),
new("Eckerö", "", "Municipality"),
new("Föglö", "", "Municipality"),
new("Geta", "", "Municipality"),
new("Brändö", "", "Municipality"),
new("Vårdö", "", "Municipality"),
new("Lumparland", "", "Municipality"),
new("Kumlinge", "", "Municipality"),
new("Kökar", "", "Municipality"),
new("Sottunga", "", "Municipality"),
];
}
7 changes: 7 additions & 0 deletions src/World.Net/Helpers/CountryIdentifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ public sealed partial class CountryIdentifier
/// Use this identifier to reference Afghanistan in operations that require a country ID.
/// </remarks>
public static readonly int AfghanistanId = 1;
/// <summary>
/// The unique identifier for Aland Islands.
/// </summary>
/// <remarks>
/// Use this identifier to reference Aland Islands in operations that require a country ID.
/// </remarks>
public static readonly int AlandIslands = 2;
}
3 changes: 2 additions & 1 deletion src/World.Net/Helpers/CountryInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public static Dictionary<int, ICountry> Initialize()
{
return new Dictionary<int, ICountry>
{
{ CountryIdentifier.AfghanistanId, new Afghanistan() }
{ CountryIdentifier.AfghanistanId, new Afghanistan() },
{ CountryIdentifier.AlandIslands, new AlandIslands() }
// Future countries can be added here in the same format.
};
}
Expand Down