Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/BrazilTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class BrazilTest
{
private const string BRAZIL_NAME = "Brazil";
private const int BRAZIL_STATE_COUNT = 27;
private const string BRAZIL_OFFICIAL_NAME = "Federative Republic of Brazil";
private const string BRAZIL_NATIVE_NAME = "Brasil";
private const string BRAZIL_CAPITAL = "Brasilia";
private const int BRAZIL_NUMERIC_CODE = 076;
private const string BRAZIL_ISO2_CODE = "BR";
private const string BRAZIL_ISO3_CODE = "BRA";
private const string BRAZIL_CALLING_CODE = "+55";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(BRAZIL_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(BRAZIL_STATE_COUNT, country.States.Count());
Assert.Equal(BRAZIL_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(BRAZIL_NATIVE_NAME, country.NativeName);
Assert.Equal(BRAZIL_CAPITAL, country.Capital);
Assert.Equal(BRAZIL_NUMERIC_CODE, country.NumericCode);
Assert.Equal(BRAZIL_ISO2_CODE, country.ISO2Code);
Assert.Equal(BRAZIL_ISO3_CODE, country.ISO3Code);
Assert.Equal(BRAZIL_CALLING_CODE, country.CallingCode);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace World.Net.UnitTests.Countries
{
public sealed class BritishIndianOceanTerritoryTest
{
private const string BRITISH_INDIAN_OCEAN_TERRITORY_NAME = "British Indian Ocean Territory";
private const string BRITISH_INDIAN_OCEAN_TERRITORY_OFFICIAL_NAME = "British Indian Ocean Territory";
private const string BRITISH_INDIAN_OCEAN_TERRITORY_NATIVE_NAME = "British Indian Ocean Territory";
private const string BRITISH_INDIAN_OCEAN_TERRITORY_CAPITAL = "Diego Garcia";
private const int BRITISH_INDIAN_OCEAN_TERRITORY_NUMERIC_CODE = 086;
private const string BRITISH_INDIAN_OCEAN_TERRITORY_ISO2_CODE = "IO";
private const string BRITISH_INDIAN_OCEAN_TERRITORY_ISO3_CODE = "IOT";
private const string BRITISH_INDIAN_OCEAN_TERRITORY_CALLING_CODE = "+246";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Empty(country.States);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_NATIVE_NAME, country.NativeName);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_CAPITAL, country.Capital);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_NUMERIC_CODE, country.NumericCode);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_ISO2_CODE, country.ISO2Code);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_ISO3_CODE, country.ISO3Code);
Assert.Equal(BRITISH_INDIAN_OCEAN_TERRITORY_CALLING_CODE, country.CallingCode);
}
}
}
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/BruneiTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class BruneiTest
{
private const string BRUNEI_NAME = "Brunei";
private const int BRUNEI_STATE_COUNT = 4;
private const string BRUNEI_OFFICIAL_NAME = "Nation of Brunei, the Abode of Peace";
private const string BRUNEI_NATIVE_NAME = "Negara Brunei Darussalam";
private const string BRUNEI_CAPITAL = "Bandar Seri Begawan";
private const int BRUNEI_NUMERIC_CODE = 096;
private const string BRUNEI_ISO2_CODE = "BN";
private const string BRUNEI_ISO3_CODE = "BRN";
private const string BRUNEI_CALLING_CODE = "+673";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(BRUNEI_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(BRUNEI_STATE_COUNT, country.States.Count());
Assert.Equal(BRUNEI_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(BRUNEI_NATIVE_NAME, country.NativeName);
Assert.Equal(BRUNEI_CAPITAL, country.Capital);
Assert.Equal(BRUNEI_NUMERIC_CODE, country.NumericCode);
Assert.Equal(BRUNEI_ISO2_CODE, country.ISO2Code);
Assert.Equal(BRUNEI_ISO3_CODE, country.ISO3Code);
Assert.Equal(BRUNEI_CALLING_CODE, country.CallingCode);
}
}
}
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/BulgariaTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class BulgariaTest
{
private const string BULGARIA_NAME = "Bulgaria";
private const int BULGARIA_STATE_COUNT = 28;
private const string BULGARIA_OFFICIAL_NAME = "Republic of Bulgaria";
private const string BULGARIA_NATIVE_NAME = "България";
private const string BULGARIA_CAPITAL = "Sofia";
private const int BULGARIA_NUMERIC_CODE = 100;
private const string BULGARIA_ISO2_CODE = "BG";
private const string BULGARIA_ISO3_CODE = "BGR";
private const string BULGARIA_CALLING_CODE = "+359";

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this extra space

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment treated

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(BULGARIA_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(BULGARIA_STATE_COUNT, country.States.Count());
Assert.Equal(BULGARIA_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(BULGARIA_NATIVE_NAME, country.NativeName);
Assert.Equal(BULGARIA_CAPITAL, country.Capital);
Assert.Equal(BULGARIA_NUMERIC_CODE, country.NumericCode);
Assert.Equal(BULGARIA_ISO2_CODE, country.ISO2Code);
Assert.Equal(BULGARIA_ISO3_CODE, country.ISO3Code);
Assert.Equal(BULGARIA_CALLING_CODE, country.CallingCode);
}
}
}
38 changes: 38 additions & 0 deletions src/World.Net.UnitTests/Countries/BurkinaFasoTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.UnitTests.Countries
{
public sealed class BurkinaFasoTest
{
private const string BURKINA_FASO_NAME = "Burkina Faso";
private const int BURKINA_FASO_STATE_COUNT = 57;
private const string BURKINA_FASO_OFFICIAL_NAME = "The Republic of Burkina Faso";
private const string BURKINA_FASO_NATIVE_NAME = "Burkina Faso";
private const string BURKINA_FASO_CAPITAL = "Ouagadougou";
private const int BURKINA_FASO_NUMERIC_CODE = 854;
private const string BURKINA_FASO_ISO2_CODE = "BF";
private const string BURKINA_FASO_ISO3_CODE = "BFA";
private const string BURKINA_FASO_CALLING_CODE = "+226";

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

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

//Assert
Assert.Equal(existingCountryId, country.Id);
Assert.Equal(BURKINA_FASO_NAME, country.Name);
Assert.NotNull(country.States);
Assert.Equal(BURKINA_FASO_STATE_COUNT, country.States.Count());
Assert.Equal(BURKINA_FASO_OFFICIAL_NAME, country.OfficialName);
Assert.Equal(BURKINA_FASO_NATIVE_NAME, country.NativeName);
Assert.Equal(BURKINA_FASO_CAPITAL, country.Capital);
Assert.Equal(BURKINA_FASO_NUMERIC_CODE, country.NumericCode);
Assert.Equal(BURKINA_FASO_ISO2_CODE, country.ISO2Code);
Assert.Equal(BURKINA_FASO_ISO3_CODE, country.ISO3Code);
Assert.Equal(BURKINA_FASO_CALLING_CODE, country.CallingCode);
}
}
}
64 changes: 64 additions & 0 deletions src/World.Net/Countries/Brazil.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
namespace World.Net.Countries
{
internal sealed class Brazil : ICountry
{
///<inheritdoc/>
public int Id => CountryIdentifier.Brazil;

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

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

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

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

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

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

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

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

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Acre", "AC", "State"),
new("Alagoas", "AL", "State"),
new("Amapá", "AP", "State"),
new("Amazonas", "AM", "State"),
new("Bahia", "BA", "State"),
new("Ceará", "CE", "State"),
new("Distrito Federal", "DF", "Federal District"),
new("Espírito Santo", "ES", "State"),
new("Goiás", "GO", "State"),
new("Maranhão", "MA", "State"),
new("Mato Grosso", "MT", "State"),
new("Mato Grosso do Sul", "MS", "State"),
new("Minas Gerais", "MG", "State"),
new("Pará", "PA", "State"),
new("Paraíba", "PB", "State"),
new("Paraná", "PR", "State"),
new("Pernambuco", "PE", "State"),
new("Piauí", "PI", "State"),
new("Rio de Janeiro", "RJ", "State"),
new("Rio Grande do Norte", "RN", "State"),
new("Rio Grande do Sul", "RS", "State"),
new("Rondônia", "RO", "State"),
new("Roraima", "RR", "State"),
new("Santa Catarina", "SC", "State"),
new("São Paulo", "SP", "State"),
new("Sergipe", "SE", "State"),
new("Tocantins", "TO", "State"),
];
}
}
38 changes: 38 additions & 0 deletions src/World.Net/Countries/BritishIndianOceanTerritory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
namespace World.Net.Countries
{
internal sealed class BritishIndianOceanTerritory : ICountry
{
///<inheritdoc/>
public int Id => CountryIdentifier.BritishIndianOceanTerritory;

///<inheritdoc/>
public string Name => "British Indian Ocean Territory";

///<inheritdoc/>
public string OfficialName { get; } = "British Indian Ocean Territory";

///<inheritdoc/>
public string NativeName { get; } = "British Indian Ocean Territory";

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

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

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

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

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

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[

];
}
}
41 changes: 41 additions & 0 deletions src/World.Net/Countries/Brunei.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace World.Net.Countries
{
internal sealed class Brunei : ICountry
{
///<inheritdoc/>
public int Id => CountryIdentifier.Brunei;

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

///<inheritdoc/>
public string OfficialName { get; } = "Nation of Brunei, the Abode of Peace";

///<inheritdoc/>
public string NativeName { get; } = "Negara Brunei Darussalam";

///<inheritdoc/>
public string Capital { get; } = "Bandar Seri Begawan";

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

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

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

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

///<inheritdoc/>
public IEnumerable<State> States { get; } =
[
new("Belait", "BE", "District"),
new("Brunei-Muara", "BM", "District"),
new("Temburong", "TE", "District"),
new("Tutong", "TU", "District"),
];
}
}
Loading