Пример #1
0
        public void ListMoviesReturnsEmptyListIfTheAreNoMoviesAtAll()
        {
            //arrange
            var movieRepository = new Mock <IMovieRepository>();

            movieRepository.Setup(o => o.Find()).Returns(new List <Movie>());
            var movieEngine = new RentalsEngine(movieRepository.Object, null, null);

            //act
            var returnedMovies = movieEngine.ListMovies();

            //assert
            Assert.IsNotNull(returnedMovies, "Returned movies list is null");
            Assert.AreEqual(0, returnedMovies.Count, "Returned movies has movie items");
        }
Пример #2
0
        public void ListMoviesReturnsAllMovies()
        {
            //arrange
            var availableMovies = CreateMovieList();
            var actualMovies    = CreateMovieList();

            var movieRepository = new Mock <IMovieRepository>();

            movieRepository.Setup(o => o.Find()).Returns(actualMovies);
            var rentalsEngine = new RentalsEngine(movieRepository.Object, null, null);

            //act
            var movies = rentalsEngine.ListMovies();

            //assert
            Assert.IsNotNull(movies, "Return movies collection is null");
            Assert.AreEqual(10, movies.Count);
            CollectionAssert.AreEquivalent(availableMovies, movies, "Returned list of movies are not equivalent to the expected list");
        }
Пример #3
0
        public void ListMoviesReturnsEmptyListIfTheAreNoMoviesAtAll()
        {
            //arrange
            var movieRepository = new Mock<IMovieRepository>();
            movieRepository.Setup(o => o.Find()).Returns(new List<Movie>());
            var movieEngine = new RentalsEngine(movieRepository.Object, null, null);

            //act
            var returnedMovies = movieEngine.ListMovies();

            //assert
            Assert.IsNotNull(returnedMovies, "Returned movies list is null");
            Assert.AreEqual(0, returnedMovies.Count, "Returned movies has movie items");
        }
Пример #4
0
        public void ListMoviesReturnsAllMovies()
        {
            //arrange
            var availableMovies = CreateMovieList();
            var actualMovies = CreateMovieList();

            var movieRepository = new Mock<IMovieRepository>();
            movieRepository.Setup(o => o.Find()).Returns(actualMovies);
            var rentalsEngine = new RentalsEngine(movieRepository.Object, null, null);

            //act
            var movies = rentalsEngine.ListMovies();

            //assert
            Assert.IsNotNull(movies, "Return movies collection is null");
            Assert.AreEqual(10, movies.Count);
            CollectionAssert.AreEquivalent(availableMovies, movies, "Returned list of movies are not equivalent to the expected list");
        }