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

            helper.Manager.PlaybackStopped += (sender, args) => {
                if (args.NextShadow == null)
                {
                    return;
                }
                args.Item       = args.NextShadow;
                args.NextShadow = null;
            };

            // 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.InvokeSongEnd();

            // item gets filled in by event handler, is added to queue and plays now
            helper.Play(QueueItems[1], 1);
            helper.InvokeSongEnd();

            helper.AssertAtEndOfPlay();
            helper.CheckTasksCanceled(0);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void SimplePlayTest()
        {
            var helper = new PlayTestHelper();

            var queueItem = QueueItems[0];

            helper.Enqueue(queueItem);
            helper.CheckIsPreparing(queueItem);
            helper.Play(queueItem, 0);
            helper.InvokeSongEnd();

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