public async Task ClearCacheWipesAllCachedData()
        {
            // assemble
            PokeApiClient sut   = CreateSut();
            Berry         berry = new Berry {
                Name = "test", Id = 1
            };

            mockHttp.Expect($"*berry/{berry.Id}*")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeNamedResourceList <Berry>()));
            mockHttp.Expect("*berry")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeNamedResourceList <Berry>()));
            mockHttp.Expect($"*berry/{berry.Id}*")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeNamedResourceList <Berry>()));
            mockHttp.Expect("*berry")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeNamedResourceList <Berry>()));

            // act
            await sut.GetResourceAsync <Berry>(berry.Id);

            await sut.GetNamedResourcePageAsync <Berry>();

            sut.ClearCache();
            await sut.GetResourceAsync <Berry>(berry.Id);

            await sut.GetNamedResourcePageAsync <Berry>();

            // assert
            mockHttp.VerifyNoOutstandingExpectation();
        }
Example #2
0
        /// <summary>
        ///Given a Pokemon name,returns the description
        /// </summary>
        /// <param name="pokemonName"></param>
        /// <returns>
        /// Returns the description of the Pokemon if exists;<br/>
        /// Empty string if the pokemon does not exist;<br/>
        /// Null if something goes wrong;
        /// </returns>
        public async Task <string> FindDescriptionByNameAsync(string pokemonName)
        {
            PokeApiClient pokeClient   = new PokeApiClient();
            var           descriprtion = string.Empty;

            try
            {
                /*to avoid error 404 Pokemon not found ,i have preloaded all the pokemon'names
                 * and i chek in my HashSet before.
                 */
                if (_pokemonIndex.Contains(pokemonName))

                {
                    Pokemon pokemon = await pokeClient.GetResourceAsync <Pokemon>(pokemonName);

                    Ability ability = await pokeClient.GetResourceAsync <Ability>(pokemon.Abilities[0].Ability.Name);

                    descriprtion = ability.EffectEntries.FirstOrDefault(e => e.Language.Name == "en").Effect;
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);

                return(null);
            }



            return(descriprtion);
        }
        public async Task UrlNavigationResolveAsyncSingle()
        {
            // assemble
            Pokemon responsePikachu = new Pokemon
            {
                Name    = "pikachu",
                Id      = 25,
                Species = new NamedApiResource <PokemonSpecies>
                {
                    Name = "pikachu",
                    Url  = "https://pokeapi.co/api/v2/pokemon-species/25/"
                }
            };
            PokemonSpecies responseSpecies = new PokemonSpecies {
                Name = "pikachu"
            };

            MockHttpMessageHandler mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect("*pokemon/pikachu/").Respond("application/json", JsonConvert.SerializeObject(responsePikachu));
            mockHttp.Expect("*pokemon-species/25/").Respond("application/json", JsonConvert.SerializeObject(responseSpecies));
            PokeApiClient client = new PokeApiClient(mockHttp);

            Pokemon pikachu = await client.GetResourceAsync <Pokemon>("pikachu");

            // act
            PokemonSpecies species = await client.GetResourceAsync(pikachu.Species);

            // assert
            mockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task UrlNavigationCancellationAsyncSingle()
        {
            // assemble
            Pokemon responsePikachu = new Pokemon
            {
                Name    = "pikachu",
                Id      = 25,
                Species = new NamedApiResource <PokemonSpecies>
                {
                    Name = "pikachu",
                    Url  = "https://pokeapi.co/api/v2/pokemon-species/25/"
                }
            };
            PokemonSpecies responseSpecies = new PokemonSpecies {
                Name = "pikachu"
            };

            MockHttpMessageHandler mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect("*pokemon/pikachu/").Respond("application/json", JsonConvert.SerializeObject(responsePikachu));
            mockHttp.Expect("*pokemon-species/25/").Respond("application/json", JsonConvert.SerializeObject(responseSpecies));
            PokeApiClient client = new PokeApiClient(mockHttp);

            Pokemon pikachu = await client.GetResourceAsync <Pokemon>("pikachu");

            CancellationToken cancellationToken = new CancellationToken(true);

            // act / assemble
            await Assert.ThrowsAsync <OperationCanceledException>(async() => { await client.GetResourceAsync(pikachu.Species, cancellationToken); });
        }
Example #5
0
        }//End Instance()

        //Calculate -: takes in the name of a pokemon and calculates the type strengths/weaknesses.
        public async void Calculate(string pokemonname)
        {
            Pokemon pokemon;

            //Check Cache: if it's not there, pull data and store in cache.
            if (!Cache_PokemonNameToObj.TryGetValue(pokemonname, out pokemon))
            {
                try { pokemon = await PAC.GetResourceAsync <Pokemon>(pokemonname); }
                catch (Exception) { Console.WriteLine("Invalid Pokemon Name or Command!"); return; }
                Cache_PokemonNameToObj.Add(pokemonname, pokemon);
            }

            Output_PokemonData(pokemon.Name, pokemon.Types);

            //Pokemon can be multiple types i.e.: Flying/Normal
            for (int t_iter = 0; t_iter < pokemon.Types.Count; t_iter++)
            {
                PokemonType     t_type = pokemon.Types[t_iter];
                PokeApiNet.Type type;

                //Check Cache: if it's not there, pull data and store in cache.
                if (!Cache_PokemonTypeToTypeObj.TryGetValue(t_type.Type.Name, out type))
                {
                    type = await PAC.GetResourceAsync <PokeApiNet.Type>(t_type.Type.Name);

                    Cache_PokemonTypeToTypeObj.Add(t_type.Type.Name, type);
                }

                Output_TypeVsTypeData(type, t_iter, (t_iter == (pokemon.Types.Count - 1)));
            } //End foreach
        }     //End Calculate()
        public async Task ClearResourceCacheOfAllTypes()
        {
            // assemble
            Berry berry = new Berry {
                Name = "test", Id = 1
            };
            Machine machine = new Machine {
                Id = 1
            };
            PokeApiClient sut = CreateSut();

            mockHttp.Expect("*machine*")
            .Respond("application/json", JsonConvert.SerializeObject(machine));
            mockHttp.Expect("*berry*")
            .Respond("application/json", JsonConvert.SerializeObject(berry));
            mockHttp.Expect("*machine*")
            .Respond("application/json", JsonConvert.SerializeObject(machine));
            mockHttp.Expect("*berry*")
            .Respond("application/json", JsonConvert.SerializeObject(berry));

            // act
            await sut.GetResourceAsync <Machine>(machine.Id);

            await sut.GetResourceAsync <Berry>(berry.Id);

            sut.ClearResourceCache();
            await sut.GetResourceAsync <Machine>(machine.Id);

            await sut.GetResourceAsync <Berry>(berry.Id);

            // assert
            mockHttp.VerifyNoOutstandingExpectation();
        }
        /// <summary>
        /// Fetch the formatted name of the pokemon being queried
        /// </summary>
        /// <param name="client">The PokeAPI client currently in use</param>
        /// <param name="pokemonName">The name of the pokemon as a search term submitted by the end user</param>
        /// <returns></returns>
        private async Task <string> GetFormattedEnglishPokemonNameAsync(PokeApiClient client, string pokemonName)
        {
            var pokemonApiObject = await client.GetResourceAsync <Pokemon>(pokemonName);

            var pokemonSpeciesObject = await client.GetResourceAsync(pokemonApiObject.Species);

            var englishName = pokemonSpeciesObject.Names.Where(x => x.Language.Name == "en").Select(y => y.Name).Single();

            return(englishName);
        }
        /// <summary>
        /// Retrieve a collection of every pokedex entry for the specified pokemon
        /// //specifically in english\\ from the PokeAPI endpoint
        /// </summary>
        /// <param name="client">The PokeAPI client currently in use</param>
        /// <param name="pokemonName">This method will get all the english pokedex entries for this pokemon</param>
        /// <returns>A list of <see cref="PokemonSpeciesFlavorTexts"/> wrapped in a task</returns>
        private async Task <List <PokemonSpeciesFlavorTexts> > GetAllEnglishPokedexEntriesAsync(PokeApiClient client, string pokemonName)
        {
            // TODO: if the pokemonName property isn't a valid pokemon (misspelled or nonexistent), an exception gets swallowed here
            var pokemonApiObject = await client.GetResourceAsync <Pokemon>(pokemonName);

            var pokemonSpeciesApiObject = await client.GetResourceAsync(pokemonApiObject.Species);

            var allFlavorTextEnglish = pokemonSpeciesApiObject.FlavorTextEntries.Where(fte => fte.Language.Name == "en").ToList();

            return(allFlavorTextEnglish);
        }
