public void GetAlbum() { GetArtists ar = new GetArtists() { Credentials = c }; var response = ar.DoRequest<GetArtistsResponse>().GetAwaiter().GetResult(); GetArtist a = new GetArtist(response.artists.index[0].artist[0].id) { Credentials = c }; var response2 = a.DoRequest<GetArtistResponse>().GetAwaiter().GetResult(); //Arrange GetAlbum al = new GetAlbum(response2.artist.album[0].id) { Credentials = c }; //Act var response3 = al.DoRequest<GetAlbumResponse>().GetAwaiter().GetResult(); //Assert Assert.AreEqual<string>(expected, response3.status); }
public async Task<bool> Get(int id) { try { var ar = new GetAlbumList(ListType.alphabeticalByName, size: "10") { appName = "wuffSonic", user = "", password = "", version = "1.11", uri = "http://music.deviouscreation.com" }; var albumsResponse = await ar.DoRequest<GetAlbumListResponse>(); var returnedAlbums = albumsResponse.albumList.album; foreach (var returnedAlbum in returnedAlbums) { long albumId, coverArtId; long.TryParse(returnedAlbum.id, out albumId); long.TryParse(returnedAlbum.artistId, out coverArtId); var album = new Album(albumId, returnedAlbum.name, coverArtId); var albumRequest = new GetAlbum(returnedAlbum.id); var albumResponse = await albumRequest.DoRequest<GetAlbum>(); var songs = albumResponse.Response.album.song; foreach (var song in songs) { var track = new Track(song.id, song.duration, song.size, song.title, song.track) } _musicContext.Albums.Add(album); } } catch (Exception ex) { throw; } return true; }