예제 #1
0
        public void NotCallGenreServiceDeleteGenre_WhenPassedNullGridGenreViewModel()
        {
            // Arrange
            var genreServiceMock = new Mock <IGenreService>();
            var mapperMock       = new Mock <IMapper>();

            // Act
            var genresGridController = new GenresGridController(genreServiceMock.Object, mapperMock.Object);

            genresGridController.DeleteGenre(null);

            // Assert
            genreServiceMock.Verify(gs => gs.DeleteGenre(It.IsAny <string>()), Times.Never);
        }
예제 #2
0
        public void CallGenreServiceDeleteGenre_WhenPassedGridGenreViewModel()
        {
            // Arrange
            var genreServiceMock = new Mock <IGenreService>();
            var mapperMock       = new Mock <IMapper>();

            var gridGenreViewModel = new GridGenreViewModel()
            {
                Name = "Genre"
            };

            // Act
            var genresGridController = new GenresGridController(genreServiceMock.Object, mapperMock.Object);

            genresGridController.DeleteGenre(gridGenreViewModel);

            // Assert
            genreServiceMock.Verify(gs => gs.DeleteGenre(gridGenreViewModel.Name), Times.Once);
        }