public void CheckIfMoviesExistFromRemoteApi()
        {
            var client    = new RemoteApiClient(Mother.RemoteApiBaseUrl, Mother.RemoteApiResource);
            var movieList = client.GetMovieList();

            Assert.IsTrue(movieList.Count > 0, "No movies found in retrieved list");
        }
        public void RemoteApiFailure_ReturnException()
        {
            var client = new RemoteApiClient("https://www.example.com", "/does/not/exist/");
            var movieListingService = new MovieListingService(client);

            Assert.ThrowsException <ContentRetrievalException>(() => movieListingService.GetSortedList(), "ContentRetrievalException should occur when incorrect URL is provided");
        }
        public void RemoteApiIncorrectResource_NullReturn()
        {
            var client = new RemoteApiClient(Mother.RemoteApiBaseUrl, "/does/not/exist/");
            var movieListingService = new MovieListingService(client);
            var sortedList          = movieListingService.GetSortedList();

            Assert.IsNull(sortedList, "Empty list should be null");
        }
        public IActionResult Index()
        {
            List <ActorViewModel> movieList;

            try
            {
                var client = new RemoteApiClient(_options.BaseUrl, _options.Resource);
                var movieListingService = new MovieListingService(client);
                movieList = movieListingService.GetSortedList();
            }
            catch (Exception ex)
            {
                movieList             = null;
                ViewData["Exception"] = ex.Message;
            }

            return(View(movieList));
        }