From 45563553ee5e8a43090d19aa8c10bfc341f0bf3d Mon Sep 17 00:00:00 2001 From: Johan Klinge Date: Tue, 8 Jan 2019 15:35:26 +0100 Subject: [PATCH] Changed method name, added integration test --- .../Commands/UserGetWeeklyChartTests.cs | 23 +++++++++++++++++++ src/IF.Lastfm.Core/Api/IUserApi.cs | 2 +- src/IF.Lastfm.Core/Api/UserApi.cs | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyChartTests.cs diff --git a/src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyChartTests.cs b/src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyChartTests.cs new file mode 100644 index 0000000..9d7e8c0 --- /dev/null +++ b/src/IF.Lastfm.Core.Tests.Integration/Commands/UserGetWeeklyChartTests.cs @@ -0,0 +1,23 @@ +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 UserGetWeeklyChartTests : CommandIntegrationTestsBase + { + [Test] + public async Task GetChartList_Success() + { + var response = await Lastfm.User.GetWeeklyChartListAsync(INTEGRATION_TEST_USER); + var chartlist = response.Content; + + Assert.IsTrue(response.Success); + Assert.IsNotEmpty(chartlist); + Assert.That(chartlist.Last().ToDate, Is.EqualTo(DateTime.Now).Within(8).Days); + } + } +} diff --git a/src/IF.Lastfm.Core/Api/IUserApi.cs b/src/IF.Lastfm.Core/Api/IUserApi.cs index 5fb7ba7..b2936f1 100644 --- a/src/IF.Lastfm.Core/Api/IUserApi.cs +++ b/src/IF.Lastfm.Core/Api/IUserApi.cs @@ -40,6 +40,6 @@ Task> GetShoutsAsync(string username, Task> GetLovedTracks(string username, int pagenumber, int count); - Task> GetWeeklyChartList(string username); + Task> GetWeeklyChartListAsync(string username); } } \ No newline at end of file diff --git a/src/IF.Lastfm.Core/Api/UserApi.cs b/src/IF.Lastfm.Core/Api/UserApi.cs index ba5140d..f5985ab 100644 --- a/src/IF.Lastfm.Core/Api/UserApi.cs +++ b/src/IF.Lastfm.Core/Api/UserApi.cs @@ -132,7 +132,7 @@ public async Task> GetLovedTracks( }; return await command.ExecuteAsync(); } - public async Task> GetWeeklyChartList(string username) + public async Task> GetWeeklyChartListAsync(string username) { var command = new GetWeeklyChartsCommand(auth: Auth, username: username) {