Example #1
0
        public async Task MoveTest()
        {
            var res1 = await Tracklist.Clear();

            Assert.True(res1);

            var res2 = await Library.Search(
                queryArtist : "Air Supply",
                queryAlbum : "Strangers In Love"
                );

            Assert.True(res2.Succeeded);
            Assert.True(1 <= res2.Result.Length);
            Assert.True(1 <= res2.Result.First().Tracks.Length);
            var uris = res2.Result.First().Tracks
                       .OrderBy(e => e.TrackNo)
                       .Select(e => e.Uri)
                       .ToArray();

            var res4 = await Tracklist.Add(uris);

            Assert.True(res4.Succeeded);

            // 2-3 -> index 5
            var res5 = await Tracklist.Move(2, 4, 5);

            var moved = new string[]
            {
                uris[0],
                uris[1],
                uris[4],
                uris[5],
                uris[6],
                uris[2],
                uris[3],
                uris[7],
                uris[8],
                uris[9],
                uris[10]
            };

            var res6 = await Tracklist.GetTlTracks();

            Assert.True(res6.Succeeded);
            Assert.Equal(moved.Length, res6.Result.Length);

            for (var i = 0; i < moved.Length; i++)
            {
                Assert.Equal(moved[i], res6.Result[i].Track.Uri);
            }
        }