public async void Should_return_NOT_FOUND_for_non_ASCII_invalid_name(string name) { var logger = PokemonControllerTests.GetMockLogger(); var config = Options.Create(new BaseConfiguration()); var transformProvider = new ShakespeareTextTransformProvider(); var pokemonProvider = new PokemonProvider(); var pokemonController = new PokemonController(logger, config, pokemonProvider, transformProvider); ContentResult response = (await pokemonController.Get(name)) as ContentResult; Assert.NotNull(response); Assert.Equal(response.StatusCode, (int)HttpStatusCode.NotFound); }
public async void Should_handle_Shakespeare_endpoint_not_available(string name, string shakespeareEndpoint) { var logger = PokemonControllerTests.GetMockLogger(); var config = Options.Create(new BaseConfiguration()); config.Value.TextTransformConfiguration.EndpointBaseUrl = shakespeareEndpoint; var transformProvider = new ShakespeareTextTransformProvider(); var pokemonProvider = new PokemonProvider(); var pokemonController = new PokemonController(logger, config, pokemonProvider, transformProvider); ContentResult response = (await pokemonController.Get(name)) as ContentResult; Assert.NotNull(response); Assert.Equal(response.StatusCode, (int)HttpStatusCode.RequestTimeout); }
public async void Should_return_a_description_and_the_correct_name(string name) { var logger = PokemonControllerTests.GetMockLogger(); var config = Options.Create(new BaseConfiguration()); var transformProvider = new ShakespeareTextTransformProvider(); var pokemonProvider = new PokemonProvider(); var pokemonController = new PokemonController(logger, config, pokemonProvider, transformProvider); var response = (await pokemonController.Get(name)) as OkObjectResult; Assert.NotNull(response); Assert.Equal(response.StatusCode, (int)HttpStatusCode.OK); PokemonResponseDTO content = response.Value as PokemonResponseDTO; Assert.Equal(name, content.Name); }