Esempio n. 1
0
        public void AddArtist_PutsValidArtistIntoDb()
        {
            // Arrange
            MockArtistService mockService = new MockArtistService();
            ArtistsController controller  = new ArtistsController(mockService);
            Artist            artist      = GetArtist();

            // Act
            controller.AddArtist(artist);

            // Assert
            List <Artist> artists = mockService.getArtists();

            Assert.IsTrue(artists.Contains(artist));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }