< Summary

Class:DCL.WaitUntil
Assembly:CoroutineHelpers
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/CoroutineHelpers/WaitUntil.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:34
Line coverage:100% (9 of 9)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
WaitUntil(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Helpers/CoroutineHelpers/WaitUntil.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public class WaitUntil : CustomYieldInstruction
 7    {
 8        Func<bool> predicate;
 9        float waitTime;
 10        bool waitEnabled = false;
 11
 42312        public WaitUntil(Func<bool> predicate, float? timeoutInSeconds = null)
 13        {
 42314            this.predicate = predicate;
 15
 42316            if (timeoutInSeconds.HasValue)
 17            {
 10218                waitEnabled = true;
 10219                waitTime = Time.realtimeSinceStartup + timeoutInSeconds.Value;
 20            }
 42321        }
 22
 23        public override bool keepWaiting
 24        {
 25            get
 26            {
 203627                if (waitEnabled)
 59128                    return !predicate() && Time.realtimeSinceStartup < waitTime;
 29                else
 144530                    return !predicate();
 31            }
 32        }
 33    }
 34}