|
1 | 1 | namespace World.Net.UnitTests.Countries; |
2 | | -public sealed class FrenchPolynesiaTest |
| 2 | +public sealed class FrenchPolynesiaTest : AssertCountryTestBase |
3 | 3 | { |
4 | 4 | private const string FRENCH_POLYNESIA_NAME = "French Polynesia"; |
5 | | - private const int FRENCH_POLYNESIA_STATE_COUNT = 5; |
6 | 5 | private const string FRENCH_POLYNESIA_OFFICIAL_NAME = "Polynésie française"; |
7 | 6 | private const string FRENCH_POLYNESIA_NATIVE_NAME = "Polynésie française"; |
8 | 7 | private const string FRENCH_POLYNESIA_CAPITAL = "Papeete"; |
9 | 8 | private const int FRENCH_POLYNESIA_NUMERIC_CODE = 258; |
10 | 9 | private const string FRENCH_POLYNESIA_ISO2_CODE = "PF"; |
11 | 10 | private const string FRENCH_POLYNESIA_ISO3_CODE = "PYF"; |
12 | | - private static readonly string[] VALID_STATE_TYPES = { "division" }; |
13 | 11 | 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 | + ]; |
15 | 20 |
|
16 | 21 | [Fact] |
17 | 22 | public void GetCountry_ReturnsCorrectInformation_ForFrench_Polynesia() |
18 | 23 | { |
19 | 24 | // Arrange |
20 | | - CountryIdentifier existingCountryId = CountryIdentifier.FrenchPolynesia; |
21 | | - |
22 | 25 | // Act |
23 | | - var country = CountryProvider.GetCountry(existingCountryId); |
| 26 | + var country = CountryProvider.GetCountry(ExpectedId); |
24 | 27 |
|
25 | 28 | //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 | + ); |
38 | 43 | } |
39 | 44 | } |
0 commit comments