public void DeleteArtist_RemovesValidArtistFromDb() { // Arrange MockArtistService mockService = new MockArtistService(); ArtistsController controller = new ArtistsController(mockService); Artist artist = GetArtist(); mockService.addArtist(artist); // Act controller.DeleteArtist(artist.ArtistId); // Assert List <Artist> artists = mockService.getArtists(); Assert.IsTrue(!artists.Contains(artist)); }
public void EditArtist_UpdatesValidArtistInDb() { // Arrange MockArtistService mockService = new MockArtistService(); ArtistsController controller = new ArtistsController(mockService); Artist originalArtist = GetArtist(); mockService.addArtist(originalArtist); Artist editedArtist = GetArtist(); editedArtist.Name = "NewName"; // Act controller.EditArtist(originalArtist.ArtistId, editedArtist); // Assert List <Artist> artists = mockService.getArtists(); Assert.IsTrue(!artists.Contains(originalArtist)); Assert.IsTrue(artists.Contains(editedArtist)); }