forked from BenFradet/RiotSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRiotApiTest.cs
900 lines (743 loc) · 30.2 KB
/
RiotApiTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RiotSharp;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
namespace RiotSharpTest
{
[TestClass]
public class RiotApiTest
{
private static string apiKey = ConfigurationManager.AppSettings["ApiKey"];
private static int id = int.Parse(ConfigurationManager.AppSettings["Summoner1Id"]);
private static string name = ConfigurationManager.AppSettings["Summoner1Name"];
private static int id2 = int.Parse(ConfigurationManager.AppSettings["Summoner2Id"]);
private static string name2 = ConfigurationManager.AppSettings["Summoner2Name"];
private static string team = ConfigurationManager.AppSettings["Team1Id"];
private static string team2 = ConfigurationManager.AppSettings["Team2Id"];
private static int gameId = int.Parse(ConfigurationManager.AppSettings["GameId"]);
private static int championId = int.Parse(ConfigurationManager.AppSettings["ChampionId"]);
private static RiotApi api = RiotApi.GetInstance(apiKey);
private static Queue queue = Queue.RankedSolo5x5;
private static Region region = (Region) Enum.Parse(typeof(Region), ConfigurationManager.AppSettings["Region"]);
private static RiotSharp.MatchEndpoint.Enums.Season season = RiotSharp.MatchEndpoint.Enums.Season.Season2015;
private static DateTime beginTime = new DateTime(2015, 01, 01);
private static DateTime endTime { get { return DateTime.Now; } }
private static List<long> summonerIds = new List<long>()
{
23902591, 19676775, 22653737, 21759506, 22209505, 29299341, 19101354, 22166284, 31730794, 39974593,
23902591, 22790011, 65450936, 67592203, 39637575, 31272097, 23460015, 38627529, 23902591, 44027682,
20148263, 61138162, 52450898, 31944743, 22926530, 45019487, 19395392, 23902591, 30916825, 34141832,
46886818, 30994519, 39241634, 28169062, 57726999, 50925946, 41522929, 31718213, 23902591, 24301336,
28876579, 21465943, 20359176, 18984263, 22061503, 76817435, 28900842, 23902591, 49777173, 43748875,
25537355, 25284531, 43748877, 26203312, 33839074, 23902591, 59036943, 23214917, 42900539, 34010653,
19018526, 33031228, 45777129, 23902591, 20458413, 39682802, 50859594, 25518612, 43240226, 63932884,
21405713, 27551513, 23041221, 23902591, 44864177, 22922241, 19766814, 24754815, 67857142, 24549825,
60420048, 32961021, 23902591, 39533020, 19294507, 63897880, 33420487, 40101562, 41146842, 61277247
};
private const long unrankedSummonerId = 76723437; // NA
private static List<string> teamIds = new List<string>()
{
"TEAM-c09dc752-1b57-40bb-8373-cb244a200690",
"TEAM-3bd1b470-3b57-11e4-8b56-c81f66db96d8",
"TEAM-f619b780-43bc-11e3-8ac1-782bcb497d6f",
"TEAM-7df12a20-edb4-11e3-a1bd-782bcb497d6f",
"TEAM-5914f8c0-d4a0-11e4-ae33-c81f66db920c",
"TEAM-47b21030-0937-11e3-b73e-782bcb4ce61a",
"TEAM-fa862d00-498a-11e5-8d7f-c81f66dd7106",
"TEAM-462d4230-63c0-11e5-88c0-c81f66daeaa4",
"TEAM-70bcb400-ba3b-11e5-b50f-c81f66dd30e5",
"TEAM-5bfca170-a07f-11e2-b354-782bcb4ce61a",
"TEAM-b11619d0-7e83-11e6-b377-c81f66dd7106",
"TEAM-943f2d30-800c-11e6-97fc-c81f66dd32cd"
};
private static List<string> summonerNames = new List<string>()
{
"Hüxün", "Huikkeli", "poppego", "Masvell", "The 4th Legend", "D4rKAn1mA", "JamboJambo", "MamBoBamos",
"T0mbs", "uNluckY WallAce", "besni leptir", "InSoAlWeTrust", "Kalistharu", "mikele1997", "Rikudö",
"Ironíc", "ThaKinetic", "Level 7 Fiora", "Vodkah", "Vayne Only xD", "PF Chang Himself", "Oooshun Man",
"Paxwell", "Matsyboy", "KingBronko", "chat off", "d3gvsdo", "vipkossEUW", "Monkeyvillage",
"Synergizing", "iEvoile", "Cthlulu", "LelushLamperysh", "Press RR", "pfulius", "127 II StPO",
"El Bananero", "Jadi", "Wyburn", "The Vegan God", "Guztavo", "KebapRocker", "Potion Shop"
};
[TestMethod]
[TestCategory("RiotApi")]
public void GetSummoner_ById_Test()
{
var summoner = api.GetSummoner(region, id);
Assert.AreEqual(summoner.Name, name);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetSummonerAsync_ById_Test()
{
var summoner = api.GetSummonerAsync(region, id);
Assert.AreEqual(summoner.Result.Name, name);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetSummoners_ById_Test()
{
var summoners = api.GetSummoners(Region.euw, summonerIds);
Assert.IsNotNull(summoners);
Assert.AreEqual(summonerIds.Distinct().Count(), summoners.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetSummonersAsync_ById_Test()
{
var summoners = api.GetSummonersAsync(Region.euw, summonerIds);
Assert.IsNotNull(summoners.Result);
Assert.AreEqual(summonerIds.Distinct().Count(), summoners.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetSummoner_ByName_Test()
{
var summoner = api.GetSummoner(region, name);
Assert.AreEqual(summoner.Id, id);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetSummonerAsync_ByName_Test()
{
var summoner = api.GetSummonerAsync(region, name);
Assert.AreEqual(summoner.Result.Id, id);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetSummoners_ByName_Test()
{
var summoners = api.GetSummoners(Region.euw, summonerNames);
Assert.IsNotNull(summoners);
Assert.AreEqual(summonerNames.Distinct().Count(), summoners.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetSummonersAsync_ByName_Test()
{
var summoners = api.GetSummonersAsync(Region.euw, summonerNames);
Assert.IsNotNull(summoners.Result);
Assert.AreEqual(summonerNames.Distinct().Count(), summoners.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetSummonerName_Test()
{
var summoner = api.GetSummonerName(region, id);
Assert.AreEqual(summoner.Name, name);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetSummonerNameAsync_Test()
{
var summoner = api.GetSummonerNameAsync(region, id);
Assert.AreEqual(summoner.Result.Name, name);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetSummonersNames_Test()
{
var summoners = api.GetSummonerNames(Region.euw, summonerIds);
Assert.IsNotNull(summoners);
Assert.AreEqual(summonerIds.Distinct().Count(), summoners.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetSummonersNamesAsync_Test()
{
var summoners = api.GetSummonerNamesAsync(Region.euw, summonerIds);
Assert.IsNotNull(summoners.Result);
Assert.AreEqual(summonerIds.Distinct().Count(), summoners.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetChampions_Test()
{
var champions = api.GetChampions(region);
Assert.IsNotNull(champions);
Assert.IsTrue(champions.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetChampionsAsync_Test()
{
var champions = api.GetChampionsAsync(region);
Assert.IsNotNull(champions.Result);
Assert.IsTrue(champions.Result.Count() > 0);
}
[TestMethod]
[Ignore]
[TestCategory("RiotApi")]
public void GetChampions_FreeToPlay_Test()
{
var champions = api.GetChampions(region, true);
Assert.IsNotNull(champions);
Assert.IsTrue(champions.Count() == 10);
}
[TestMethod]
[Ignore]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetChampionsAsync_FreeToPlay_Test()
{
var champions = api.GetChampionsAsync(region, true);
Assert.IsNotNull(champions.Result);
Assert.IsTrue(champions.Result.Count() == 10);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetChampion_Test()
{
var champion = api.GetChampion(region, 12);
Assert.IsNotNull(champion);
Assert.AreEqual(champion.Id, 12);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetChampionAsync_Test()
{
var champion = api.GetChampionAsync(region, 12);
Assert.IsNotNull(champion.Result);
Assert.AreEqual(champion.Result.Id, 12);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetMasteryPages_Test()
{
var masteries = api.GetMasteryPages(Region.euw, summonerIds);
Assert.IsNotNull(masteries);
Assert.AreEqual(summonerIds.Distinct().Count(), masteries.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMasteryPagesAsync_Test()
{
var masteries = api.GetMasteryPagesAsync(Region.euw, summonerIds);
Assert.IsNotNull(masteries.Result);
Assert.AreEqual(summonerIds.Distinct().Count(), masteries.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetRunePages_Test()
{
var runes = api.GetRunePages(Region.euw, summonerIds);
Assert.IsNotNull(runes);
Assert.AreEqual(summonerIds.Distinct().Count(), runes.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetRunePagesAsync_Test()
{
var runes = api.GetRunePagesAsync(Region.euw, summonerIds);
Assert.IsNotNull(runes.Result);
Assert.AreEqual(summonerIds.Distinct().Count(), runes.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetLeagues_BySummoner_Test()
{
var leagues = api.GetLeagues(Region.euw, summonerIds);
Assert.IsNotNull(leagues);
Assert.AreEqual(summonerIds.Distinct().Count() - 4, leagues.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetLeaguesAsync_BySummoner_Test()
{
var leagues = api.GetLeaguesAsync(Region.euw, summonerIds);
Assert.IsNotNull(leagues);
Assert.AreEqual(summonerIds.Distinct().Count() - 4, leagues.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
[ExpectedException(typeof(RiotSharpException))]
public void GetLeagues_ByUnrankedSummoner_Test()
{
try
{
api.GetLeagues(Region.na, new List<long>(1) { unrankedSummonerId });
}
catch (RiotSharpException e)
{
// API gives 404 when valid summoner is unranked.
Assert.AreEqual(HttpStatusCode.NotFound, e.HttpStatusCode);
throw;
}
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetEntireLeagues_BySummoner_Test()
{
var leagues = api.GetEntireLeagues(Region.euw, summonerIds);
Assert.IsNotNull(leagues);
Assert.AreEqual(summonerIds.Distinct().Count() - 4, leagues.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetEntireLeaguesAsync_BySummoner_Test()
{
var leagues = api.GetEntireLeaguesAsync(Region.euw, summonerIds);
Assert.IsNotNull(leagues.Result);
Assert.AreEqual(summonerIds.Distinct().Count() - 4, leagues.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetLeagues_ByTeam_Test()
{
var leagues = api.GetLeagues(Region.euw, teamIds);
Assert.IsNotNull(leagues);
Assert.AreEqual(4, leagues.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetLeaguesAsync_ByTeam_Test()
{
var leagues = api.GetLeaguesAsync(Region.euw, teamIds);
Assert.IsNotNull(leagues.Result);
Assert.AreEqual(4, leagues.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetEntireLeagues_ByTeam_Test()
{
var leagues = api.GetEntireLeagues(Region.euw, teamIds);
Assert.IsNotNull(leagues);
Assert.AreEqual(4, leagues.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetEntireLeaguesAsync_ByTeam_Test()
{
var leagues = api.GetEntireLeaguesAsync(Region.euw, teamIds);
Assert.IsNotNull(leagues.Result);
Assert.AreEqual(4, leagues.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetChallengerLeague_Test()
{
var league = api.GetChallengerLeague(region, Queue.RankedSolo5x5);
Assert.IsNotNull(league.Entries);
Assert.IsTrue(league.Entries.Count > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetChallengerLeagueAsync_Test()
{
var league = api.GetChallengerLeagueAsync(region, Queue.RankedSolo5x5);
Assert.IsNotNull(league.Result.Entries);
Assert.IsTrue(league.Result.Entries.Count > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetMasterLeague_Test()
{
var league = api.GetMasterLeague(region, Queue.RankedSolo5x5);
Assert.IsNotNull(league.Entries);
Assert.IsTrue(league.Entries.Count > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMasterLeagueAsync_Test()
{
var league = api.GetMasterLeagueAsync(region, Queue.RankedSolo5x5);
Assert.IsNotNull(league.Result.Entries);
Assert.IsTrue(league.Result.Entries.Count > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetTeams_Summoners_Test()
{
var teams = api.GetTeams(Region.euw, summonerIds);
Assert.IsNotNull(teams);
Assert.IsTrue(summonerIds.Distinct().Count() / 2 < teams.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetTeamsAsync_Summoners_Test()
{
var teams = api.GetTeamsAsync(Region.euw, summonerIds);
Assert.IsNotNull(teams.Result);
Assert.IsTrue(summonerIds.Distinct().Count() / 2 < teams.Result.Count);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetTeams_Test()
{
var teams = api.GetTeams(Region.euw, teamIds);
Assert.IsNotNull(teams);
Assert.AreEqual(teamIds.Distinct().Count(), teams.Count);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetTeamsAsync_Test()
{
var teams = api.GetTeamsAsync(Region.euw, teamIds);
Assert.IsNotNull(teams.Result);
Assert.AreEqual(teamIds.Distinct().Count(), teams.Result.Count);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatch_WithoutTimeline_Test()
{
var game = api.GetMatch(region, gameId);
Assert.IsNotNull(game);
Assert.IsTrue(game.MatchId == gameId);
Assert.IsNull(game.Timeline);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatch_WithTimeline_Test()
{
var game = api.GetMatch(region, gameId, true);
Assert.IsNotNull(game);
Assert.IsTrue(game.MatchId == gameId);
Assert.IsNotNull(game.Timeline);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchAsync_WithoutTimeline_Test()
{
var game = api.GetMatchAsync(region, gameId);
Assert.IsNotNull(game.Result);
Assert.IsTrue(game.Result.MatchId == gameId);
Assert.IsNull(game.Result.Timeline);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchAsync_WithTimeline_Test()
{
var game = api.GetMatchAsync(region, gameId, true);
Assert.IsNotNull(game.Result);
Assert.IsTrue(game.Result.MatchId == gameId);
Assert.IsNotNull(game.Result.Timeline);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatchList_Test()
{
var matches = api.GetMatchList(region, id).Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatchList_ChampionIds_Test()
{
var matches = api.GetMatchList(region, id, new List<long> { championId }).Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.AreEqual(championId.ToString(), match.ChampionID.ToString());
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatchList_RankedQueues_Test()
{
var matches = api.GetMatchList(region, id, null, new List<Queue> { queue }).Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.AreEqual(queue.ToString(), match.Queue.ToString());
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatchList_Seasons_Test()
{
var matches = api.GetMatchList(region, id, null, null,
new List<RiotSharp.MatchEndpoint.Enums.Season> { season }).Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.AreEqual(season.ToString(), match.Season.ToString());
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatchList_DateTimes_Test()
{
var matches = api.GetMatchList(region, id, null, null, null, beginTime, endTime).Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.IsTrue(DateTime.Compare(match.Timestamp, beginTime) >= 0);
Assert.IsTrue(DateTime.Compare(match.Timestamp, endTime) <= 0);
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi")]
public void GetMatchList_Index_Test()
{
int beginIndex = 0;
int endIndex = 32;
var matches = api.GetMatchList(region, id, null, null, null, null, null, beginIndex, endIndex).Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() <= endIndex - beginIndex);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchListAsync_Test()
{
var matches = api.GetMatchListAsync(region, id).Result.Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchListAsync_ChampionIds_Test()
{
var matches = api.GetMatchListAsync(region, id, new List<long> { championId }).Result.Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.AreEqual(championId.ToString(), match.ChampionID.ToString());
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchListAsync_RankedQueues_Test()
{
var matches = api.GetMatchListAsync(region, id, null, new List<Queue> { queue }).Result.Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.AreEqual(queue.ToString(), match.Queue.ToString());
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchListAsync_Seasons_Test()
{
var matches = api.GetMatchListAsync(region, id, null, null,
new List<RiotSharp.MatchEndpoint.Enums.Season> { season }).Result.Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.AreEqual(season.ToString(), match.Season.ToString());
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchListAsync_DateTimes_Test()
{
var matches = api.GetMatchListAsync(region, id, null, null, null, beginTime, endTime).Result.Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() > 0);
foreach (var match in matches)
{
Assert.IsTrue(DateTime.Compare(match.Timestamp, beginTime) >= 0);
Assert.IsTrue(DateTime.Compare(match.Timestamp, endTime) <= 0);
}
}
[Ignore]
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetMatchListAsync_Index_Test()
{
int beginIndex = 0;
int endIndex = 32;
var matches = api
.GetMatchListAsync(region, id, null, null, null, null, null, beginIndex, endIndex).Result.Matches;
Assert.IsNotNull(matches);
Assert.IsTrue(matches.Count() <= endIndex - beginIndex);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetStatsSummaries_Test()
{
var stats = api.GetStatsSummaries(region, id, RiotSharp.StatsEndpoint.Season.Season3);
Assert.IsNotNull(stats);
Assert.IsTrue(stats.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetStatsSummariesAsync_Test()
{
var stats = api.GetStatsSummariesAsync(region, id, RiotSharp.StatsEndpoint.Season.Season3);
Assert.IsNotNull(stats.Result);
Assert.IsTrue(stats.Result.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetStatsSummaries_CurrentSeason_Test()
{
var stats = api.GetStatsSummaries(region, id);
Assert.IsNotNull(stats);
Assert.IsTrue(stats.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetStatsSummariesAsync_CurrentSeason_Test()
{
var stats = api.GetStatsSummariesAsync(region, id);
Assert.IsNotNull(stats.Result);
Assert.IsTrue(stats.Result.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetStatsRanked_Test()
{
var stats = api.GetStatsRanked(region, id, RiotSharp.StatsEndpoint.Season.Season2015);
Assert.IsNotNull(stats);
Assert.IsTrue(stats.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetStatsRankedAsync_Test()
{
var stats = api.GetStatsRankedAsync(region, id, RiotSharp.StatsEndpoint.Season.Season2015);
Assert.IsNotNull(stats.Result);
Assert.IsTrue(stats.Result.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetStatsRanked_CurrentSeason_Test()
{
var stats = api.GetStatsRanked(region, id);
Assert.IsNotNull(stats);
Assert.IsTrue(stats.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetStatsRankedAsync_CurrentSeason_Test()
{
var stats = api.GetStatsRankedAsync(region, id);
Assert.IsNotNull(stats.Result);
Assert.IsTrue(stats.Result.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetRecentGames_Test()
{
var games = api.GetRecentGames(region, id);
Assert.IsNotNull(games);
Assert.IsTrue(games.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetRecentGamesAsync_Test()
{
var games = api.GetRecentGamesAsync(region, id);
Assert.IsNotNull(games.Result);
Assert.IsTrue(games.Result.Count() > 0);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetFeaturedGames_Test()
{
var games = api.GetFeaturedGames(region);
Assert.IsNotNull(games);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetFeaturedGamesAsync_Test()
{
var games = api.GetFeaturedGamesAsync(region);
Assert.IsNotNull(games.Result);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetChampionMastery_Test()
{
const int lucianId = 236;
var championMastery = api.GetChampionMastery(Platform.NA1, id, lucianId);
Assert.IsNotNull(championMastery);
Assert.AreEqual(id, championMastery.PlayerId);
Assert.AreEqual(lucianId, championMastery.ChampionId);
Assert.AreEqual(6, championMastery.ChampionLevel);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetChampionMasteryAsync_Test()
{
const int lucianId = 236;
var championMastery = api.GetChampionMasteryAsync(Platform.NA1, id, lucianId).Result;
Assert.IsNotNull(championMastery);
Assert.AreEqual(id, championMastery.PlayerId);
Assert.AreEqual(lucianId, championMastery.ChampionId);
Assert.AreEqual(6, championMastery.ChampionLevel);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetAllChampionsMasteryEntries_Test()
{
const long lucianId = 236;
var allChampionsMastery = api.GetChampionMasteries(Platform.NA1, id);
Assert.IsNotNull(allChampionsMastery);
Assert.IsNotNull(allChampionsMastery.Find(championMastery =>
championMastery.ChampionId == lucianId));
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetAllChampionsMasteryEntriesAsync_Test()
{
const long lucianId = 236;
var allChampionsMastery = api.GetChampionMasteriesAsync(Platform.NA1, id).Result;
Assert.IsNotNull(allChampionsMastery);
Assert.IsNotNull(allChampionsMastery.Find(championMastery =>
championMastery.ChampionId == lucianId));
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetTotalChampionMasteryScore_Test()
{
var totalChampionMasteryScore = api.GetTotalChampionMasteryScore(Platform.NA1, id);
Assert.IsTrue(totalChampionMasteryScore > -1);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetTotalChampionMasteryScoreAsync_Test()
{
var totalChampionMasteryScore = api.GetTotalChampionMasteryScoreAsync(Platform.NA1, id).Result;
Assert.IsTrue(totalChampionMasteryScore > -1);
}
[TestMethod]
[TestCategory("RiotApi")]
public void GetTopChampionsMasteryEntries_Test()
{
var threeTopChampions = api.GetTopChampionsMasteries(Platform.NA1, id);
Assert.IsNotNull(threeTopChampions);
Assert.IsTrue(threeTopChampions.Count == 3);
var sixTopChampions = api.GetTopChampionsMasteries(Platform.NA1, id, 6);
Assert.IsNotNull(threeTopChampions);
Assert.IsTrue(sixTopChampions.Count == 6);
}
[TestMethod]
[TestCategory("RiotApi"), TestCategory("Async")]
public void GetTopChampionsMasteryEntriesAsync_Test()
{
var threeTopChampions = api.GetTopChampionsMasteriesAsync(Platform.NA1, id).Result;
Assert.IsNotNull(threeTopChampions);
Assert.IsTrue(threeTopChampions.Count == 3);
var sixTopChampions = api.GetTopChampionsMasteriesAsync(Platform.NA1, id, 6).Result;
Assert.IsNotNull(threeTopChampions);
Assert.IsTrue(sixTopChampions.Count == 6);
}
}
}