Пример #1
0
        public async Task TestGetListOfMoviesByTitle()
        {
            var movies = await _omdbClient.GetMoviesListAsync(search : "Game of Thrones");

            Assert.IsNotNull(movies);
            Assert.AreEqual("Game of Thrones", movies.Search[0].Title);
        }
Пример #2
0
        public async Task <ActionResult <MovieSearch> > Get(string s, string plot, int?year)
        {
            MovieSearch movies = null;

            try
            {
                logger.LogTrace("query requested: s = {s}  plot = {plot} year = {year} ");

                movies = await movieService.GetMoviesListAsync(search : s, plot : plot, year : year);
            }
            catch (Exception ex)
            {
                logger.LogError("A Error has ocurred: " + ex.ToString());

                movies       = new MovieSearch();
                movies.Error = "Internal Server Error";
                return(StatusCode(StatusCodes.Status404NotFound, movies));
            }

            if (movies != null)
            {
                logger.LogWarning($"Invalid query search: s = {s}  plot = {plot} year = {year} ");
                return(movies);
            }

            return(StatusCode(StatusCodes.Status404NotFound, "Not Found"));
        }