public async Task GetPokemonShapeResourceAsyncIntegrationTest() { // assemble PokeApiClient client = new PokeApiClient(); // act PokemonShape pokemonShape = await client.GetResourceAsync <PokemonShape>(1); // assert Assert.True(pokemonShape.Id != default(int)); }
private UIPokemonShape ToUIPokemonShape(PokemonShape shape) { switch (shape) { case PokemonShape.Ball: return(UIPokemonShape.Ball); case PokemonShape.Squiggle: return(UIPokemonShape.Squiggle); case PokemonShape.Fish: return(UIPokemonShape.Fish); case PokemonShape.Arms: return(UIPokemonShape.Arms); case PokemonShape.Blob: return(UIPokemonShape.Blob); case PokemonShape.Upright: return(UIPokemonShape.Upright); case PokemonShape.Legs: return(UIPokemonShape.Legs); case PokemonShape.Quadruped: return(UIPokemonShape.Quadruped); case PokemonShape.Wings: return(UIPokemonShape.Wings); case PokemonShape.Tentacles: return(UIPokemonShape.Tentacles); case PokemonShape.Heads: return(UIPokemonShape.Heads); case PokemonShape.Humanoid: return(UIPokemonShape.Humanoid); case PokemonShape.BugWings: return(UIPokemonShape.BugWings); case PokemonShape.Armor: return(UIPokemonShape.Armor); case PokemonShape.None: return(UIPokemonShape.None); default: throw new ArgumentOutOfRangeException(nameof(shape), shape, null); } }
private string ToEmojiPokemonShape(PokemonShape shape) { switch (shape) { case PokemonShape.Ball: return("⚫"); case PokemonShape.Squiggle: return("🐍"); case PokemonShape.Fish: return("🐟"); case PokemonShape.Arms: return("👐"); case PokemonShape.Blob: return("🌀"); case PokemonShape.Upright: return("🚶"); case PokemonShape.Legs: return("👟"); case PokemonShape.Quadruped: return("🐎"); case PokemonShape.Wings: return("🐦"); case PokemonShape.Tentacles: return("🐙"); case PokemonShape.Heads: return("👥"); case PokemonShape.Humanoid: return("💃"); case PokemonShape.BugWings: return("🐝"); case PokemonShape.Armor: return("🐜"); case PokemonShape.None: return("🚫"); default: throw new ArgumentOutOfRangeException(nameof(shape), shape, null); } }
public async Task <IActionResult> GetShapes() { var shapes = new List <PokemonShape>(); for (int i = 1; i < 15; i++) { PokemonShape shape = await _pokeClient.GetResourceAsync <PokemonShape>(i); shapes.Add(shape); } return(Ok(shapes.ToArray())); }