Example #9
0
        public async Task GetPokemonSpeciesResolveAllAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient  client         = new PokeApiClient();
            PokemonSpecies pokemonSpecies = await client.GetResourceAsync <PokemonSpecies>(1);

            // act
            List <EggGroup> eggGroups = await client.GetResourceAsync(pokemonSpecies.EggGroups);

            // assert
            Assert.True(eggGroups.Any());
        }
        private async void LoadPokemonEvolutions()
        {
            PokemonSpecies pokemonSpecies = await pokeClient.GetResourceAsync <PokemonSpecies>(SelectedPokemon.Id);

            SetEvolutionId(pokemonSpecies);
            LoadPokemonEvoInfos();
        }
Example #11
0
        private async void setup(string pPokenName)
        {
            PokeApiClient pokeClient = new PokeApiClient();
            Pokemon       pokemon    = await pokeClient.GetResourceAsync <Pokemon>(pPokenName);

            PokemonSpecies species = await pokeClient.GetResourceAsync(pokemon.Species);

            List <Item> lstItens = await pokeClient.GetResourceAsync(pokemon.HeldItems.Select(item => item.Item));

            List <Ability> lstHabilidade = await pokeClient.GetResourceAsync(pokemon.Abilities.Select(item => item.Ability));


            StringBuilder bldrItens = new StringBuilder();

            if (lstItens.Count > 0)
            {
                foreach (Item item in lstItens)
                {
                    bldrItens.Append(item.Name).Append(", ");
                }

                bldrItens.Remove(bldrItens.Length - 2, 2);
            }
            else
            {
                bldrItens.Append("N/A");
            }

            StringBuilder bldrHabilidades = new StringBuilder();

            if (lstHabilidade.Count > 0)
            {
                foreach (Ability habilidade in lstHabilidade)
                {
                    bldrHabilidades.Append(habilidade.Name).Append(", ");
                }

                bldrHabilidades.Remove(bldrHabilidades.Length - 2, 2);
            }
            else
            {
                bldrHabilidades.Append("N/A");
            }

            setImages(pokemon.Sprites);
            poke_habitat.Text        = species.Habitat.Name.ToUpper();
            poke_baseExp.Text        = pokemon.BaseExperience.ToString();
            poke_lstHabilidades.Text = bldrHabilidades.ToString().ToUpper();
            poke_lstItens.Text       = bldrItens.ToString().ToUpper();
        }
        private async void LoadPokemonDescription()
        {
            Pokemon pokemonInfo = await pokeClient.GetResourceAsync <Pokemon>(SelectedPokemon.PokeNameOriginal);

            LoadPokemonFlavorText();

            LoadStatLanguages();

            LoadStatValues(pokemonInfo);

            LoadAbilityFlavorText(pokemonInfo);
        }
        public async Task <PokemonData> GetPokemon(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("Invalid name", name);
            }

            PokemonSpecies species = null;

            try
            {
                species = await _pokeApiClient.GetResourceAsync <PokemonSpecies>(name);
            }
            catch (HttpRequestException)
            {
            }

            if (species == null)
            {
                return(null);
            }

            var description = species.FlavorTextEntries
                              .Where(entry => entry.Language.Name == "en")
                              .Select(s => Regex.Replace(s.FlavorText, @"\t|\n|\r|\f", " "))
                              .FirstOrDefault();

            var pokemonData = new PokemonData()
            {
                Name        = species.Name,
                Description = description
            };

            return(pokemonData);
        }
        // method to load PokemonList from the internet over API
        private async Task LoadFromApi()
        {
            // MAX limit currently: 807
            int maxPokemons = 807;

            NamedApiResourceList <Pokemon> allPokemons = await pokeClient.GetNamedResourcePageAsync <Pokemon>(maxPokemons, 0);

            for (int i = 1; i <= allPokemons.Results.Count; i++)
            {
                PokemonSpecies pokemonNameLang = await pokeClient.GetResourceAsync <PokemonSpecies>(i);

                for (int j = 0; j < pokemonNameLang.Names.Count; j++)
                {
                    if (pokemonNameLang.Names[j].Language.Name == Language)
                    {
                        PokeList.Add(new PokemonModel
                        {
                            Id = i,
                            PokeNameOriginal = allPokemons.Results[i - 1].Name,
                            PokeName         = pokemonNameLang.Names[j].Name,
                            PokeUrl          = allPokemons.Results[i - 1].Url
                        });
                        SearchPokeList.Add(new PokemonModel
                        {
                            Id = i,
                            PokeNameOriginal = allPokemons.Results[i - 1].Name,
                            PokeName         = pokemonNameLang.Names[j].Name,
                            PokeUrl          = allPokemons.Results[i - 1].Url
                        });
                    }
                }
                // Brings loading status to front-end in ProgressBar
                await _events.PublishOnUIThreadAsync(new LoadingBarEvent { LoadingCount = i }, CancellationToken.None);
            }
        }
