Exemplo n.º 1
0
        public async Task HandleResponseSingle()
        {
            var command = new GetLovedTracksCommand(MAuth.Object, "rj")
            {
                Count = 1
            };
            var expectedTrack = new LastTrack
            {
                ArtistName = "Rick James",
                Mbid       = "",
                Name       = "Super Freak (Part 1) - 1981 Single Version",
                ArtistMbid = "cba9cec2-be8d-41bd-91b4-a1cd7de39b0c",

                TimePlayed = new DateTime(2014, 12, 20, 10, 16, 52, DateTimeKind.Utc),
                AlbumName  = "The Definitive Collection",
                Url        = new Uri("http://www.last.fm/music/Rick+James/_/Super+Freak+(Part+1)+-+1981+Single+Version", UriKind.Absolute),
                Images     = new LastImageSet(
                    "http://userserve-ak.last.fm/serve/34s/90462319.jpg",
                    "http://userserve-ak.last.fm/serve/64s/90462319.jpg",
                    "http://userserve-ak.last.fm/serve/126/90462319.jpg",
                    "http://userserve-ak.last.fm/serve/300x300/90462319.jpg")
            };
            var file     = GetFileContents("UserApi.UserGetLovedTracksSingle.json");
            var response = CreateResponseMessage(file);
            //var response = CreateResponseMessage(Encoding.UTF8.GetString(UserApiResponses.UserGetLovedTracksSingle));
            var actual = await command.HandleResponse(response);

            Assert.IsTrue(actual.Success);
            TestHelper.AssertSerialiseEqual(expectedTrack, actual.Single());
        }
Exemplo n.º 2
0
        public async Task HandleResponseMultiple()
        {
            var command = new GetLovedTracksCommand(MAuth.Object, "rj")
            {
                Count = 3
            };

            var expectedTrack = new LastTrack
            {
                ArtistName = "The Rolling Stones",
                TimePlayed = new DateTime(2014, 12, 19, 16, 16, 56, DateTimeKind.Utc),
                Mbid       = "3dde65c8-22c3-4637-b67e-b234177c847b",
                Name       = "Love in Vain",
                ArtistMbid = "b071f9fa-14b0-4217-8e97-eb41da73f598",
                AlbumName  = "Let It Bleed",
                Url        = new Uri("http://www.last.fm/music/The+Rolling+Stones/_/Love+in+Vain"),
                Images     = new LastImageSet(
                    "http://userserve-ak.last.fm/serve/34s/101739037.png",
                    "http://userserve-ak.last.fm/serve/64s/101739037.png",
                    "http://userserve-ak.last.fm/serve/126/101739037.png",
                    "http://userserve-ak.last.fm/serve/300x300/101739037.png")
            };

            var file     = GetFileContents("UserApi.UserGetLovedTracksMultiple.json");
            var response = CreateResponseMessage(file);
            //var response = CreateResponseMessage(Encoding.UTF8.GetString(UserApiResponses.UserGetLovedTracksMultiple));
            var actual = await command.HandleResponse(response);

            Assert.IsTrue(actual.Success);
            TestHelper.AssertSerialiseEqual(expectedTrack, actual.Content[1]);
        }