public ActionResult <ApiResponse> Get(string name) { if (string.IsNullOrWhiteSpace(name)) { _logger.LogError("End point is incorrect,include the name at the end of the URL "); return(BadRequest(string.Empty)); } var pokemonResult = _pokemonService.GetDetails(name); if (pokemonResult != null) { return(pokemonResult); } _logger.LogError("No data returned"); return(NotFound(string.Empty)); }
public void Should_Return_Null_When_Endpoint_Is_Incorrect(string search) { var result = _subject.GetDetails(search); result.ShouldBeOfType <ErrorResponse>(); }