/// <inheritdoc/> public void GetSpotifyRecentlyPlayedMusic() { string authToken = (string)externalAPIGateway.GetSpotifyAuthenticationToken().Value; var searchResult = externalAPIGateway.GetSpotifyRecentlyPlayed(authToken); var playHistoryContainer = (CursorPaging <PlayHistoryItem>)searchResult.Value; foreach (var song in playHistoryContainer.Items) { searchResults.Add(song); } }
public void GetSpotifyRecentlyPlayedWithAfterParam_CorrectResponseReturned() { var now = DateTime.UtcNow.AddDays(-1); sut = MakeSut(); var tokenAsJson = sut.GetSpotifyAuthenticationToken(); tokenAsJson.Value.Should().NotBeNull(); var spotifyAuthToken = JsonConvert.DeserializeObject <SpotifyAuthenticationToken>((string)tokenAsJson.Value); spotifyAuthToken.AccessToken.Should().NotBeNullOrEmpty(); var listeningHistory = sut.GetSpotifyRecentlyPlayed(spotifyAuthToken.AccessToken, now); listeningHistory.Value.Should().NotBeNull(); var afterTestJSON = JsonConvert.SerializeObject(listeningHistory.Value); var afterTest = JsonConvert.DeserializeObject <CursorPaging <PlayHistoryItem> >(afterTestJSON); afterTest.Items.Should().HaveCount(1); afterTest.Items.Should().NotBeNull().And.NotBeEmpty(); listeningHistory = sut.GetSpotifyRecentlyPlayed(spotifyAuthToken.AccessToken); listeningHistory.Value.Should().NotBeNull(); var listeningHistoryExtracted = JsonConvert.SerializeObject(listeningHistory.Value); var actualListeningHistory = JsonConvert.DeserializeObject <CursorPaging <PlayHistoryItem> >(listeningHistoryExtracted); actualListeningHistory.Items.Should().HaveCount(3); actualListeningHistory.Items.Should().NotBeNull(); }
public void GetSpotifyAuthenticationToken_AuthenticationTokenReturned() { sut = MakeSut(); var tokenAsJson = sut.GetSpotifyAuthenticationToken(); tokenAsJson.Value.Should().NotBeNull(); var spotifyAuthToken = JsonConvert.DeserializeObject <SpotifyAuthenticationToken>((string)tokenAsJson.Value); spotifyAuthToken.AccessToken.Should().NotBeNullOrEmpty(); }
public void GetSpotifyRecentlyPlayed_ListeningHistoryReturned() { sut = MakeSut(); var tokenAsJson = sut.GetSpotifyAuthenticationToken(); tokenAsJson.Value.Should().NotBeNull(); var spotifyAuthToken = JsonConvert.DeserializeObject <SpotifyAuthenticationToken>((string)tokenAsJson.Value); spotifyAuthToken.AccessToken.Should().NotBeNullOrEmpty(); var listeningHistory = sut.GetSpotifyRecentlyPlayed(spotifyAuthToken.AccessToken); listeningHistory.Value.Should().NotBeNull(); var listeningHistoryExtracted = JsonConvert.SerializeObject(listeningHistory.Value); var actualListeningHistory = JsonConvert.DeserializeObject <CursorPaging <PlayHistoryItem> >(listeningHistoryExtracted); actualListeningHistory.Items.Should().HaveCount(3); actualListeningHistory.Items.Should().NotBeNull(); }