예제 #1
0
        public void PlayTestMultipleSongsWithFailures()
        {
            var helper = new PlayTestHelper();

            foreach (var item in QueueItems)
            {
                helper.Enqueue(item);
            }

            // Let a few songs fail
            for (var i = 0; i < Iterations; ++i)
            {
                var queueItem = QueueItems[i];

                if (ShouldFailSong(i))
                {
                    helper.FailLoad(queueItem);
                    continue;
                }

                helper.Play(queueItem, i);
                helper.InvokeSongEnd();
            }

            helper.AssertAtEndOfPlay();
            helper.CheckTasksCanceled(0);
        }
예제 #2
0
        public void PlayTestMultipleSongsWithFailuresLoadBeforeSongEnd()
        {
            var helper = new PlayTestHelper();

            foreach (var item in QueueItems)
            {
                helper.Enqueue(item);
            }

            if (ShouldFailSong(0))
            {
                helper.FailLoad(QueueItems[0]);
            }

            // Let a few songs fail
            // current song is already prepared
            for (var i = 0; i < Iterations; ++i)
            {
                var queueItem = QueueItems[i];

                if (ShouldFailSong(i))
                {
                    continue;
                }

                helper.Play(queueItem, i);

                for (var j = i + 1; j < Iterations; ++j)
                {
                    if (ShouldFailSong(j))
                    {
                        helper.FailLoad(QueueItems[j]);
                    }
                    else
                    {
                        break;
                    }
                }

                helper.InvokeSongEnd();
            }

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