Example #1
0
        public bool GetAlbum(string albumId)
        {
            var  album       = _albumsUtils.GetParticularAlbum(albumId);
            var  albumTracks = _tracksConverter.ToList(album.Tracks);
            bool running     = true;

            while (running)
            {
                IO.WriteLine(
                    $"Artist: {album.Artists[0].Name}\nName: {album.Name}\nRelease date: {album.ReleaseDate}");
                var menu = new BasicModelMenu();
                int i    = 1;
                foreach (var playlistTrack in albumTracks)
                {
                    TimeSpan ts = TimeSpan.FromMilliseconds(playlistTrack.DurationMs);
                    menu.AddItem($"{playlistTrack.Name} {ts.Minutes}:{ts.Seconds}",
                                 _trackMenuFunctions.GetTrack, i++.ToString(), playlistTrack.Id);
                }

                menu.AddItem("Save Album", SaveAlbum, i++.ToString(), albumId);
                menu.AddItem("Remove Saved Album", RemoveSavedAlbum, i++.ToString(), albumId);
                menu.AddItem("Exit", _exitFunctions.Exit, i++.ToString(), null);
                running = menu.Display();
            }

            return(true);
        }
Example #2
0
        public void GetParticularAlbum_ReturnsAlbum()
        {
            var album = _albumsUtils.GetParticularAlbum("3rqqwtJE89WoWvMyPTvbZc");

            Assert.AreEqual(false, album.HasError());
        }