Ejemplo n.º 1
0
        public void PlayTestWithShadows()
        {
            var helper = new PlayTestHelper();

            // queue with one item, add shadow
            helper.Enqueue(QueueItems[0]);
            helper.Manager.NextSongShadow = QueueItems[1];
            helper.Play(QueueItems[0], 0);

            // first song is playing, check that the shadow is preparing
            helper.CheckIsPreparing(QueueItems[1]);
            helper.Enqueue(QueueItems[2]);

            // a new song is enqueued, check that it is preparing
            helper.CheckIsPreparing(QueueItems[2]);
            helper.CheckTasksCanceled(1);

            // next song index is valid
            helper.CheckNextSongIndex(1);

            helper.InvokeSongEnd();
            helper.Play(QueueItems[2], 1);

            // shadow is kept
            helper.CheckIsPreparing(QueueItems[1]);

            // next song index is still valid
            helper.CheckNextSongIndex(2);

            helper.InvokeSongEnd();
            helper.AssertAtEndOfQueue();

            // Add the shadow song when not playing and at end of queue
            helper.Enqueue(QueueItems[1]);
            helper.Play(QueueItems[1], 2);

            // shadow gets cleared after play
            Assert.AreSame(helper.Manager.NextSongShadow, null);
            helper.CheckIsPreparing(null);
            helper.CheckNextSongIndex(3);

            helper.InvokeSongEnd();

            helper.AssertAtEndOfPlay();
            helper.CheckTasksCanceled(1);
        }