Exemple #1
0
        public static PubgSeason GetSeason(PubgRegion region)
        {
            PubgSeason season = null;

            if (region.IsXbox())
            {
                season = StoredItems.OfType <PubgSeason>().FirstOrDefault(p => p.Id.ToLowerInvariant().Contains("xb"));
            }
            else if (region.IsPC())
            {
                season = StoredItems.OfType <PubgSeason>().FirstOrDefault(p => !p.Id.ToLowerInvariant().Contains("xb"));
            }

            if (season != null)
            {
                return(season);
            }

            var seasonService         = new PubgSeasonService(ApiKey);
            List <PubgSeason> seasons = new List <PubgSeason>();

            if (region.IsPC())
            {
                seasons = seasonService.GetSeasonsPC().ToList();
            }
            else if (region.IsXbox())
            {
                seasons = seasonService.GetSeasonsXbox(region).ToList();
            }

            seasons.ForEach(s => StoredItems.Add(s));

            return(seasons.LastOrDefault());
        }
Exemple #2
0
        public void Can_Get_Seasons_OnXbox()
        {
            var seasonsService = new PubgSeasonService(Storage.ApiKey);

            var seasons = seasonsService.GetSeasonsXbox(PubgRegion.XboxEurope);

            Assert.All(seasons, s => s.Id.Should().NotBeNull());
            seasons.Should().ContainSingle(s => s.IsCurrentSeason == true);
        }
Exemple #3
0
        public static PubgSeason GetSeason(PubgRegion region)
        {
            var season = StoredItems.OfType <PubgSeason>().FirstOrDefault();

            if (season != null)
            {
                return(season);
            }

            var seasons = new PubgSeasonService(ApiKey).GetSeasons(region).ToList();

            seasons.ForEach(s => StoredItems.Add(s));

            return(seasons.FirstOrDefault());
        }