Beispiel #1
0
        public void GetRecentTracksWithEmptyParams_EmptyResponseReturned()
        {
            var request = new LastFMGetRecentTracksRequest
            {
                ApiKey = string.Empty,
                User   = string.Empty,
                From   = null
            };

            sut = new LastFMMusicController(new DataRetrievalContext(contextOptions));
            var getResult = sut.GetRecentTracks(request);

            getResult.Result.Content.Should().BeNull();
        }
Beispiel #2
0
        public void GetRecentTracks_MusicHistoryReturned()
        {
            sut = new LastFMMusicController(new DataRetrievalContext(contextOptions));
            var request = new LastFMGetRecentTracksRequest
            {
                ApiKey = "some API key",
                User   = "******"
            };
            var getResult       = sut.GetRecentTracks(request);
            var retrievedTracks = getResult.Result.Content.ToList();

            retrievedTracks.Should().HaveCount(3);
            retrievedTracks.Should().BeEquivalentTo(listeningHistory);
        }
Beispiel #3
0
        public void GetRecentTracksWithAfterParam_MusicHistoryReturned()
        {
            var after       = DateTime.UtcNow.AddDays(-1);
            var afterAsUnix = ((DateTimeOffset)after).ToUnixTimeMilliseconds();
            var request     = new LastFMGetRecentTracksRequest
            {
                ApiKey = "some API key",
                User   = "******",
                From   = afterAsUnix
            };

            sut = new LastFMMusicController(new DataRetrievalContext(contextOptions));
            var getResult       = sut.GetRecentTracks(request);
            var retrievedTracks = getResult.Result.Content.ToList();

            retrievedTracks.Should().HaveCount(1);
            retrievedTracks.Should().NotBeEquivalentTo(listeningHistory);
            retrievedTracks[0].Should().BeEquivalentTo(DTOItem3);
        }