public async Task GetSongs_Config_OK() { var amService = new AppleMusicService(_config) as IStreamingService; var songs = await amService.GetSongs("test"); Assert.IsNotNull(songs); Assert.IsTrue(songs.Count > 1); }
public async Task GetSong_Config_Id_OK() { var amService = new AppleMusicService(_config) as IStreamingService; var song = await amService.GetSong("1487502476"); Assert.IsNotNull(song); Assert.IsTrue(song.ServiceId.Contains("1487502476")); }
public async Task GetSong_Config_Term_OK() { var amService = new AppleMusicService(_config) as IStreamingService; var song = await amService.GetSong("test"); Assert.IsNotNull(song); Assert.IsTrue(song.ServiceId.Contains("1031354882")); }
public async Task GetResponse_Test_OK() { var key = _config["Keys:AppleMusic:Key"]; var keyId = _config["Keys:AppleMusic:KeyId"]; var teamId = _config["Keys:AppleMusic:TeamId"]; var jwt = AppleMusicService.CreateSignedJwt(key, keyId, teamId); var response = await PerformTestRequest(jwt); Assert.IsNotNull(response); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); }
private async Task <IRestResponse> PerformTestRequest(string jwt = null) { var baseUrl = @"https://api.music.apple.com/v1"; var client = AppleMusicService.CreateRestClient(baseUrl, jwt); var request = new RestRequest(@"test", Method.GET) { RequestFormat = DataFormat.Json }; var response = await client.ExecuteAsync(request); return(response); }