public void GetAlbumDetails() { _repository.Save(_album.AddSong(_song, 1, 1)); _repository.Save(_album.AddSong(_song2, 2, 1)); _repository.Save(_user.AddSongToFavorites(_song, SongVoteRating.Favorite)); var result = _queries.GetAlbumDetails(_album.Id, "*****@*****.**"); result.Songs.Length.Should().Be(2, "Number of songs"); var track = result.Songs[0]; track.Rating.Should().Be(SongVoteRating.Favorite, "First track rating"); result.Songs[1].Rating.Should().Be(SongVoteRating.Nothing, "Second track rating"); }
public void GetAlbumDetails() { repository.Save(album.AddSong(song, 1, 1)); repository.Save(album.AddSong(song2, 2, 1)); repository.Save(user.AddSongToFavorites(song, SongVoteRating.Favorite)); var result = queries.GetAlbumDetails(album.Id, "*****@*****.**"); Assert.AreEqual(2, result.Songs.Length, "Number of songs"); var track = result.Songs[0]; Assert.AreEqual(SongVoteRating.Favorite, track.Rating, "First track rating"); Assert.AreEqual(SongVoteRating.Nothing, result.Songs[1].Rating, "Second track rating"); }
// // GET: /Album/Details/5 public ActionResult Details(int id = invalidId) { if (id == invalidId) { return(NoId()); } WebHelper.VerifyUserAgent(Request); var model = queries.GetAlbumDetails(id, WebHelper.IsValidHit(Request) ? WebHelper.GetRealHost(Request) : string.Empty); var prop = PageProperties; prop.Title = model.Name; prop.CanonicalUrl = VocaUriBuilder.CreateAbsolute(Url.Action("Details", new { id })).ToString(); prop.GlobalSearchType = EntryType.Album; prop.OpenGraph.Image = Url.ImageThumb(model, Model.Domain.Images.ImageSize.Original, fullUrl: true); prop.OpenGraph.Type = OpenGraphTypes.Album; prop.OpenGraph.ShowTwitterCard = true; string titleAndArtist; if (!string.IsNullOrEmpty(model.ArtistString)) { titleAndArtist = string.Format("{0} - {1}", model.Name, model.ArtistString); } else { titleAndArtist = model.Name; } PageProperties.OpenGraph.Title = string.Format("{0} ({1})", titleAndArtist, Translate.DiscTypeName(model.DiscType)); PageProperties.PageTitle = titleAndArtist; PageProperties.Subtitle = string.Format("{0} ({1})", model.ArtistString, Translate.DiscTypeName(model.DiscType)); prop.Description = !model.Description.IsEmpty ? markdownParser.GetPlainText(model.Description.EnglishOrOriginal) : albumDescriptionGenerator.GenerateDescription(model, d => Translate.DiscTypeNames.GetName(d, CultureInfo.InvariantCulture)); return(View(new AlbumDetails(model, PermissionContext))); }
public AlbumDetailsContract GetAlbumById(int id) { var album = albumQueries.GetAlbumDetails(id, null); return(album); }