public void DontTouchWaveSourceTest() { using (var source = new DisposableSource(GetWaveSource())) { _soundOut.Initialize(source); _soundOut.Play(); Thread.Sleep(100); Assert.AreEqual(PlaybackState.Playing, _soundOut.PlaybackState); _soundOut.Dispose(); Assert.IsFalse(source.IsDisposed); } }
public void SoundOutBehaviour() { using (var source = new DisposableSource(GetLoopingWaveSource())) { Assert.AreEqual(PlaybackState.Stopped, _soundOut.PlaybackState); _soundOut.Initialize(source); Assert.AreEqual(PlaybackState.Stopped, _soundOut.PlaybackState); _soundOut.Play(); Assert.AreEqual(PlaybackState.Playing, _soundOut.PlaybackState); Thread.Sleep(20); _soundOut.Pause(); Assert.AreEqual(PlaybackState.Paused, _soundOut.PlaybackState); Thread.Sleep(20); _soundOut.Resume(); Assert.AreEqual(PlaybackState.Playing, _soundOut.PlaybackState); Thread.Sleep(20); _soundOut.Dispose(); Assert.IsFalse(source.IsDisposed, "{0} disposed source.", _soundOut.GetType().FullName); } }