@@ -23,6 +23,11 @@ public async Task CompareWithMledozeCountryProject()
2323 var json = await httpClient . GetStringAsync ( "https://raw.githubusercontent.com/mledoze/countries/master/dist/countries.json" ) ;
2424 var items = JsonConvert . DeserializeObject < MledozeCountry [ ] > ( json ) ;
2525
26+ if ( items is null )
27+ {
28+ Assert . Fail ( "Failure deserialize" ) ;
29+ }
30+
2631 ICountryProvider countryProvider = new CountryProvider ( ) ;
2732 foreach ( var countryCode in ( Alpha2Code [ ] ) Enum . GetValues ( typeof ( Alpha2Code ) ) )
2833 {
@@ -76,47 +81,47 @@ private string GetSubRegion(SubRegion subRegion)
7681
7782 public class MledozeCountry
7883 {
79- public Name Name { get ; set ; }
80- public string [ ] Tld { get ; set ; }
81- public string Cca2 { get ; set ; }
84+ public required Name Name { get ; set ; }
85+ public required string [ ] Tld { get ; set ; }
86+ public required string Cca2 { get ; set ; }
8287 public int ? Ccn3 { get ; set ; }
83- public string Cca3 { get ; set ; }
84- public string Cioc { get ; set ; }
88+ public required string Cca3 { get ; set ; }
89+ public required string Cioc { get ; set ; }
8590 public bool ? Independent { get ; set ; }
86- public string Status { get ; set ; }
87- public dynamic Currencies { get ; set ; }
88- public string [ ] CallingCode { get ; set ; }
89- public string [ ] Capital { get ; set ; }
90- public string [ ] AltSpellings { get ; set ; }
91- public string Region { get ; set ; }
92- public string Subregion { get ; set ; }
91+ public required string Status { get ; set ; }
92+ public required dynamic Currencies { get ; set ; }
93+ public string [ ] CallingCode { get ; set ; } = [ ] ;
94+ public string [ ] Capital { get ; set ; } = [ ] ;
95+ public string [ ] AltSpellings { get ; set ; } = [ ] ;
96+ public required string Region { get ; set ; }
97+ public required string Subregion { get ; set ; }
9398 //public Languages languages { get; set; }
9499 //public Dictionary<string, NameNative> translations { get; set; }
95- public List < double > LatLng { get ; set ; }
96- public string Demonym { get ; set ; }
100+ public required List < double > LatLng { get ; set ; }
101+ public string ? Demonym { get ; set ; }
97102 public bool Landlocked { get ; set ; }
98- public string [ ] Borders { get ; set ; }
103+ public string [ ] Borders { get ; set ; } = [ ] ;
99104 public double Area { get ; set ; }
100- public string Flag { get ; set ; }
105+ public required string Flag { get ; set ; }
101106 }
102107
103108 public class Name
104109 {
105- public string Common { get ; set ; }
106- public string Official { get ; set ; }
107- public Dictionary < string , NameNative > Native { get ; set ; }
110+ public required string Common { get ; set ; }
111+ public required string Official { get ; set ; }
112+ public required Dictionary < string , NameNative > Native { get ; set ; }
108113 }
109114
110115 public class NameNative
111116 {
112- public string Common { get ; set ; }
113- public string Official { get ; set ; }
117+ public required string Common { get ; set ; }
118+ public required string Official { get ; set ; }
114119 }
115120
116121 public class Currency
117122 {
118- public string Name { get ; set ; }
119- public string Symbol { get ; set ; }
123+ public required string Name { get ; set ; }
124+ public string ? Symbol { get ; set ; }
120125 }
121126 }
122127}
0 commit comments