77using PortableLeagueApi . Game . Extensions ;
88using PortableLeagueApi . Interfaces . Core ;
99using PortableLeagueApi . Interfaces . Enums ;
10+ using PortableLeagueApi . Interfaces . Game ;
1011using PortableLeagueApi . Interfaces . League ;
1112using PortableLeagueApi . Interfaces . Stats ;
13+ using PortableLeagueApi . Interfaces . Summoner ;
1214using PortableLeagueApi . League . Extensions ;
1315using PortableLeagueApi . Static . Extensions ;
1416using PortableLeagueApi . Team . Extensions ;
@@ -21,17 +23,20 @@ public class LeagueAPIServiceTests
2123 private readonly LeagueApi _leagueAPI ;
2224
2325 private const long SummonerId = 19332836 ;
24- private const string SummonerName = "TuC Ølen " ;
26+ private const string SummonerName = "Pulse Olen " ;
2527 private const string TeamId = "TEAM-4b3c8100-91a3-11e3-be7d-782bcb497d6f" ;
2628
29+ private const string ApiKey = "" ;
30+ private static readonly IHttpRequestService HttpRequestService = new FakeHttpRequestService ( ) ;
31+
2732 public LeagueAPIServiceTests ( ) : this ( null )
2833 {
2934 }
3035
3136 public LeagueAPIServiceTests ( ILeagueApiConfiguration configuration )
3237 {
3338 configuration = configuration ??
34- new LeagueApiConfiguration ( string . Empty , RegionEnum . Euw , true , new FakeHttpRequestService ( ) ) ;
39+ new LeagueApiConfiguration ( ApiKey , RegionEnum . Euw , true , HttpRequestService ) ;
3540
3641 _leagueAPI = new LeagueApi ( configuration ) ;
3742 }
@@ -46,7 +51,7 @@ public async void TestRegions()
4651 {
4752 var freeChampions = await _leagueAPI . Champion . GetChampionsAsync ( false , region ) ;
4853
49- Assert . NotNull ( freeChampions ) ;
54+ Assert . NotNull ( freeChampions . ToList ( ) ) ;
5055 }
5156 }
5257 }
@@ -85,7 +90,7 @@ public async void GetChampionsTestAsync()
8590 {
8691 var freeChampions = await _leagueAPI . Champion . GetChampionsAsync ( false ) ;
8792
88- Assert . NotNull ( freeChampions ) ;
93+ Assert . NotNull ( freeChampions . ToList ( ) ) ;
8994 }
9095
9196 [ Test ]
@@ -110,7 +115,7 @@ public async void GetSummonerAndRecentGamesTestAsync()
110115
111116 var result = await summoner . GetRecentGamesAsync ( ) ;
112117
113- Assert . NotNull ( result ) ;
118+ Assert . NotNull ( result . ToList ( ) ) ;
114119 }
115120
116121 [ Test ]
@@ -220,7 +225,7 @@ public async void RetrieveLeaguesEntryDataTestAsync()
220225
221226 var result = await summoner . RetrieveLeaguesEntryDataAsync ( ) ;
222227
223- Assert . NotNull ( result ) ;
228+ Assert . NotNull ( result . ToList ( ) ) ;
224229 }
225230
226231 [ Test ]
@@ -229,7 +234,7 @@ public async void GetPlayerStatsSummariesBySummonerIdTestAsync()
229234 {
230235 var result = await _leagueAPI . Stats . GetPlayerStatsSummariesBySummonerIdAsync ( SummonerId ) ;
231236
232- Assert . NotNull ( result ) ;
237+ Assert . NotNull ( result . ToList ( ) ) ;
233238 }
234239
235240 [ Test ]
@@ -259,7 +264,7 @@ public async void GetMasteryPagesBySummonerIdTestAsync()
259264 {
260265 var result = await _leagueAPI . Summoner . GetMasteryPagesBySummonerIdAsync ( SummonerId ) ;
261266
262- Assert . NotNull ( result ) ;
267+ Assert . NotNull ( result . ToList ( ) ) ;
263268 }
264269
265270 //[Test]
@@ -277,7 +282,7 @@ public async void GetRunePagesBySummonerIdTestAsync()
277282 {
278283 var result = await _leagueAPI . Summoner . GetRunePagesBySummonerIdAsync ( SummonerId ) ;
279284
280- Assert . NotNull ( result ) ;
285+ Assert . NotNull ( result . ToList ( ) ) ;
281286 }
282287
283288 //[Test]
@@ -313,7 +318,7 @@ public async void GetSummonerByIdsTestAsync()
313318 {
314319 var result = await _leagueAPI . Summoner . GetSummonerByIdAsync ( new List < long > { SummonerId , 19231045 } ) ;
315320
316- Assert . NotNull ( result ) ;
321+ Assert . NotNull ( result . ToList ( ) ) ;
317322 }
318323
319324 [ Test ]
@@ -340,7 +345,7 @@ public async void GetTeamsBySummonerIdTestAsync()
340345 {
341346 var result = await _leagueAPI . Team . GetTeamsBySummonerIdAsync ( SummonerId ) ;
342347
343- Assert . NotNull ( result ) ;
348+ Assert . NotNull ( result . ToList ( ) ) ;
344349 }
345350
346351 [ Test ]
@@ -351,9 +356,9 @@ public async void GetTeamsBySummonerIdExtensionTestAsync()
351356
352357 Assert . NotNull ( summoner ) ;
353358
354- var teams = summoner . GetTeamsBySummonerIdAsync ( ) ;
359+ var teams = await summoner . GetTeamsBySummonerIdAsync ( ) ;
355360
356- Assert . NotNull ( teams ) ;
361+ Assert . NotNull ( teams . ToList ( ) ) ;
357362 }
358363
359364 [ Test ]
@@ -491,7 +496,7 @@ public async void GetStaticSummonerSpellsWithParametersTest2Async()
491496 public async void GetVersionsTestAsync ( )
492497 {
493498 var versions = await _leagueAPI . Static . GetVersionsAsync ( ) ;
494- Assert . NotNull ( versions ) ;
499+ Assert . NotNull ( versions . ToList ( ) ) ;
495500 }
496501
497502 [ Test ]
@@ -613,9 +618,11 @@ public async void GetSpriteUrlTestAsync()
613618 public async void MasteryExtensionsTestAsync ( )
614619 {
615620 var masteriesPage = await _leagueAPI . Summoner . GetMasteryPagesBySummonerIdAsync ( SummonerId ) ;
616- Assert . NotNull ( masteriesPage ) ;
617621
618- var result = await masteriesPage . First ( ) . Masteries . First ( ) . GetMasteryStaticInfosAsync ( ) ;
622+ var masteryPages = masteriesPage as IMasteryPage [ ] ?? masteriesPage . ToArray ( ) ;
623+ Assert . NotNull ( masteryPages ) ;
624+
625+ var result = await masteryPages . First ( ) . Masteries . First ( ) . GetMasteryStaticInfosAsync ( ) ;
619626
620627 Assert . NotNull ( result ) ;
621628 }
@@ -625,9 +632,11 @@ public async void MasteryExtensionsTestAsync()
625632 public async void RuneExtensionsTestAsync ( )
626633 {
627634 var runesPages = await _leagueAPI . Summoner . GetRunePagesBySummonerIdAsync ( SummonerId ) ;
628- Assert . NotNull ( runesPages ) ;
629635
630- var result = await runesPages . First ( ) . Slots . First ( ) . GetRuneStaticInfosAsync ( ) ;
636+ var runePages = runesPages as IRunePage [ ] ?? runesPages . ToArray ( ) ;
637+ Assert . NotNull ( runePages ) ;
638+
639+ var result = await runePages . First ( ) . Slots . First ( ) . GetRuneStaticInfosAsync ( ) ;
631640
632641 Assert . NotNull ( result ) ;
633642 }
@@ -637,9 +646,11 @@ public async void RuneExtensionsTestAsync()
637646 public async void ItemsExtensionsTestAsync ( )
638647 {
639648 var recentGames = await _leagueAPI . Game . GetRecentGamesBySummonerIdAsync ( SummonerId ) ;
640- Assert . NotNull ( recentGames ) ;
641649
642- var result = await recentGames . First ( ) . Stats . GetItemsStaticInfosAsync ( ) ;
650+ var enumerable = recentGames as IGame [ ] ?? recentGames . ToArray ( ) ;
651+ Assert . NotNull ( enumerable ) ;
652+
653+ var result = await enumerable . First ( ) . Stats . GetItemsStaticInfosAsync ( ) ;
643654
644655 Assert . NotNull ( result ) ;
645656 }
@@ -649,9 +660,11 @@ public async void ItemsExtensionsTestAsync()
649660 public async void ItemsImageExtensionsTestAsync ( )
650661 {
651662 var recentGames = await _leagueAPI . Game . GetRecentGamesBySummonerIdAsync ( SummonerId ) ;
652- Assert . NotNull ( recentGames ) ;
653663
654- var urls = await recentGames . First ( ) . Stats . GetItemsImageUrlsAsync ( ) ;
664+ var enumerable = recentGames as IGame [ ] ?? recentGames . ToArray ( ) ;
665+ Assert . NotNull ( enumerable ) ;
666+
667+ var urls = await enumerable . First ( ) . Stats . GetItemsImageUrlsAsync ( ) ;
655668 Assert . NotNull ( urls ) ;
656669
657670 using ( var httpClient = new HttpClient ( ) )
@@ -672,9 +685,11 @@ public async void ItemsImageExtensionsTestAsync()
672685 public async void SummonerSpellExtensionsTestAsync ( )
673686 {
674687 var recentGames = await _leagueAPI . Game . GetRecentGamesBySummonerIdAsync ( SummonerId ) ;
675- Assert . NotNull ( recentGames ) ;
676688
677- var result = await recentGames . First ( ) . GetSummonerSpellsStaticInfosAsync ( ) ;
689+ var enumerable = recentGames as IGame [ ] ?? recentGames . ToArray ( ) ;
690+ Assert . NotNull ( enumerable ) ;
691+
692+ var result = await enumerable . First ( ) . GetSummonerSpellsStaticInfosAsync ( ) ;
678693
679694 Assert . NotNull ( result ) ;
680695 }
0 commit comments