public void GetAllMovies_Should_Return_List_Of_Movies() { List <Movie> fakeMovies = new List <Movie>() { new Movie() { MovieId = 1, Title = "First Movie", Rating = 2 }, new Movie() { MovieId = 2, Title = "Second Movie", Rating = 1 }, new Movie() { MovieId = 3, Title = "Third Movie", Rating = 4 } }; Mock <IMovieRepository> mockRepository = new Mock <IMovieRepository>(); mockRepository.Setup(m => m.GetMovies()).Returns(fakeMovies); MBLayer.MovieBusinessLayer movieBLayer = new MBLayer.MovieBusinessLayer(mockRepository.Object); List <Movie> actual = movieBLayer.GetAllMovies(); Assert.AreEqual(actual.Count, fakeMovies.Count); }
public void GetAllMovies_Should_Return_Null_For_Empty_MovieList() { List <Movie> fakeMovies = new List <Movie>(); Mock <IMovieRepository> mockRepository = new Mock <IMovieRepository>(); mockRepository.Setup(m => m.GetMovies()).Returns(fakeMovies); MBLayer.MovieBusinessLayer movieBLayer = new MBLayer.MovieBusinessLayer(mockRepository.Object); List <Movie> actual = movieBLayer.GetAllMovies(); Assert.AreEqual(0, actual.Count); }