public void GetPlayerStats() { if (CurrentSeasionLastUpdate == null || CurrentSeasionLastUpdate.Value <= DateTime.Now.AddMinutes(-10)) { var playerSeason = playerService.GetPlayerSeason(PubgPlatform.Steam, Id, SeasonStats.CurrentSeasonID, Credentials.PubgToken); SoloStats = new SeasonStats(); SoloStats.Clone(playerSeason.GameModeStats.SoloFPP); DuoStats = new SeasonStats(); DuoStats.Clone(playerSeason.GameModeStats.DuoFPP); SquadStats = new SeasonStats(); SquadStats.Clone(playerSeason.GameModeStats.SquadFPP); CurrentSeasionLastUpdate = DateTime.Now; var playerFound = playerService.GetPlayer(PubgPlatform.Steam, Id, Credentials.PubgToken); GetMatches(playerFound); Save(); } }
public void Can_Get_Season_For_Player() { var playerService = new PubgPlayerService(Storage.ApiKey); var region = PubgRegion.PCEurope; var playerId = Storage.GetMatch(region).Rosters.SelectMany(r => r.Participants).Select(p => p.Stats.PlayerId).FirstOrDefault(); var seasonId = Storage.GetSeason(region).Id; var playerSeason = playerService.GetPlayerSeason(region, playerId, seasonId); playerSeason.Should().NotBeNull(); playerSeason.GameModeStats.Should().NotBeNull(); playerSeason.SeasonId.Should().NotBeNullOrWhiteSpace(); playerSeason.PlayerId.Should().NotBeNullOrWhiteSpace(); playerSeason.GameModeStats.Should().NotBeNull(); playerSeason.GameModeStats.Solo.Should().NotBeNull(); playerSeason.GameModeStats.SoloFPP.Should().NotBeNull(); playerSeason.GameModeStats.Duo.Should().NotBeNull(); playerSeason.GameModeStats.DuoFPP.Should().NotBeNull(); playerSeason.GameModeStats.Squad.Should().NotBeNull(); playerSeason.GameModeStats.SquadFPP.Should().NotBeNull(); }