public void AllPlaylists_InvalidPageNum() { // Arrange: var mockMusicRepository = new Mock <IMusicRepository>(); // Execute / Test: var _musicLibraryController = new MusicLibraryController(mockMusicRepository.Object, _logger); var ex = Assert.Throws <ArgumentException>("pageNum", () => _musicLibraryController.AllPlaylists(0, 5)); Assert.StartsWith("Value must be greater than 0", ex.Message); }
public void AllPlaylists_ValidArgs() { // Arrange: var mockMusicRepository = new Mock <IMusicRepository>(); var testOutput = new List <PlaylistSummary>() { new PlaylistSummary() { Name = "Rock Hits" }, new PlaylistSummary() { Name = "80's Pop" } }; mockMusicRepository.Setup(x => x.GetAllPlaylists(2, 10)).Returns(testOutput); // Execute: var _musicLibraryController = new MusicLibraryController(mockMusicRepository.Object, _logger); var result = _musicLibraryController.AllPlaylists(2, 10); // Test: Assert.Equal(result, testOutput); }