Esempio n. 1
0
        public void RemoveDoubleMovies()
        {
            var fistMovie = new Movie
            {
                id    = "1",
                title = "first",
                rated = 10f
            };
            var secondMovie = new Movie
            {
                id    = "2",
                title = "second",
                rated = 0f
            };
            var thirdMovie = new Movie
            {
                id    = "3",
                title = "third",
                rated = 0f
            };
            var firstList = new List <Movie>
            {
                fistMovie,
                secondMovie,
                thirdMovie
            };
            var secondList = new List <Movie>
            {
                fistMovie
            };

            var actual = ListSorter.CombineMovieListsWithioutDoubles(firstList, secondList);

            Assert.AreEqual(3, actual.Count);
        }
Esempio n. 2
0
        public ActionResult GetMovieById(string id)
        {
            var top100List        = GetTop100MovieList();
            var detailedMovieList = GetDetailedMovies();
            var combinedList      = ListSorter.CombineMovieListsWithioutDoubles(detailedMovieList, top100List);

            return(Ok(combinedList.FirstOrDefault(movie => movie.id == id)));
        }
Esempio n. 3
0
        public ActionResult GetDetailedList(bool orderByAscending = true)
        {
            var top100List      = GetTop100MovieList();
            var parsedMovieList = GetDetailedMovies();
            var listToOrder     = ListSorter.CombineMovieListsWithioutDoubles(parsedMovieList, top100List);
            var orderedList     = ListSorter.orderList(orderByAscending, listToOrder);
            var listOfTitles    = new List <string>();

            foreach (var movie in orderedList)
            {
                listOfTitles.Add(movie.title);
            }
            return(Ok(listOfTitles));
        }