Skip to content

Commit 7423193

Browse files
committed
add french polynesia test
1 parent 2da255d commit 7423193

1 file changed

Lines changed: 24 additions & 19 deletions

File tree

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
namespace World.Net.UnitTests.Countries;
2-
public sealed class FrenchPolynesiaTest
2+
public sealed class FrenchPolynesiaTest : AssertCountryTestBase
33
{
44
private const string FRENCH_POLYNESIA_NAME = "French Polynesia";
5-
private const int FRENCH_POLYNESIA_STATE_COUNT = 5;
65
private const string FRENCH_POLYNESIA_OFFICIAL_NAME = "Polynésie française";
76
private const string FRENCH_POLYNESIA_NATIVE_NAME = "Polynésie française";
87
private const string FRENCH_POLYNESIA_CAPITAL = "Papeete";
98
private const int FRENCH_POLYNESIA_NUMERIC_CODE = 258;
109
private const string FRENCH_POLYNESIA_ISO2_CODE = "PF";
1110
private const string FRENCH_POLYNESIA_ISO3_CODE = "PYF";
12-
private static readonly string[] VALID_STATE_TYPES = { "division" };
1311
private readonly string[] FRENCH_POLYNESIA_CALLING_CODE = ["+689"];
14-
12+
private const CountryIdentifier ExpectedId = CountryIdentifier.FrenchPolynesia;
13+
private static readonly (string Name, string IsoCode, string Type)[] ExpectedStates = [
14+
("N'Austral Islands", "PF-01", "division"),
15+
("Leeward Islands", "PF-02", "division"),
16+
("Marquesas Islands", "PF-03", "division"),
17+
("Tuamotu-Gambier", "PF-04", "division"),
18+
("Windward Islands", "PF-05", "division"),
19+
];
1520

1621
[Fact]
1722
public void GetCountry_ReturnsCorrectInformation_ForFrench_Polynesia()
1823
{
1924
// Arrange
20-
CountryIdentifier existingCountryId = CountryIdentifier.FrenchPolynesia;
21-
2225
// Act
23-
var country = CountryProvider.GetCountry(existingCountryId);
26+
var country = CountryProvider.GetCountry(ExpectedId);
2427

2528
//Assert
26-
Assert.Equal(existingCountryId, country.Id);
27-
Assert.Equal(FRENCH_POLYNESIA_NAME, country.Name);
28-
Assert.NotNull(country.States);
29-
Assert.Equal(FRENCH_POLYNESIA_STATE_COUNT, country.States.Count());
30-
Assert.Equal(FRENCH_POLYNESIA_OFFICIAL_NAME, country.OfficialName);
31-
Assert.Equal(FRENCH_POLYNESIA_NATIVE_NAME, country.NativeName);
32-
Assert.All(country.States, state => Assert.Contains(state.Type, VALID_STATE_TYPES));
33-
Assert.Equal(FRENCH_POLYNESIA_CAPITAL, country.Capital);
34-
Assert.Equal(FRENCH_POLYNESIA_NUMERIC_CODE, country.NumericCode);
35-
Assert.Equal(FRENCH_POLYNESIA_ISO2_CODE, country.ISO2Code);
36-
Assert.Equal(FRENCH_POLYNESIA_ISO3_CODE, country.ISO3Code);
37-
Assert.Equal(FRENCH_POLYNESIA_CALLING_CODE, country.CallingCode);
29+
30+
AssertCorrectInformation(
31+
country,
32+
ExpectedId,
33+
FRENCH_POLYNESIA_NAME,
34+
FRENCH_POLYNESIA_OFFICIAL_NAME,
35+
FRENCH_POLYNESIA_NATIVE_NAME,
36+
FRENCH_POLYNESIA_CAPITAL,
37+
FRENCH_POLYNESIA_NUMERIC_CODE,
38+
FRENCH_POLYNESIA_ISO2_CODE,
39+
FRENCH_POLYNESIA_ISO3_CODE,
40+
FRENCH_POLYNESIA_CALLING_CODE,
41+
ExpectedStates
42+
);
3843
}
3944
}

0 commit comments

Comments
 (0)