public async Task <IHttpActionResult> GetPokemonDataAsync(string pokemonName)
        {
            //test api call get pokemon
            var pokeapiEndpoint = ConfigurationManager.AppSettings["PokeApiEndpoint"];
            var shakesperareTranslatorEndpoint = ConfigurationManager.AppSettings["ShakespeareTranslatorEndpoint"];

            //get pokemon data via PokeApi
            var pokemonDescription = "";

            //get pokemon data
            try
            {
                var pokemon = await PokeApiUtils.GetPokemonDataAsync(Client, string.Format("{0}/pokemon/{1}", pokeapiEndpoint, pokemonName));

                if (!string.IsNullOrEmpty(pokemon.species?.Url))
                {
                    //get species data
                    var pokemonSpecies = await PokeApiUtils.GetPokemonSpeciesDataAsync(Client, pokemon.species.Url);

                    //filter for english language and group results by version, to take only the most recent values
                    List <string> flavorTexts = pokemonSpecies.flavorTextEntries.Where(t => t.language.Name == "en").GroupBy(g => g.version.Url).LastOrDefault()?.Select(s => s.flavorText).ToList();
                    pokemonDescription = string.Join("\n", flavorTexts);
                }
            }
            catch (HttpException ex)
            {
                return(Content((HttpStatusCode)ex.GetHttpCode(), ex.Message.ToString()));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex.Message.ToString()));
            }

            //get translation via ShakespeareTranslator
            var translatedDescription = "";

            //get translation
            try
            {
                var translation = await ShakespeareTranslatorUtils.GetTranslationAsync(Client, shakesperareTranslatorEndpoint, pokemonDescription);

                translatedDescription = translation.contents.translated;
            }
            catch (HttpException ex)
            {
                return(Content((HttpStatusCode)ex.GetHttpCode(), ex.Message.ToString()));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex.Message.ToString()));
            }

            var response = new TranslatedPokemonResponseModel(pokemonName, translatedDescription);

            return(Ok(response));
        }
        public async Task GetPokemonSpeciesData_ValidInput()
        {
            //mock fake response and initialize test
            var fakeHandler = new FakeHttpMessageHandler();

            fakeHandler.Response.StatusCode = HttpStatusCode.OK;

            var sampleSpecies = GetSamplePokemonSpecies();

            fakeHandler.Response.Content = new StringContent(JsonConvert.SerializeObject(sampleSpecies), Encoding.UTF8, "application/json");

            HttpClient client = new HttpClient(fakeHandler);

            var endpoint = string.Format("{0}/{1}/1", pokeApiBaseEndpoint, pokemonSpeciesEndpoint);

            //execute
            var result = await PokeApiUtils.GetPokemonSpeciesDataAsync(client, endpoint);

            //assert
            Assert.IsTrue(result.flavorTextEntries.Any());
        }
        public async Task GetPokemonSpeciesData_InvalidInput()
        {
            //mock fake response and initialize test
            var fakeHandler = new FakeHttpMessageHandler();

            fakeHandler.Response = new HttpResponseMessage(HttpStatusCode.NotFound);
            //fakeHandler.Response.StatusCode = HttpStatusCode.NotFound;
            fakeHandler.Response.Content = new StreamContent(new MemoryStream(Encoding.UTF8.GetBytes("Not Found")));

            HttpClient client = new HttpClient(fakeHandler);

            var endpoint = string.Format("{0}/{1}/0", pokeApiBaseEndpoint, pokemonEndpoint);

            //execute - assert
            try
            {
                var result = await PokeApiUtils.GetPokemonSpeciesDataAsync(client, endpoint);
            }
            catch (HttpException ex)
            {
                Assert.AreEqual(HttpStatusCode.NotFound, (HttpStatusCode)ex.GetHttpCode());
                return;
            }
        }