Exemple #1
0
        public IEnumerator CreatingRunnerOnDestroyedComponentThrows()
        {
            var go   = new GameObject("TestGameObject");
            var comp = go.AddComponent <MockComponent>();

            Object.DestroyImmediate(comp);

            Assert.Throws <MissingReferenceException>(() => ComponentExtensions.GetTaskRunner(comp));
            Assert.Throws <MissingReferenceException>(() => ComponentExtensions.StartTask(comp, () => Task.CompletedTask));

            // Cleanup.
            yield return(null);

            Object.Destroy(go);
        }
Exemple #2
0
 public IEnumerator NullComponentThrowsArgumentNullException()
 {
     Assert.Throws <System.ArgumentNullException>(() => ComponentExtensions.GetTaskRunner(null));
     Assert.Throws <System.ArgumentNullException>(() => ComponentExtensions.StartTask(null, () => Task.CompletedTask));
     yield break;
 }