Пример #1
0
        public void DeleteMovie_ValidMovie_RemovesMovieFromContextAndSavesChanges()
        {
            // ARRANGE
            var movieToDelete = _movies.FirstOrDefault();

            _mockMovieDbSet.Setup(m => m.Find(movieToDelete.Id)).Returns(movieToDelete);

            // ACT
            _dal.DeleteMovie(movieToDelete.Id);

            // ASSERT
            _mockMovieDbSet.Verify(m => m.Remove(movieToDelete), Times.Once);
            _mockDbContext.Verify(m => m.SaveChanges(), Times.Once);
        }