Example #15
0
        internal static async void ShinySpawnPokemon(SocketGuild guild, SocketTextChannel channel, string PokemonName)
        {
            PokeApiClient pokeClient = new PokeApiClient();
            Pokemon       poke       = await pokeClient.GetResourceAsync <Pokemon>(PokemonName);

            Spawned spawn = new Spawned()
            {
                channel = channel.Id,
                name    = poke.Name,
                shiny   = true
            };
            string result = JsonConvert.SerializeObject(spawn);

            Console.WriteLine(result);
            File.WriteAllText(@"Resources/Spawned.json", result);
            Console.WriteLine("Stored!");

            result = String.Empty;
            result = File.ReadAllText(@"Resources/Spawned.json");
            Spawned resultSpawn = JsonConvert.DeserializeObject <Spawned>(result);

            Console.WriteLine(resultSpawn.ToString());

            Console.WriteLine($"{poke.Name}");
            var embed = new EmbedBuilder();

            embed.WithTitle("A wild pokemon has appeared!");
            embed.WithDescription("Guess the pokemon and type p.catch <pokemon> to catch it");
            embed.WithImageUrl($"https://play.pokemonshowdown.com/sprites/xyani-shiny/" + spawn.name + ".gif");


            await channel.SendMessageAsync("", embed : embed.Build());
        }
