Esempio n. 1
0
        public async void GetRandomArtistInfoAsAdminUserOnSubsonic()
        {
            var musicFolders = await _adminSubsonicClient.GetMusicFoldersAsync();

            Assert.NotNull(musicFolders);
            Assert.True(musicFolders.Items.Any());

            var randomMusicFolderNumber = _random.Next(0, musicFolders.Items.Count - 1);
            var randomMusicFolder       = musicFolders.Items.ElementAt(randomMusicFolderNumber);
            var indexes = await _adminSubsonicClient.GetIndexesAsync(randomMusicFolder.Id);

            Assert.NotNull(indexes);
            Assert.True(indexes.Items.Any());

            var randomIndexNumber  = _random.Next(0, indexes.Items.Count - 1);
            var randomIndex        = indexes.Items.ElementAt(randomIndexNumber);
            var randomArtistNumber = _random.Next(0, randomIndex.Artists.Count - 1);
            var randomArtist       = randomIndex.Artists.ElementAt(randomArtistNumber);
            var artistInfo         = await _adminSubsonicClient.GetArtistInfoAsync(randomArtist.Id);

            Assert.NotNull(artistInfo);

            if (!string.IsNullOrWhiteSpace(artistInfo.LastFmUrl))
            {
                Assert.NotNull(artistInfo.Biography);
            }

            Assert.NotNull(artistInfo.MusicBrainzId);
            Assert.NotNull(artistInfo.SmallImageUrl);
            Assert.NotNull(artistInfo.MediumImageUrl);
            Assert.NotNull(artistInfo.LargeImageUrl);
        }