public void Play_And_Pause_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(); Thread.Sleep(2000); player.Pause(); Thread.Sleep(2000); player.Play(); Thread.Sleep(3000); player.Stop(); }
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(); } }