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"); }
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"); }
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"); }
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"); }