Example #1
0
        public void CanAddGameObjectsToStage()
        {
            var gameStage  = new MockGameStage();
            var gameObject = new GameObject();

            gameStage.AddGameObject(gameObject);
            Assert.IsTrue(gameStage.GameObjects.Contains(gameObject));
            var gameObject2 = new GameObject();

            gameStage.AddGameObject(gameObject2);
            Assert.IsTrue(gameStage.GameObjects.Contains(gameObject2));
        }
Example #2
0
        public void GameStageIsAssignedToTheGameObjectWhenAddedToTheStage()
        {
            var gameStage  = new MockGameStage();
            var gameObject = new GameObject();

            gameStage.AddGameObject(gameObject);
            Assert.AreSame(gameStage, gameObject.GameStage);
        }
Example #3
0
        public void CanRemoveGameObjectsFromStage()
        {
            var gameStage  = new MockGameStage();
            var gameObject = new GameObject();

            gameStage.AddGameObject(gameObject);
            gameStage.RemoveGameObject(gameObject);
            Assert.IsFalse(gameStage.GameObjects.Contains(gameObject));
        }
Example #4
0
        public void DestroyRemovesGameObjectFromStage()
        {
            var gameStage  = new MockGameStage();
            var gameObject = new GameObject();

            gameStage.AddGameObject(gameObject);
            gameObject.Destroy();
            Assert.IsFalse(gameStage.GameObjects.Contains(gameObject));
        }
Example #5
0
        public void CanRemoveObjectFromStageUsingDestroy()
        {
            var gameStage  = new MockGameStage();
            var gameObject = new GameObject();
            var behavior   = new MockBehavior();

            gameObject.AddComponent(behavior);
            gameStage.AddGameObject(gameObject);
            behavior.MockDestroy();
            Assert.IsFalse(gameStage.GameObjects.Contains(gameObject));
        }
Example #6
0
        public void DestroyRemovesGameObjectFromParent()
        {
            var gameStage = new MockGameStage();
            var parent    = new GameObject();

            gameStage.AddGameObject(parent);
            var child = new GameObject();

            parent.AddChild(child);
            child.Destroy();
            Assert.IsFalse(parent.Children.Contains(child));
            Assert.IsFalse(gameStage.GameObjects.Contains(child));
        }
Example #7
0
        public void ChildrenGameObjectsHaveAccessToGameStage()
        {
            var parent = new GameObject();
            var child  = new GameObject();

            parent.AddChild(child);

            var gameStage = new MockGameStage();

            gameStage.AddGameObject(parent);

            Assert.AreSame(gameStage, child.GameStage);
        }
Example #8
0
        public void CanAddGameObjectDirectlyToGameStageThroughAddGameObject()
        {
            var gameStage  = new MockGameStage();
            var gameObject = new GameObject();
            var behavior   = new MockBehavior();

            gameObject.AddComponent(behavior);
            gameStage.AddGameObject(gameObject);

            var gameObjectToAdd = new GameObject();

            behavior.AddGameObject(gameObjectToAdd);

            Assert.IsTrue(gameStage.GameObjects.Contains(gameObjectToAdd));
        }