public async Task <PokemonPreviewModel[]> GetPokedex() { List <PokemonPreviewModel> pokedexPreviewModels = _cache.Get("pokemonPreviewModel") as List <PokemonPreviewModel>; if (pokedexPreviewModels == null) { Pokedex pokedex = await Pokedex.GetInstanceAsync(); pokedexPreviewModels = new List <PokemonPreviewModel>(); foreach (var pokemonModel in pokedex.Pokemon) { if (pokemonModel.Value.Id >= 152) { break; } pokedexPreviewModels.Add(new PokemonPreviewModel() { Id = pokemonModel.Value.Id, ResourceUri = pokemonModel.Value.ResourceUri.AbsoluteUri, ImageUrl = PokemonImageUrl(pokemonModel.Value.Id), Name = pokemonModel.Value.Name }); } _cache.Set("pokemonPreviewModel", pokedex, 60); } return(pokedexPreviewModels.ToArray()); }
public async Task GetPokedexInstanceByIdDeserializeAllProperties() { DataFetcher.SetHttpClient(FakeHttpClientAdapter.Singleton); var pokedex = await Pokedex.GetInstanceAsync(); pokedex.AssertResourceWellConfigured(); }
public void GetPokedex() { var pokedex = AsyncHelpers.RunSync(() => Pokedex.GetInstanceAsync()); pokedex.AssertResourceWellConfigured(); }