public async Task ReturnsEmptyList_WhenMovieNameDoNotMach() { var reviewRepoMock = new Mock <IRepository <Review> >(); var directorRepoMock = new Mock <IRepository <Director> >(); var genreRepoStub = new Mock <IRepository <Genre> >(); var movieGenreRepoStub = new Mock <IRepository <MovieGenre> >(); var movieRepoMock = new Mock <IRepository <Movie> >(); movieRepoMock .Setup(mr => mr.All()) .Returns(new List <Movie> { Venom, TheMovie23 }.AsQueryable().BuildMock().Object); var sut = new MovieServices(reviewRepoMock.Object, movieRepoMock.Object, directorRepoMock.Object, genreRepoStub.Object, movieGenreRepoStub.Object); //Act var result = await sut.SearchMovieAsync("GoshoPansa", new List <string> { "NemaTakivJanr" }, "Bay Pesho"); //Assert Assert.IsTrue(result.Count == 0); }
public async Task SearchAndFindMovie_WhenParametersAreCorrect() { //Arrange var expectedMovie = new List <Movie>(); expectedMovie.Add(Venom); var reviewRepoMock = new Mock <IRepository <Review> >(); var directorRepoMock = new Mock <IRepository <Director> >(); var genreRepoStub = new Mock <IRepository <Genre> >(); var movieGenreRepoStub = new Mock <IRepository <MovieGenre> >(); var movieRepoMock = new Mock <IRepository <Movie> >(); movieRepoMock .Setup(mr => mr.All()) .Returns(new List <Movie> { Venom, TheMovie23 }.AsQueryable().BuildMock().Object); var sut = new MovieServices(reviewRepoMock.Object, movieRepoMock.Object, directorRepoMock.Object, genreRepoStub.Object, movieGenreRepoStub.Object); //Act var result = await sut.SearchMovieAsync("Venom", new List <string> { "p**n" }, "thebsetdirector"); //Assert Assert.AreEqual("Venom", result.FirstOrDefault().Name); }