Exemplo n.º 1
0
        public void Play_A_Music_File()
        {
            var file = new FileInfo(".\\Tests\\Pulp_Fiction_Jimmys_Coffee.mp3");

            file.Exists.Should().BeTrue();

            IMediaPlayer player = new WindowsMediaPlayer();

            player.Source = new Uri(file.FullName);

            player.Play();
            player.IsPlaying.Should().BeTrue();

            Thread.Sleep(1000);
            player.Stop();
        }
Exemplo n.º 2
0
        public void Play_Triggers_An_Event()
        {
            var file = new FileInfo(".\\Tests\\Pulp_Fiction_Jimmys_Coffee.mp3");

            file.Exists.Should().BeTrue();

            IMediaPlayer sut = new WindowsMediaPlayer();

            using (var monitor = sut.Monitor())
            {
                sut.Source = new Uri(file.FullName);

                sut.Play();
                Thread.Sleep(5000);

                // does not work!
                monitor.Should().Raise("PositionChanged").WithSender(sut).WithArgs <EventArgs>(e => e.Equals(EventArgs.Empty));
                sut.Stop();
            }
        }