- Home /
NUnit delayed constraint does not appear to work in playmode test
I'm attempting to check that a condition is met after n seconds. I thought I could use the After method to do this, but it's not working as I expected. Am I doing something wrong here?
The test seems to fail instantly, instead of after delayInMilliseconds.
Using Unity 2019.1.14f1, NUnit 3.5.0.0.
Example:
 // fails
 [Test]
 public void TimePassed_Polling()
 {
     Assert.That(
         () => Time.time > 5.0f,
         Is.True.After(delayInMilliseconds: 6000, pollingInterval: 100));
 }
 
 // passes
 [UnityTest]
 public IEnumerator TimePassed_Wait()
 {
     yield return new WaitForSeconds(6.0f);
 
     Assert.That(() => Time.time > 5.0f);
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Unit Testing Rigidbody2D without polluting scene with gameobjects 1 Answer
MSTools instead of NUnit 0 Answers
Unity 5.6 Unit Testing 1 Answer
NUnit and VisualStudio 2 Answers
Can I run Unit Tests in Visual Studio using the Unity Test Tools? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                