public void ErrorTest()
 {
     PlayControl target = new PlayControl();
     target.Failed += new EventHandler<PlayControlFailedEventArgs>(target_Failed);
     _FailedException = null;
     count = 0;
     target.Start(() => ErrorAction());
     Thread.Sleep(200);
     Assert.AreEqual(PlayControl.States.Error, target.State);
     Assert.IsTrue(_FailedException is System.IO.IOException);
 }
 public void PauseTest()
 {
     #if DEBUG
     PlayControl target = new PlayControl();
     count = 0;
     target.Start(() => TestAction());
     Thread.Sleep(1000);
     target.Pause();
     //allow some time for the thread to change state
     Thread.Sleep(1000);
     Assert.IsTrue(count > 0);
     Assert.AreEqual(PlayControl.States.Paused, target.State);
     CheckCountNotIncreasing();
     #endif
 }
 public void PlayTest()
 {
     #if DEBUG
     PlayControl target = new PlayControl();
     count = 0;
     target.Start(() => TestAction());
     Thread.Sleep(200);
     target.Pause();
     //allow some time for the thread to change state
     Thread.Sleep(200);
     int countCheck = count;
     target.Play();
     //allow some time for the thread to change state
     Thread.Sleep(300);
     Assert.AreEqual(PlayControl.States.Playing, target.State);
     //check that count is increasing
     Assert.IsTrue(count > countCheck);
     target.Stop();
     #endif
 }
 public void StopTest()
 {
     PlayControl target = new PlayControl();
     count = 0;
     target.Start(() => TestAction());
     Thread.Sleep(200);
     target.Stop();
     //allow some time for the thread to change state
     Thread.Sleep(200);
     Assert.IsTrue(count > 0);
     Assert.AreEqual(PlayControl.States.Stopped, target.State);
     CheckCountNotIncreasing();
 }
 public void StartTest3()
 {
     PlayControl target = new PlayControl();
     count = 0;
     target.Stop();
     target.Start(() => TestAction());
     Thread.Sleep(200);
     Assert.AreEqual(PlayControl.States.Playing, target.State);
     target.Stop();
 }
 public void StartTest1()
 {
     PlayControl target = new PlayControl();
     target.Start(null);
 }