From 6806ea4b9dfb5be531cd3d3f99eb930a130a27bd Mon Sep 17 00:00:00 2001 From: Johan Klinge Date: Wed, 9 Jan 2019 14:18:13 +0100 Subject: [PATCH] Integration test for UserGetWeeklyArtistChart --- .../Commands/UserGetWeeklyArtistChartTests.cs | 32 +++++++++++++++++++ .../User/UserGetWeeklyArtistChartTests.cs | 4 +-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyArtistChartTests.cs diff --git a/src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyArtistChartTests.cs b/src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyArtistChartTests.cs new file mode 100644 index 0000000..d270bee --- /dev/null +++ b/src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyArtistChartTests.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; + +namespace IF.Lastfm.Core.Tests.Integration.Commands +{ + public class UserGetWeeklyArtistChartTests : CommandIntegrationTestsBase + { + [Test] + public async Task GetChartList_Success() + { + //call GetWeeklyChartList to get available weeks + var weekList = await Lastfm.User.GetWeeklyChartListAsync(INTEGRATION_TEST_USER); + var from = weekList.Content.Last().From; + var to = weekList.Content.Last().To; + //use the from and to params to call GetWeeklyArtistChart for the last week + var response = await Lastfm.User.GetWeeklyArtistChartAsync(INTEGRATION_TEST_USER, from, to); + var artistChart = response.Content; + + Assert.IsTrue(response.Success); + + //Values will vary from week to week so just checking that we got some values back + Assert.IsNotEmpty(artistChart); + Assert.IsNotEmpty(artistChart.First().Name); + Assert.IsNotNull(response.From); + Assert.IsNotNull(response.To); + } + } +} \ No newline at end of file diff --git a/src/IF.Lastfm.Core.Tests/Api/Commands/User/UserGetWeeklyArtistChartTests.cs b/src/IF.Lastfm.Core.Tests/Api/Commands/User/UserGetWeeklyArtistChartTests.cs index e94afdf..764a9c2 100644 --- a/src/IF.Lastfm.Core.Tests/Api/Commands/User/UserGetWeeklyArtistChartTests.cs +++ b/src/IF.Lastfm.Core.Tests/Api/Commands/User/UserGetWeeklyArtistChartTests.cs @@ -94,8 +94,8 @@ public async Task GetWeeklyArtistChart_HandleResponse_Success() Assert.AreEqual("2437980f-513a-44fc-80f1-b90d9d7fcf8f", first.Mbid); Assert.AreEqual(18, first.PlayCount); Assert.AreEqual(new Uri("https://www.last.fm/music/Bing+Crosby"), first.Url); - //TODO add this attribute to LastArtist class - //Assert.AreEqual(1, first.Weeklyrank); + //TODO add rank attribute to LastArtist class + //Assert.AreEqual(1, first.Rank); //Tests on attribute values Assert.AreEqual((double)1545566400, parsed.From);