public void AwakeLogsWarningForMultipleActiveGameObjects() { GameObjectsAssociationMock associationMock = containingObject.AddComponent <GameObjectsAssociationMock>(); associationMock.GameObjects = containingObject.AddComponent <GameObjectObservableList>(); associationMock.GameObjects.Add(new GameObject()); associationMock.GameObjects.Add(new GameObject()); subject.Associations.Add(associationMock); Debug.Log("This test is expecting a warning to be logged next."); LogAssert.Expect(LogType.Warning, new Regex("multiple association")); subject.ManualAwake(); Debug.Log("Warning log recognized, the test is successful."); }
public void CurrentAssociationUpdatesProperly() { Assert.IsNull(subject.CurrentAssociation); GameObjectsAssociationMock associationMock = containingObject.AddComponent <GameObjectsAssociationMock>(); associationMock.GameObjects = containingObject.AddComponent <GameObjectObservableList>(); associationMock.shouldBeActive = true; subject.Associations.Add(associationMock); subject.Activate(); Assert.AreEqual(associationMock, subject.CurrentAssociation); subject.Deactivate(); Assert.IsNull(subject.CurrentAssociation); }
public void SetsGameObjectsActivationState() { GameObject gameObject = new GameObject(); gameObject.SetActive(false); GameObjectsAssociationMock associationMock = containingObject.AddComponent <GameObjectsAssociationMock>(); associationMock.GameObjects = containingObject.AddComponent <GameObjectObservableList>(); associationMock.GameObjects.Add(gameObject); associationMock.shouldBeActive = true; subject.Associations.Add(associationMock); subject.Activate(); Assert.IsTrue(gameObject.activeSelf); subject.Deactivate(); Assert.IsFalse(gameObject.activeSelf); }