Пример #1
0
        public async void Exception_Is_Thrown_When_CoverArtArchiveClient_Throws([Frozen] IMusicBrainzClient musicBrainzClient, [Frozen] ICoverArtArchiveClient coverArtArchiveClient, ArtistService artistService, string mbid, Artist artist, Exception ex)
        {
            musicBrainzClient.Stub(c => c.GetArtistAsync(Arg<string>.Is.Anything)).Return(Task.FromResult(artist));
            coverArtArchiveClient.Stub(c => c.GetCoverArtUrlAsync(Arg<string>.Is.Anything)).Throw(ex);

            await Assert.ThrowsAsync<Exception>(() => artistService.GetArtistAsync(mbid));
        }
Пример #2
0
        public async void Exception_Is_Thrown_When_WikipediaClient_Throws([Frozen] IMusicBrainzClient musicBrainzClient, [Frozen] IWikipediaClient wikipediaClient, ArtistService artistService, string mbid, Artist artist, Exception ex)
        {
            musicBrainzClient.Stub(c => c.GetArtistAsync(Arg<string>.Is.Anything)).Return(Task.FromResult(artist));
            wikipediaClient.Stub(c => c.GetArtistDescriptionAsync(Arg<string>.Is.Anything)).Throw(ex);

            await Assert.ThrowsAsync<Exception>(() => artistService.GetArtistAsync(mbid));
        }
Пример #3
0
        public async void Exception_Is_Thrown_When_MusicBrainzClient_Throws([Frozen] IMusicBrainzClient musicBrainzClient, ArtistService artistService, string mbid, Exception ex)
        {
            musicBrainzClient.Stub(c => c.GetArtistAsync(Arg<string>.Is.Anything)).Throw(ex);

            await Assert.ThrowsAsync<Exception>(() => artistService.GetArtistAsync(mbid));
        }