Пример #1
0
        public async Task GetMovieById(string id, string title)
        {
            //Act
            var movie = await _movieRepository.GetMovieById(id);

            //Assert
            movie.Title.Should().Be(title);
        }
Пример #2
0
        /**
         * Get the movie with the given id.
         * The business rule is to give internal database higher priority than third party databases.
         * If the movie doesn't exist in internal database, get it from third party database.
         */
        public async Task <Movie> GetMovieById(string id, bool save = true)
        {
            var movieModel = await _movieRespository.GetMovieWithGenre(x => x.Id == id);

            if (movieModel != null)
            {
                movieModel.Poster = await DownloadMoviePoster(movieModel);

                return(movieModel);
            }

            movieModel = await _thirdPartyMovieRepository.GetMovieById(id);

            await AddMovie(movieModel);

            return(movieModel);
        }