示例#1
0
        public void Check_That_Right_Method_Was_Called_Inside_IsGenreNameAvailable_Action()
        {
            // Arrange
            var mockGenreService = new Mock <IGenreService>();

            mockGenreService.Setup(m => m.GenreExists(It.IsAny <string>(), It.IsAny <int>()))
            .Returns(false);

            ValidationController validationController = GetValidationController(mockGenreService: mockGenreService);

            const string genreName      = "name";
            const int    currentGenreId = 1;

            // Act
            validationController.IsGenreNameAvailable(genreName, currentGenreId);

            // Assert
            mockGenreService.Verify(m => m.GenreExists(genreName, currentGenreId));
        }