public void GivenThatTheActiveSoundListPlaysASoundWithAGameObjectWillAddingTheSoundAgainWithoutAGameObjectResetThePanAndVolume() { var ass = new ActiveSoundService(); var sei = new DummySoundEffectInstance(); var gameObject = new Mock <IGameObject>(); gameObject.Setup(aliveGameObject => aliveGameObject.IsExtant).Returns(true); gameObject.Setup(objectToTheSide => objectToTheSide.Position).Returns(new Vector2(10, 10)); var centrePointProvider = new Mock <ICentrePointProvider>(); centrePointProvider.Setup(cp => cp.CentrePoint).Returns(Vector2.Zero); var activeSoundWithObject = new ActiveSoundForObject(sei, gameObject.Object, centrePointProvider.Object); var activeSoundWithoutObject = new ActiveSound(sei); ass.Add(activeSoundWithObject); ass.Add(activeSoundWithoutObject); Assert.AreEqual(1, ass.Count); activeSoundWithoutObject = (ActiveSound)ass[0]; Assert.IsTrue(sei.RestartPlayWhenStopped); ass.Update(); Assert.IsFalse(sei.RestartPlayWhenStopped); Assert.AreEqual(1, activeSoundWithoutObject.SoundEffectInstance.Volume); Assert.AreEqual(0, activeSoundWithoutObject.SoundEffectInstance.Pan); }
public void GivenThatTheActiveSoundListIsEmptyCanANewSoundWithoutGameObjectBeAddedAndHaveTheDefaultVolumeAndPanning() { var ass = new ActiveSoundService(); var sei = new DummySoundEffectInstance(); var activeSound = new ActiveSound(sei); ass.Add(activeSound); Assert.AreEqual(1, ass.Count); var item = ass[0]; Assert.AreEqual(SoundState.Playing, item.SoundEffectInstance.State); Assert.AreEqual(1, item.SoundEffectInstance.Volume); Assert.AreEqual(0, item.SoundEffectInstance.Pan); }
public void GivenThatTheActiveSoundListIsNotEmptyDoesClearLeaveItEmpty() { var ass = new ActiveSoundService(); var sei1 = new DummySoundEffectInstance { InstanceName = "one" }; var sei2 = new DummySoundEffectInstance { InstanceName = "two" }; var activeSound1 = new ActiveSound(sei1); var activeSound2 = new ActiveSound(sei2); ass.Add(activeSound1); ass.Add(activeSound2); ass.Clear(); ass.Update(); Assert.AreEqual(0, ass.Count); }