public async Task <IList <ArtistResponse> > Handle(GetArtistsCommand command, CancellationToken cancellationToken) { var result = await _artistRepository.GetAsync(); return(_mapper.Map <IList <ArtistResponse> >(result)); }
public async Task HandleResponseSingle() { var command = new GetArtistsCommand(MAuth.Object, "user") { Page = 2, Count = 1 }; var expectedArtist = new LastArtist { Name = "Crystal Castles", PlayCount = 4219, Mbid = "b1570544-93ab-4b2b-8398-131735394202", Url = new Uri("https://www.last.fm/music/Crystal+Castles"), MainImage = new LastImageSet( "https://lastfm-img2.akamaized.net/i/u/34s/f36a92bfbd7f8b579c91942c6a428d69.png", "https://lastfm-img2.akamaized.net/i/u/64s/f36a92bfbd7f8b579c91942c6a428d69.png", "https://lastfm-img2.akamaized.net/i/u/174s/f36a92bfbd7f8b579c91942c6a428d69.png", "https://lastfm-img2.akamaized.net/i/u/300x300/f36a92bfbd7f8b579c91942c6a428d69.png", "https://lastfm-img2.akamaized.net/i/u/f36a92bfbd7f8b579c91942c6a428d69.png") }; var response = CreateResponseMessage(Encoding.UTF8.GetString(LibraryApiResponses.LibraryGetArtistsSingle)); var actual = await command.HandleResponse(response); Assert.IsTrue(actual.Success); TestHelper.AssertSerialiseEqual(expectedArtist, actual.Content.Single()); // Testing the second track returned }