Skip to content

Commit b1c50ef

Browse files
committed
Merge pull request #40 from XeeX/dev
Merge from Dev
2 parents 7e1b24a + 81d4cd1 commit b1c50ef

File tree

20 files changed

+72
-74
lines changed

20 files changed

+72
-74
lines changed

LeagueAPI.PCL.Test/LeagueAPIServiceTests.cs

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
using PortableLeagueApi.Game.Extensions;
88
using PortableLeagueApi.Interfaces.Core;
99
using PortableLeagueApi.Interfaces.Enums;
10+
using PortableLeagueApi.Interfaces.Game;
1011
using PortableLeagueApi.Interfaces.League;
1112
using PortableLeagueApi.Interfaces.Stats;
13+
using PortableLeagueApi.Interfaces.Summoner;
1214
using PortableLeagueApi.League.Extensions;
1315
using PortableLeagueApi.Static.Extensions;
1416
using 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
}

LeagueAPI.PCL.Test/Responses/Stats/BySummonerSummary.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"wins": 1689
115115
},
116116
{
117-
"playerStatSummaryType": "Unranked3x3",
117+
"playerStatSummaryType": "URFBots",
118118
"aggregatedStats": {
119119
"totalNeutralMinionsKilled": 263,
120120
"totalMinionKills": 1702,

LeagueAPI.PCL/PortableLeagueAPI.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
<tags>league of legends API PCL portable Riot Games LeagueOfLegends RiotDeveloperProgram LeagueOfLegendsApi LoL LoLApi LolDeveloper "League Of Legends" Remake</tags>
2323
<dependencies>
2424
<group targetFramework="portable-net45+wp80+win8+wpa81">
25-
<dependency id="Remake.PortableLeagueAPI.Core" version="2.2.0" />
25+
<dependency id="Remake.PortableLeagueAPI.Core" version="2.2.1" />
2626
<dependency id="Remake.PortableLeagueAPI.Team" version="2.3.1" />
2727
<dependency id="Remake.PortableLeagueAPI.League" version="2.4.1" />
2828
<dependency id="Remake.PortableLeagueAPI.Summoner" version="1.4.3" />
2929
<dependency id="Remake.PortableLeagueAPI.Game" version="1.3.9" />
3030
<dependency id="Remake.PortableLeagueAPI.Champion" version="1.2.3" />
3131
<dependency id="Remake.PortableLeagueAPI.Stats" version="1.3.3" />
32-
<dependency id="Remake.PortableLeagueAPI.Static" version="1.3.0" />
33-
<dependency id="Remake.PortableLeagueAPI.Interfaces" version="1.2.0" />
32+
<dependency id="Remake.PortableLeagueAPI.Static" version="1.3.1" />
33+
<dependency id="Remake.PortableLeagueAPI.Interfaces" version="1.2.1" />
3434
</group>
3535
</dependencies>
3636
</metadata>

LeagueAPI.PCL/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
//
2424
// You can specify all the values or you can default the Build and Revision Numbers
2525
// by using the '*' as shown below:
26-
[assembly: AssemblyVersion("2.1.0")]
26+
[assembly: AssemblyVersion("2.1.1")]
2727
[assembly: AssemblyFileVersion("1.0.0.0")]

PortableLeagueAPI.Champion/PortableLeagueAPI.Champion.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
<tags>"Portable League API Champion"</tags>
1818
<dependencies>
1919
<group targetFramework="portable-net45+wp80+win8+wpa81">
20-
<dependency id="Remake.PortableLeagueAPI.Interfaces" version="1.2.0" />
20+
<dependency id="Remake.PortableLeagueAPI.Interfaces" version="1.2.1" />
2121
<dependency id="Newtonsoft.Json" version="6.0.3" />
2222
<dependency id="AutoMapper" version="3.2.1" />
23-
<dependency id="Remake.PortableLeagueAPI.Core" version="2.2.0" />
23+
<dependency id="Remake.PortableLeagueAPI.Core" version="2.2.1" />
2424
</group>
2525
</dependencies>
2626
</metadata>

PortableLeagueApi.Core/Constants/PlayerStatsSummaryTypeConsts.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ public class PlayerStatsSummaryTypeConsts
1414
public const string RankedSolo5X5 = "RankedSolo5x5";
1515
public const string RankedTeam3X3 = "RankedTeam3x3";
1616
public const string RankedTeam5X5 = "RankedTeam5x5";
17+
public const string RankedPremade3X3 = "RankedPremade3x3";
18+
public const string RankedPremade5X5 = "RankedPremade5x5";
1719
public const string OneForAll5X5 = "OneForAll5x5";
1820
public const string FirstBlood1X1 = "FirstBlood1x1";
1921
public const string FirstBlood2X2 = "FirstBlood2x2";
2022
public const string SummonersRift6X6 = "SummonersRift6x6";
2123
public const string CAP5X5 = "CAP5x5";
2224
public const string Urf = "URF";
23-
public const string UrfBot = "URF_BOT";
25+
public const string UrfBot = "URFBots";
2426

2527
public static readonly Dictionary<PlayerStatSummaryTypeEnum, string> PlayerStatsSummaryTypes = new Dictionary<PlayerStatSummaryTypeEnum, string>
2628
{
@@ -33,6 +35,8 @@ public class PlayerStatsSummaryTypeConsts
3335
{ PlayerStatSummaryTypeEnum.RankedSolo5X5, RankedSolo5X5 },
3436
{ PlayerStatSummaryTypeEnum.RankedTeam3X3, RankedTeam3X3 },
3537
{ PlayerStatSummaryTypeEnum.RankedTeam5X5, RankedTeam5X5 },
38+
{ PlayerStatSummaryTypeEnum.RankedPremade3X3, RankedPremade3X3 },
39+
{ PlayerStatSummaryTypeEnum.RankedPremade5X5, RankedPremade5X5 },
3640
{ PlayerStatSummaryTypeEnum.OneForAll5X5, OneForAll5X5 },
3741
{ PlayerStatSummaryTypeEnum.FirstBlood1X1, FirstBlood1X1 },
3842
{ PlayerStatSummaryTypeEnum.FirstBlood2X2, FirstBlood2X2 },

PortableLeagueApi.Core/Constants/RegionConsts.cs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,5 @@ internal class RegionConsts
2929
{ RegionEnum.Ru, Ru },
3030
{ RegionEnum.Tr, Tr }
3131
};
32-
33-
public const string SubDomainProd = "prod";
34-
public const string SubDomainEu = "eu";
35-
public const string SubDomainKr = "kr";
36-
37-
internal static readonly Dictionary<RegionEnum, string> SubDomains = new Dictionary<RegionEnum, string>
38-
{
39-
{ RegionEnum.Br, SubDomainProd },
40-
{ RegionEnum.Eune, SubDomainProd },
41-
{ RegionEnum.Euw, SubDomainProd },
42-
{ RegionEnum.Kr, SubDomainKr },
43-
{ RegionEnum.Lan, SubDomainProd },
44-
{ RegionEnum.Las, SubDomainProd },
45-
{ RegionEnum.Na, SubDomainProd },
46-
{ RegionEnum.Oce, SubDomainProd },
47-
{ RegionEnum.Ru, SubDomainEu },
48-
{ RegionEnum.Tr, SubDomainEu }
49-
};
5032
}
5133
}