Example #16
0
        public async Task PokeDex([Remainder] string name)
        {
            PokeApiClient pokeClient = new PokeApiClient();
            Pokemon       poke       = await pokeClient.GetResourceAsync <Pokemon>(name);


            EmbedBuilder embed = new EmbedBuilder();

            embed.WithTitle($"Data On {name}");
            if (poke.Types.Count == 2)
            {
                embed.WithDescription($"Type: {poke.Types[0].Type.Name} | {poke.Types[1].Type.Name}\n" +
                                      $"**HP:** {poke.Stats[0].BaseStat}\n" +
                                      $"**Attack:** {poke.Stats[1].BaseStat}\n" +
                                      $"**Defense:** {poke.Stats[2].BaseStat}\n" +
                                      $"**Sp.Atk:** {poke.Stats[3].BaseStat}\n" +
                                      $"**Sp.Def:** {poke.Stats[4].BaseStat}\n" +
                                      $"**Speed:** {poke.Stats[5].BaseStat}\n");
            }
            else
            {
                embed.WithDescription($"Type: {poke.Types[0].Type.Name}\n" +
                                      $"**HP:** {poke.Stats[0].BaseStat}\n" +
                                      $"**Attack:** {poke.Stats[1].BaseStat}\n" +
                                      $"**Defense:** {poke.Stats[2].BaseStat}\n" +
                                      $"**Sp.Atk:** {poke.Stats[3].BaseStat}\n" +
                                      $"**Sp.Def:** {poke.Stats[4].BaseStat}\n" +
                                      $"**Speed:** {poke.Stats[5].BaseStat}\n");
            }
            embed.WithImageUrl(poke.Sprites.FrontDefault);
            await Context.Channel.SendMessageAsync("", embed : embed.Build());
        }
        /// <summary>
        /// Fetches the formatted name of the version from which the pokedex entry game
        /// to display to the user, i.e., instead of "alpha-sapphire", returns "Alpha Sapphire"
        /// </summary>
        /// <param name="client">The PokeAPI client currently in use</param>
        /// <param name="flavorText">The pokedex entry selected in the body of <see cref="GetPokedexEntryAsyncFor(string)"/></param>
        /// <returns></returns>
        private async Task <string> GetFormattedGameVersionNameInEnglishAsync(PokeApiClient client, PokemonSpeciesFlavorTexts flavorText)
        {
            // In order to get the properly formatted name from the API, we need to get the Version object from the resource
            var flavorTextVersion = await client.GetResourceAsync(flavorText.Version);

            return(flavorTextVersion.Names.Where(x => x.Language.Name == "en").SingleOrDefault().Name);
        }
