public void AddArtist_Artist_CallsArtistRepoAdd() { var artist = new Artist(); _inventoryService.AddArtist(artist); _artistRepository.Verify(x => x.Add(It.IsAny <Artist>()), Times.AtLeastOnce); }
public void AddArtist_Artist_AddsArtistToDatabase() { var firstGenre = new Genre { Id = Guid.NewGuid(), GenreId = Guid.NewGuid() }; var secondGenre = new Genre { Id = Guid.NewGuid(), GenreId = Guid.NewGuid() }; var genres = new List <Genre> { firstGenre, secondGenre }; _context.Genres.AddRange(genres); _context.SaveChanges(); var artist = new Artist { Id = Guid.NewGuid(), ArtistId = Guid.NewGuid(), Genres = new List <Genre> { new Genre { GenreId = firstGenre.GenreId }, new Genre { GenreId = secondGenre.GenreId } } }; _inventoryService.AddArtist(artist); var artists = _context.Artists.ToList(); Assert.IsTrue(artists.Contains(artist)); }