public void SetUp() { _album = new Album(new LocalizedString("Synthesis", ContentLanguageSelection.English)); _producer = new Artist(TranslatedString.Create("Tripshots")) { Id = 1, ArtistType = ArtistType.Producer }; _vocalist = new Artist(TranslatedString.Create("Hatsune Miku")) { Id = 39, ArtistType = ArtistType.Vocaloid }; _producerContract = new ArtistContract(_producer, ContentLanguagePreference.Default); _vocalistContract = new ArtistContract(_vocalist, ContentLanguagePreference.Default); _song1 = new Song(new LocalizedString("Nebula", ContentLanguageSelection.English)) { Id = 2 }; _song1.AddArtist(_producer); _album.AddArtist(_producer); _album.AddArtist(_vocalist); var songInAlbum = new SongInAlbum(_song1, _album, 1, 1); _songInAlbumContract = new SongInAlbumEditContract(songInAlbum, ContentLanguagePreference.Default); _songInAlbumContract.Artists = new[] { _producerContract }; }
public void Merge_ToEmpty() { Save(_album.AddArtist(_producer)); Save(_album.AddArtist(_vocalist)); Save(_album.AddSong(_song, 1, 1)); var album2 = CreateEntry.Album(); Save(album2); _queries.Merge(_album.Id, album2.Id); _album.Deleted.Should().BeTrue("Original was deleted"); _album.AllArtists.Count.Should().Be(0, "All artists removed from original"); _album.AllSongs.Count.Should().Be(0, "All songs removed from original"); album2.DefaultName.Should().Be("Synthesis", "Name"); album2.AllArtists.Count.Should().Be(2, "Number of artists"); album2.AllSongs.Count.Should().Be(1, "Number of songs"); album2.AllSongs.First().Song.DefaultName.Should().Be("Nebula"); var mergeRecord = _repository.List <AlbumMergeRecord>().FirstOrDefault(m => m.Source == _album.Id); mergeRecord.Should().NotBeNull("Merge record was created"); mergeRecord.Target.Id.Should().Be(album2.Id, "mergeRecord.Target.Id"); }
public void Merge_ToEmpty() { Save(album.AddArtist(producer)); Save(album.AddArtist(vocalist)); Save(album.AddSong(song, 1, 1)); var album2 = CreateEntry.Album(); Save(album2); queries.Merge(album.Id, album2.Id); Assert.IsTrue(album.Deleted, "Original was deleted"); Assert.AreEqual(0, album.AllArtists.Count, "All artists removed from original"); Assert.AreEqual(0, album.AllSongs.Count, "All songs removed from original"); Assert.AreEqual("Synthesis", album2.DefaultName, "Name"); Assert.AreEqual(2, album2.AllArtists.Count, "Number of artists"); Assert.AreEqual(1, album2.AllSongs.Count, "Number of songs"); Assert.AreEqual("Nebula", album2.AllSongs.First().Song.DefaultName); var mergeRecord = repository.List <AlbumMergeRecord>().FirstOrDefault(m => m.Source == album.Id); Assert.IsNotNull(mergeRecord, "Merge record was created"); Assert.AreEqual(album2.Id, mergeRecord.Target.Id, "mergeRecord.Target.Id"); }
public void QueryArtistParticipationStatus_FoundMain() { album.AddArtist(artist, true, ArtistRoles.Default); queryParams.ArtistId = artist.Id; queryParams.ArtistParticipationStatus = ArtistAlbumParticipationStatus.OnlyMainAlbums; var result = Find(); Assert.AreEqual(1, result.Items.Length, "1 result"); Assert.AreEqual(1, result.TotalCount, "total result count"); Assert.AreEqual(albumWithArtist, result.Items[0], "albums are equal"); }
public void QueryArtistParticipationStatus_FoundMain() { _album.AddArtist(_artist, true, ArtistRoles.Default); _queryParams.ArtistParticipation.ArtistIds = new[] { _artist.Id }; _queryParams.ArtistParticipation.Participation = ArtistAlbumParticipationStatus.OnlyMainAlbums; var result = Find(); result.Items.Length.Should().Be(1, "1 result"); result.TotalCount.Should().Be(1, "total result count"); result.Items[0].Should().Be(_albumWithArtist, "albums are equal"); }
public void SetUp() { querySource = new QuerySourceList(); artist = new Artist(TranslatedString.Create("XenonP")) { Id = 64 }; querySource.Add(artist); album = new Album(new LocalizedString("Synthesis", ContentLanguageSelection.English)) { Id = 1, DiscType = DiscType.Album, CreateDate = new DateTime(2011, 1, 16) }; AddAlbum(album); albumWithArtist = new Album(new LocalizedString("DIVINE", ContentLanguageSelection.English)) { Id = 1010, DiscType = DiscType.Unknown, RatingAverage = 4.5, CreateDate = new DateTime(2012, 1, 15) }; albumWithArtist.AddArtist(artist); AddAlbum(albumWithArtist); queryParams = new AlbumQueryParams(); search = new Model.Service.Search.AlbumSearch.AlbumSearch(querySource, ContentLanguagePreference.Default); }
private ArtistForAlbum RestoreArtistRef(Album album, Artist artist, ArchivedArtistForAlbumContract albumRef) { if (artist != null) { return(!artist.HasAlbum(album) ? artist.AddAlbum(album, albumRef.IsSupport, albumRef.Roles) : null); } else { return(album.AddArtist(albumRef.NameHint, albumRef.IsSupport, albumRef.Roles)); } }
public void SetUp() { album = new Album(new LocalizedString("Synthesis", ContentLanguageSelection.English)); producer = new Artist(TranslatedString.Create("Tripshots")) { Id = 1, ArtistType = ArtistType.Producer }; vocalist = new Artist(TranslatedString.Create("Hatsune Miku")) { Id = 39, ArtistType = ArtistType.Vocaloid }; producerContract = new ArtistContract(producer, ContentLanguagePreference.Default); vocalistContract = new ArtistContract(vocalist, ContentLanguagePreference.Default); song1 = new Song(new LocalizedString("Nebula", ContentLanguageSelection.English)) { Id = 2 }; song1.AddArtist(producer); album.AddArtist(producer); album.AddArtist(vocalist); var songInAlbum = new SongInAlbum(song1, album, 1, 1); songInAlbumContract = new SongInAlbumEditContract(songInAlbum, ContentLanguagePreference.Default); songInAlbumContract.Artists = new[] { producerContract }; }
public ActionResult Create(int albumId, string artistName) { Dictionary <string, object> model = new Dictionary <string, object>(); Album foundAlbum = Album.Find(albumId); Artist newArtist = new Artist(artistName); foundAlbum.AddArtist(newArtist); List <Artist> albumArtist = foundAlbum.Artists; model.Add("artist", albumArtist); model.Add("album", foundAlbum); return(View("Show", model)); }
public void AddArtist_AssociatesArtistWithAlbum_ArtistList() { string newArtistName01 = "Led Zeppelin"; Artist newArtist01 = new Artist(newArtistName01); List <Artist> newArtistList = new List <Artist> { newArtist01 }; string albumName = "Houses of Holy"; Album newAlbum = new Album(albumName); newAlbum.AddArtist(newArtist01); List <Artist> result = newAlbum.Artists; CollectionAssert.AreEqual(newArtistList, result); }
public void SetUp() { querySource = new QuerySourceList(); artist = new Artist(TranslatedString.Create("XenonP")) { Id = 64 }; querySource.Add(artist); album = new Album(new LocalizedString("Synthesis", ContentLanguageSelection.English)) { Id = 1, DiscType = DiscType.Album, CreateDate = new DateTime(2011, 1, 16) }; AddAlbum(album); albumWithArtist = new Album(new LocalizedString("DIVINE", ContentLanguageSelection.English)) { Id = 1010, DiscType = DiscType.Unknown, RatingAverage = 4.5, CreateDate = new DateTime(2012, 1, 15) }; albumWithArtist.AddArtist(artist); AddAlbum(albumWithArtist); queryParams = new AlbumQueryParams(); search = new Model.Service.Search.AlbumSearch.AlbumSearch(querySource, ContentLanguagePreference.Default); }