Example #1
0
        public void IndexedGet_ReturnsExpected_Sound()
        {
            var sound = new Sound(adapter.Object, 1, 1);
            manager.Add(sound, "sound-effect");

            manager["sound-effect"].ShouldBeSameAs(sound);
        }
Example #2
0
        public void SetUp()
        {
            adapter = new Mock<IOpenAlAdapter>();
            adapter.Setup(a => a.GenSource()).Returns(1);
            adapter.Setup(a => a.GenBuffer()).Returns(4);
            adapter.Setup(a => a.GetGain(It.IsAny<int>())).Returns(1.0f);

            sound = new Sound(adapter.Object, 1, 4);
        }
Example #3
0
        public void Add_ThrowsArgumentException_OnExistingSound()
        {
            var existing = new Sound(adapter.Object, 1, 1);
            Action add = () => manager.Add(existing, "sound1");

            add();
            // now adding a second time should throw...
            add.ShouldThrow<ArgumentException>().Message.ShouldContain(
                "The given sound is already in the sound manager"
            );
        }
Example #4
0
        public void Add_ThrowsArgumentException_OnExistingName()
        {
            var first = new Sound(adapter.Object, 1, 1);
            var second = new Sound(adapter.Object, 2, 2);
            Action<Sound> add = (s) => manager.Add(s, "sound1");

            add(first);
            // now adding a second time should throw...
            Assert.Throws<ArgumentException>(() => add(second)).Message.ShouldContain(
                "The given name: sound1 is already in use in the sound manager"
            );
        }