public void OwnershipDisposale() { // Create a hierarchy of objects - // Physics is the root // Scene // Actor1 // Actor2 // Material1 // Material2 var physics = new MockPhysics(); var scene = new MockScene(); var mat1 = new MockMaterial(); var mat2 = new MockMaterial(); var actor1 = new MockActor(); var actor2 = new MockActor(); ObjectTable.Add(1, physics, null); ObjectTable.Add(2, mat1, physics); ObjectTable.Add(3, mat2, physics); ObjectTable.Add(4, scene, physics); ObjectTable.Add(5, actor1, scene); ObjectTable.Add(6, actor2, scene); // // Dispose of the root object. This should dispose all object beneath it recursively physics.Dispose(); Assert.IsTrue(physics.Disposed); Assert.IsTrue(mat1.Disposed); Assert.IsTrue(mat2.Disposed); Assert.IsTrue(scene.Disposed); Assert.IsTrue(actor1.Disposed); Assert.IsTrue(actor2.Disposed); }
public void LoadSceneTest() { MockScene scene = new MockScene(); SceneManager.Instance.LoadScene <MockScene>(); Assert.IsInstanceOfType(SceneManager.Instance.CurrentScene, typeof(MockScene), "wrong scenes"); }
public void DestroyEntityTestSuccess() { MockScene scene = new MockScene(); EntityMock entity = new EntityMock(); EntityMock created = scene.CreateEntity(entity) as EntityMock; Assert.IsTrue(scene.DestroyEntity(entity), "object was not existing"); }
public void CreateEntityTest() { MockScene scene = new MockScene(); EntityMock entity = new EntityMock(); EntityMock created = scene.CreateEntity(entity) as EntityMock; Assert.AreEqual(created, entity, "created entity is not same as mocked entity"); }
public void AddSceneToCollection() { var scene = new MockScene(); _sceneManager.AddScene(scene); _sceneManager.GetScenes().ShouldContain(scene); }
public void DestroyEntityNotExistingObject() { MockScene scene = new MockScene(); EntityMock entity = new EntityMock(); EntityMock entity2 = new EntityMock(); EntityMock created = scene.CreateEntity(entity) as EntityMock; Assert.IsFalse(scene.DestroyEntity(entity2)); }
public void CreateEntityTestAddMultipleTimes() { MockScene scene = new MockScene(); EntityMock entity = new EntityMock(); EntityMock created = scene.CreateEntity(entity) as EntityMock; EntityMock created2 = scene.CreateEntity(entity) as EntityMock; Assert.AreEqual(created2, null, "Same entity got created"); }
public void NotRemoveSceneUnlessTypeMatches() { var scene = new MockScene(); _sceneManager.AddScene(scene); _sceneManager.RemoveScene <IScene>(); _sceneManager.GetScenes().ShouldContain(scene); }
public void RemoveSceneFromCollection() { var scene = new MockScene(); _sceneManager.AddScene(scene); _sceneManager.RemoveScene <MockScene>(); _sceneManager.GetScenes().ShouldNotContain(scene); }
public void CreateTestWrong() { MockScene scene = new MockScene(); SceneManager.Instance.LoadScene <MockScene>(); UICreateArgs args = new UICreateArgs("abc", new Vector2(0, 0)); UIFactory factory = new UIFactory(); Assert.IsNull((Button)factory.Create(args)); }
public void SetNextSceneBasedOnType() { var scene = new MockScene(); _sceneManager.AddScene(scene); _sceneManager.AddScene(Substitute.For <IScene>()); _sceneManager.SetNextScene <MockScene>(); _sceneManager.NextScene.ShouldBe(scene); }
public void CreateTestButton() { MockScene scene = new MockScene(); SceneManager.Instance.LoadScene <MockScene>(); UICreateArgs args = new UICreateArgs("button", new Vector2(0, 0)); UIFactory factory = new UIFactory(); Button element = (Button)factory.Create(args); bool deleted = SceneManager.Instance.CurrentScene.DestroyEntity(element); Assert.IsTrue(deleted); }