Namespace: DeltaEngine.Multimedia.Tests
Assembly: DeltaEngine.Multimedia.Tests (in DeltaEngine.Multimedia.Tests.dll) Version: 1.1.1.0 (1.1.1)
Assembly: DeltaEngine.Multimedia.Tests (in DeltaEngine.Multimedia.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Examples
[Test] public void PlayAndStop() { var sound = ContentLoader.Load<Sound>("DefaultSound"); Assert.IsFalse(sound.IsAnyInstancePlaying); sound.Play(); Assert.IsTrue(sound.IsAnyInstancePlaying); sound.StopAll(); WaitUntilSoundStateIsUpdated(); Assert.IsFalse(sound.IsAnyInstancePlaying); sound.Play(); }
[Test] public void PlayAndStopEvents() { var sound = ContentLoader.Load<Sound>("DefaultSound"); sound.OnPlay += instance => Assert.True(sound.IsAnyInstancePlaying); sound.OnStop += instance => Assert.False(sound.IsAnyInstancePlaying); sound.Play(); sound.StopAll(); WaitUntilSoundStateIsUpdated(); }
[Test] public void PlayAndStopInstance() { var sound = ContentLoader.Load<Sound>("DefaultSound"); var instance = sound.CreateSoundInstance(); Assert.IsFalse(sound.IsAnyInstancePlaying); Assert.AreEqual(0f, instance.PositionInSeconds); instance.Play(); Assert.IsTrue(sound.IsAnyInstancePlaying); WaitUntilSoundStateIsUpdated(); Assert.Greater(instance.PositionInSeconds, 0f); sound.StopAll(); WaitUntilSoundStateIsUpdated(); Assert.AreEqual(0f, instance.PositionInSeconds); Assert.IsFalse(sound.IsAnyInstancePlaying); }
See Also