#NUnit.Framework Assert AudioSource

1 messages · Page 1 of 1 (latest)

north holly
#

Im testing my Settings Panel, and i wanna test the volume of my sound plays correctly

#

Im using PlayOneShot and i dont know how i can assert volume, clip and others params

north holly
#
    public void playEffect()
    {
        effectAduioSource.PlayOneShot(correct, (float)DataClass.SETTINGS_VOLUME_EFFECTS / 100);
    }
#
    [UnityTest]
    public IEnumerator playEffect()
    {
        soundManager.playEffect();

        yield return new WaitForSeconds(0);

        Assert.That(soundManager.effectAduioSource.isPlaying);
        Assert.AreEqual(soundManager.effectAduioSource.clip, soundManager.correct);
        Assert.AreEqual(soundManager.effectAduioSource.volume, (float)DataClass.SETTINGS_VOLUME_MUSIC / 100);
    }