Beispiel #1
0
        public void GetSongsByReleases_ReturnsEmptyList_IfArtistIdIsNull()
        {
            // Act
            var data = _musicBrainzService.GetSongsByReleases(null, new List <string> {
                "Every Weekend", "For The Masses"
            });

            // Assert
            Assert.IsEmpty(data);
        }
Beispiel #2
0
        public async Task <ArtistAverage> GetAverageLyricCount(string artist)
        {
            if (string.IsNullOrEmpty(artist))
            {
                return(null);
            }

            var model = new ArtistAverage {
                ArtistName = artist
            };

            var artistData = _musicBrainzService.GetArtistData(artist);

            if (artistData == null)
            {
                return(model);
            }

            model.ArtistId = artistData.Id;

            var releases = _musicBrainzService.GetArtistReleases(artistData.Id, "album").ToList();

            if (!releases.Any())
            {
                return(model);
            }

            var songs = _musicBrainzService.GetSongsByReleases(artistData.Id, releases).ToList();

            if (!songs.Any())
            {
                return(model);
            }

            // Build a list of lyric counts for each song
            var lyricCountList = await BuildLyricCountList(artist, songs);

            model.AverageDetails = _lyricCalculator.GetLyricCountAverageDetails(lyricCountList);

            return(model);
        }