public void GetMovieByIdReturnMovieFromAllMoviesList()
        {
            var movie = new MovieDto();

            movie.MovieId = 5;
            movie.Title   = "First_5";

            _cashingService.SetMovie(movie);

            var movie_second_5 = new MovieDto();

            movie_second_5.MovieId = 5;
            movie_second_5.Title   = "Second_5";

            var movies = new List <MovieDto> {
                movie_second_5
            };

            _cashingService.SetAllMovies(movies);

            var movieFromCash = _cashingService.GetMovieById(movie.MovieId);

            Assert.AreNotSame(movie, movieFromCash);

            Assert.AreSame(movie_second_5, movieFromCash);
        }
        /// <summary>
        ///     Gets the movie by identifier.
        /// </summary>
        /// <param name="movieId">The movie identifier.</param>
        /// <returns>MovieDto</returns>
        public MovieDto GetMovieById(int movieId)
        {
            Guard.IntMoreThanZero(movieId, nameof(movieId));

            MovieDto movie = null;

            var allMovies = _cachingService.GetAllMovies();

            if (allMovies != null)
            {
                movie = allMovies.FirstOrDefault(m => m.MovieId == movieId);
            }

            if (movie == null)
            {
                movie = _cachingService.GetMovieById(movieId);
            }

            if (movie == null)
            {
                movie = _dataSource.GetMovieById(movieId);

                _cachingService.SetMovie(movie);
            }

            return(movie);
        }