public IEnumerator CompleteWhenTouched() { // Setup object with mocked grabbed property and activate GameObject obj = new GameObject("T1"); TouchablePropertyMock mockedProperty = obj.AddComponent <TouchablePropertyMock>(); yield return(new WaitForFixedUpdate()); TouchedCondition condition = new TouchedCondition(mockedProperty); condition.LifeCycle.Activate(); while (condition.LifeCycle.Stage != Stage.Active) { yield return(null); condition.Update(); } // When the object is touched mockedProperty.SetTouched(true); yield return(null); condition.Update(); // Assert that condition is now completed Assert.IsTrue(condition.IsCompleted); }
public IEnumerator CompleteWhenItIsDoneOnStart() { // Setup object with mocked grabbed property and activate GameObject obj = new GameObject("T1"); TouchablePropertyMock mockedProperty = obj.AddComponent <TouchablePropertyMock>(); mockedProperty.SetTouched(true); yield return(new WaitForFixedUpdate()); TouchedCondition condition = new TouchedCondition(mockedProperty); condition.LifeCycle.Activate(); while (condition.IsCompleted == false) { yield return(null); condition.Update(); } // Assert that condition is now completed due IsGrabbed being true Assert.IsTrue(condition.IsCompleted); }