Exemple #1
0
        public void SearchMovie_Should_FindTheCorrectOnes()
        {
            var db = new TFContext(DatabaseSimulator());
            var genreServiceMock = new Mock <IGenreServices>();
            var movieService     = new MovieServices(db, genreServiceMock.Object);

            var movie = new Movie()
            {
                Id    = 1,
                Title = "The Movie"
            };
            var secondMovie = new Movie()
            {
                Id    = 2,
                Title = "The Movies"
            };
            var movieWithoutThe = new Movie()
            {
                Id    = 3,
                Title = "Movie"
            };

            db.Movies.AddRange(movie, secondMovie, movieWithoutThe);
            db.SaveChanges();

            int movieCount = movieService.SearchMovie("The").Count();

            Assert.AreEqual(2, movieCount);
        }