Example #18
0
        public async void setup(string pokeName)
        {
            if (pokeName != "")
            {
                //RootObject pokemon = await PokeApi.getDadosPokemon(formPoke.url);
                PokeApiClient pokeClient = new PokeApiClient();
                Pokemon       pokemon    = await pokeClient.GetResourceAsync <Pokemon>(pokeName);

                this.idPoke        = pokemon.Id;
                poke_imagem.Source = pokemon.Sprites.FrontDefault; //ImageSource.FromUri(new Uri(pokemon.sprites.front_default));
                poke_name.Text     = pokemon.Name.ToUpper();
                poke_weight.Text   = pokemon.Weight.ToString();
                poke_height.Text   = pokemon.Height.ToString();

                StringBuilder types = new StringBuilder();
                if (pokemon.Types != null)
                {
                    foreach (var item in pokemon.Types)
                    {
                        types.Append(item.Type.Name).Append(" - ");
                    }
                    types.Remove(types.Length - 3, 3);
                }
                else
                {
                    types.Append("-");
                }

                poke_types.Text = types.ToString().ToUpper();
            }
        }
Example #19
0
        /// <summary>
        /// Checks for the Name of the Pokemon in the list of pokemons
        /// Searchs for the full data of a Pokemon
        /// </summary>
        /// <param name="name"></param>
        /// <returns>PokeApi.Pokemon or Null</returns>
        public async Task <Pokemon> GetPokemon(string name)
        {
            if (lPokemon is null)
            {
                await SetPokemonList();
            }
            var pokemon = lPokemon.FirstOrDefault(c => c.Name == name);

            if (pokemon is null)
            {
                return(null);
            }

            return(await pokeClient.GetResourceAsync <Pokemon>(
                       pokemon));
        }
