예제 #1
0
        public void GetArtistReleases_ReturnsEmptyList_IfAnyParameterIsNull(string artistId, string type)
        {
            // Act
            var data = _musicBrainzService.GetArtistReleases(artistId, type);

            // Assert
            Assert.IsFalse(data.Any());
        }
예제 #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);
        }