Ejemplo n.º 1
0
        public void TaskDoesEndOnResolveAndReject()
        {
            bool value       = false;
            bool targetValue = true;

            UnityTask t = new UnityTask();

            t.Then(onEnd: () => value = targetValue);

            t.Resolve(null);

            Assert.AreEqual(value, targetValue);

            value = false;

            t = new UnityTask();
            t.Then(onEnd: () => value = targetValue);

            t.Reject(null);

            Assert.AreEqual(value, targetValue);

            value = false;

            t = new UnityTask();
            t.Then(onEnd: () => value = targetValue);

            t.Notify(0f);

            Assert.AreNotEqual(value, targetValue);
        }
Ejemplo n.º 2
0
        public void TaskDoesNotify()
        {
            float value       = 0f;
            float targetValue = 1f;

            UnityTask t = new UnityTask();

            t.Then(null, null, (p) => value = p);

            t.Notify(1f);

            Assert.That(Utils.Math.NearlyEqual(value, targetValue));
        }