Integration test for UserGetWeeklyArtistChart

This commit is contained in:
Johan Klinge 2019-01-09 14:18:13 +01:00
parent 695d318aaa
commit 6806ea4b9d
2 changed files with 34 additions and 2 deletions

View File

@ -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);
}
}
}

View File

@ -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);