PortableLeagueApi.Core/PortableLeagueApi.Core.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<group targetFramework="portable-net45+wp80+win8+wpa81">
2020
<dependency id="Newtonsoft.Json" version="6.0.3" />
2121
<dependency id="AutoMapper" version="3.2.1" />
22-
<dependency id="Remake.PortableLeagueAPI.Interfaces" version="1.2.0" />
22+
<dependency id="Remake.PortableLeagueAPI.Interfaces" version="1.2.1" />
2323
</group>
2424
</dependencies>
2525
</metadata>

PortableLeagueApi.Core/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
//
2424
// You can specify all the values or you can default the Build and Revision Numbers
2525
// by using the '*' as shown below:
26-
[assembly: AssemblyVersion("2.2.0")]
26+
[assembly: AssemblyVersion("2.2.1")]
2727
[assembly: AssemblyFileVersion("1.0.0.0")]

PortableLeagueApi.Core/Services/BaseService.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ protected virtual Uri BuildUri(RegionEnum? region, string relativeUrl)
7575
return BuildUri(new Uri(relativeUrl, UriKind.Relative), region);
7676
}
7777

78-
protected Uri BuildUri(Uri relativeUri, RegionEnum? region)
78+
protected Uri BuildUri(Uri relativeUri, RegionEnum? region, string endpoint = null)
7979
{
80-
var baseUri = new Uri(string.Format(BaseUrl, GetSubDomain(region)));
80+
var baseUri = new Uri(string.Format(BaseUrl, endpoint ?? GetRegionAsString(region)));
8181

8282
var uriBuilder = new UriBuilder(new Uri(baseUri, relativeUri));
8383

@@ -223,11 +223,6 @@ protected string GetRegionAsString(RegionEnum? region)
223223
return RegionConsts.Regions[GetRegion(region)];
224224
}
225225

226-
private string GetSubDomain(RegionEnum? region)
227-
{
228-
return RegionConsts.SubDomains[GetRegion(region)];
229-
}
230-
231226
public void Dispose()
232227
{
233228
Dispose(true);

0 commit comments

Comments
 (0)