Example #20
0
        // GET: UserDraftPicks/Details/5
        public async Task <ActionResult> Details(int?draftId, string userId)
        {
            if (draftId == null || userId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var userDraftPicks = db.UserDraftPicks.Where(dp => dp.DraftId == draftId && dp.UserId == userId).Select(dp => dp.PokemonLocalId).ToList();
            var tieredPokemon  = db.vw_PokemonTiered.Where(p => userDraftPicks.Any(dp => dp == p.PokemonLocalId)).ToList();

            // *** ***

            PokeApiClient pokeClient = new PokeApiClient();
            var           pokemon    = new List <Pokemon>();

            foreach (var item in tieredPokemon)
            {
                Pokemon poke = await pokeClient.GetResourceAsync <Pokemon>(item.PokemonName);

                pokemon.Add(poke);
            }

            var currentPlayer = db.AspNetUsers.Find(userId);

            var viewModel = new UserDraftPickDetailsViewModel()
            {
                PokemonTiered = tieredPokemon,
                Pokemons      = pokemon,
                BattleTag     = currentPlayer.BattleTag,
            };

            return(View(viewModel));
        }
        // GET: Pokemons
        public async Task <ActionResult> Details(string name)
        {
            PokeApiClient pokeClient = new PokeApiClient();

            Pokemon hoOh = await pokeClient.GetResourceAsync <Pokemon>(name);

            return(View(hoOh));
        }
        public async Task <PokeSpriteData> GetPokemonData(string pkmnName)
        {
            PokeApiClient _pokeApiClient = new PokeApiClient();

            Pokemon pkmn = await _pokeApiClient.GetResourceAsync <Pokemon>(pkmnName);

            Pokedex dexInfo = await _pokeApiClient.GetResourceAsync <Pokedex>(pkmn.Id);

            return(new PokeSpriteData
            {
                DexEntry = pkmn.Id,
                Name = pkmn.Name,
                PkmnSprite = pkmn.Sprites.FrontDefault,
                PkmnShinySprite = pkmn.Sprites.FrontShiny,
                PokemonDescription = dexInfo.Descriptions,
            });
        }
Example #23
0
        // Gets a mon's id, name and sprite URL
        public static async Task <(int, string, string)> GetMonInfo(string nameOrId)
        {
            PokeApiClient pokeClient = new PokeApiClient();

            int      id;
            string   name;
            string   spriteUrl = null;
            TextInfo textInfo  = new CultureInfo("en-US", false).TextInfo;

            Pokemon mon;

            if (int.TryParse(nameOrId, out id))
            {
                mon = await pokeClient.GetResourceAsync <Pokemon>(id);
            }
            else
            {
                name = nameOrId.ToLower();
                if (GetEggs().ContainsKey(name))
                {
                    (id, spriteUrl) = GetEggs()[name];
                    return(id, textInfo.ToTitleCase(name), spriteUrl);
                }
                else
                {
                    name = GetCorrectName(name);
                    mon  = await pokeClient.GetResourceAsync <Pokemon>(name);
                }
            }

            try {
                string   url        = mon.Forms[0].Url;
                string[] urlSplit   = url.Split('/');
                int      formNumber = int.Parse(urlSplit[urlSplit.Length - 2]);

                PokemonForm form = await pokeClient.GetResourceAsync <PokemonForm>(formNumber);

                spriteUrl = form.Sprites.FrontDefault;
            }
            catch (Exception e) {
                // Do not error on missing sprite
            }

            return(mon.Id, textInfo.ToTitleCase(mon.Name), spriteUrl);
        }
Example #24
0
        /// <summary>
        /// Create and send a full list of Pokemon.
        /// </summary>
        /// <param name="type">If playing in hard mode, a type will be specified. Defaults to -1 (easy mode).</param>
        /// <returns>List of Pokemon</returns>
        public async Task <IEnumerable <(Pokemon, PokemonSpecies)> > CreateList(int type = -1)
        {
            List <NamedApiResource <Pokemon> > allPokemonList;

            // If in hard mode, all pokemon should be of the specified type
            if (type != -1)
            {
                var typed = await pokeClient.GetResourceAsync <PokeApiNet.Type>(type);

                allPokemonList = typed.Pokemon.Select(pokemons => pokemons.Pokemon).ToList();
            }
            // Otherwise, populate using all Pokemon
            else
            {
                allPokemonList = (await pokeClient.GetNamedResourcePageAsync <Pokemon>(Int32.MaxValue, 0)).Results;
            }

            var usedPokemon = PickPokemon(allPokemonList.Count, 25);
            var stopwatch   = new Stopwatch();

            stopwatch.Start();
            var pokemonTasks = usedPokemon.Select(async(i) =>
            {
                var newPoke = await pokeClient.GetResourceAsync <Pokemon>(allPokemonList[i]);
                while (newPoke.Sprites.FrontDefault is null)
                {
                    int newIndex;
                    do
                    {
                        newIndex = random.Next(0, allPokemonList.Count - 1);
                    }while (usedPokemon.Contains(newIndex));
                    newPoke = await pokeClient.GetResourceAsync <Pokemon>(allPokemonList[newIndex]);
                }
                var newPokeSpecies = await pokeClient.GetResourceAsync <PokemonSpecies>(newPoke.Species);
                logger.LogInformation($"Pokemon '{newPoke.Name}' added to board.");
                return(newPoke, newPokeSpecies);
            });

            var pokemon = await Task.WhenAll(pokemonTasks);

            stopwatch.Stop();
            logger.LogInformation($"Fetching took {stopwatch.Elapsed}");
            return(pokemon);
        }
Example #25
0
        public async Task GetSuperContestEffectResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            SuperContestEffect superContestEffect = await client.GetResourceAsync <SuperContestEffect>(1);

            // assert
            Assert.True(superContestEffect.Id != default(int));
        }
Example #26
0
        public async Task GetContestTypeResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            ContestType contestType = await client.GetResourceAsync <ContestType>(1);

            // assert
            Assert.True(contestType.Id != default(int));
        }
Example #27
0
        public async Task GetTypeResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            PokeApiNet.Models.Type type = await client.GetResourceAsync <PokeApiNet.Models.Type>(1);

            // assert
            Assert.True(type.Id != default(int));
        }
Example #28
0
        public async Task GetStatResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            Stat stat = await client.GetResourceAsync <Stat>(1);

            // assert
            Assert.True(stat.Id != default(int));
        }
Example #29
0
        public async Task GetPokemonSpeciesResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            PokemonSpecies pokemonSpecies = await client.GetResourceAsync <PokemonSpecies>(1);

            // assert
            Assert.True(pokemonSpecies.Id != default(int));
        }
Example #30
0
        public async Task GetLanguageResourceAsyncIntegrationTest()
        {
            // assemble
            PokeApiClient client = new PokeApiClient();

            // act
            Language language = await client.GetResourceAsync <Language>(1);

            // assert
            Assert.True(language.Id != default(int));
        }