Close() public méthode

public Close ( ) : void
Résultat void
Exemple #1
0
        public void TestMediaEngineService()
        {
            AssertTransition(null, () => service.Volume = 5, PlayerEvent.Volume);

            for (int i = 0; i < 3; i++)
            {
                WaitFor(PlayerState.Idle);

                // Assert the default, just-started-up idle state
                Assert.IsFalse(service.IsPlaying());
                Assert.AreEqual(null, service.CurrentTrack);
                Assert.AreEqual(null, service.CurrentSafeUri);

                LoadAndPlay("A_boy.ogg");
                Assert.AreEqual(0, service.CurrentTrack.PlayCount);

                for (int j = 0; j < 4; j++)
                {
                    AssertTransition(() => service.Pause(), PlayerState.Paused);
                    AssertTransition(() => service.Play(), PlayerState.Playing);
                    Assert.IsTrue(service.IsPlaying());
                    Thread.Sleep((int)(rand.NextDouble() * 100));
                }

                AssertTransition(() => service.Position = service.Length - 200, PlayerEvent.Seek);

                WaitFor(PlayerState.Idle, PlayerEvent.EndOfStream);
                Assert.AreEqual(1, service.CurrentTrack.PlayCount);

                service.Close(true);
            }

            play_when_idles = 0;
            Assert.AreEqual(PlayerState.Idle, service.CurrentState);
            service.Play();
            Thread.Sleep(50);
            Assert.AreEqual(1, play_when_idles);
            Assert.AreEqual(PlayerState.Idle, service.CurrentState);

            LoadAndPlay("A_boy.ogg");
            AssertTransition(() => service.TrackInfoUpdated(), PlayerEvent.TrackInfoUpdated);
            LoadAndPlay("A_girl.ogg");
            AssertTransition(() => service.TrackInfoUpdated(), PlayerEvent.TrackInfoUpdated);

            AssertTransition(() => service.Dispose(), PlayerState.Paused, PlayerState.Idle);
        }