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

            Assert.ThrowsException <InexistingEntityException>
                (() => movieService.DeleteById(1));
        }
Exemple #2
0
        public void DeleteById_Should_DeleteTheMovieCorrect()
        {
            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"
            };

            db.Movies.Add(movie);
            db.SaveChanges();

            Assert.IsFalse(movie.IsDeleted);

            movieService.DeleteById(1);

            Assert.IsTrue(movie.IsDeleted);
        }