Exemple #1
0
        public void CreateSoundIsCreated(string soundResRef)
        {
            Location startLocation = NwModule.Instance.StartingLocation;
            NwSound? sound         = NwSound.Create(soundResRef, startLocation);

            Assert.That(sound, Is.Not.Null, $"Sound {soundResRef} was null after creation.");
            Assert.That(sound !.IsValid, Is.True, $"Sound {soundResRef} was invalid after creation.");

            createdTestObjects.Add(sound);
        }
Exemple #2
0
        public void SerializeSoundCreatesValidData(string soundResRef)
        {
            Location startLocation = NwModule.Instance.StartingLocation;
            NwSound? sound         = NwSound.Create(soundResRef, startLocation);

            Assert.That(sound, Is.Not.Null, $"Sound {soundResRef} was null after creation.");
            Assert.That(sound !.IsValid, Is.True, $"Sound {soundResRef} was invalid after creation.");

            createdTestObjects.Add(sound);

            byte[]? soundData = sound.Serialize();

            Assert.That(soundData, Is.Not.Null);
            Assert.That(soundData, Has.Length.GreaterThan(0));

            NwSound?sound2 = NwSound.Deserialize(soundData !);

            Assert.That(sound2, Is.Not.Null);
            Assert.That(sound2 !.IsValid, Is.True);

            createdTestObjects.Add(sound2);

            Assert.That(sound2.Area, Is.Null);
        }
Exemple #3
0
        public static Sound FromNwSound(NwSound s)
        {
            var sound = new Sound(new MemoryStream(s.Data), s.Format);

            return(sound);
        }