private void TestPlayStateSetup(Game game) { BuildEntityHierarchy(); CreateAndAddListenerComponentToEntities(); CreateAndAddEmitterComponentToEntities(); AddSoundEffectToEmitterComponents(game); AddRootEntityToEntitySystem(game); // add an extra listener. var extraList = new AudioListenerComponent(); var extraListEntity = new Entity(); extraListEntity.Add(extraList); Internal.Refactor.ThrowNotImplementedException("TODO: UPDATE TO USE Scene and Graphics Composer"); //game.Entities.Add(extraListEntity); // check that PlayState always returns 'PlayState.Stopped' when there are no listeners mainController.Play(); Assert.True(PlayState.Stopped == mainController.PlayState, "Value of playState without listeners is not valid after call to play."); mainController.Pause(); Assert.True(PlayState.Stopped == mainController.PlayState, "Value of playState without listeners is not valid after call to Pause."); mainController.Stop(); Assert.True(PlayState.Stopped == mainController.PlayState, "Value of playState without listeners is not valid after call to Stop."); // check values with listeners AddListenersToAudioSystem(game); mainController.Play(); Assert.True(PlayState.Playing == mainController.PlayState, "Value of playState with listeners is not valid after call to play."); mainController.Pause(); Assert.True(PlayState.Paused == mainController.PlayState, "Value of playState with listeners is not valid after call to Pause."); mainController.Stop(); Assert.True(PlayState.Stopped == mainController.PlayState, "Value of playState with listeners is not valid after call to Stop."); mainController.Play(); Assert.True(PlayState.Playing == mainController.PlayState, "Value of playState with listeners is not valid after a second call to play."); mainController.Pause(); Assert.True(PlayState.Paused == mainController.PlayState, "Value of playState with listeners is not valid after a second call to Pause."); mainController.Play(); Assert.True(PlayState.Playing == mainController.PlayState, "Value of playState with listeners is not valid after a third call to play."); }
private void TestPlayStateSetup(Game game) { BuildEntityHierarchy(); CreateAndAddListenerComponentToEntities(); CreateAndAddEmitterComponentToEntities(); AddSoundEffectToEmitterComponents(game); AddRootEntityToEntitySystem(game); // add an extra listener. var extraList = new AudioListenerComponent(); var extraListEntity = new Entity(); extraListEntity.Add(extraList); game.Entities.Add(extraListEntity); // check that PlayState always returns 'SoundPlayState.Stopped' when there are no listeners mainController.Play(); Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "Value of playState without listeners is not valid after call to play."); mainController.Pause(); Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "Value of playState without listeners is not valid after call to Pause."); mainController.Stop(); Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "Value of playState without listeners is not valid after call to Stop."); // check values with listeners AddListenersToAudioSystem(game); mainController.Play(); Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "Value of playState with listeners is not valid after call to play."); mainController.Pause(); Assert.AreEqual(SoundPlayState.Paused, mainController.PlayState, "Value of playState with listeners is not valid after call to Pause."); mainController.Stop(); Assert.AreEqual(SoundPlayState.Stopped, mainController.PlayState, "Value of playState with listeners is not valid after call to Stop."); mainController.Play(); Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "Value of playState with listeners is not valid after a second call to play."); mainController.Pause(); Assert.AreEqual(SoundPlayState.Paused, mainController.PlayState, "Value of playState with listeners is not valid after a second call to Pause."); mainController.Play(); Assert.AreEqual(SoundPlayState.Playing, mainController.PlayState, "Value of playState with listeners is not valid after a third call to play."); }