public void GetAllComponentsReturnsAllRegisteredComponents() { var component1 = new DummyStayOnDeathComp(this.TestEntity); var component2 = new DummyDieOnDeathComp(this.TestEntity); this.TestSystem.RegisterComponent(component1); this.TestSystem.RegisterComponent(component2); var list = this.TestSystem.GetAllRegisteredComponents(); Assert.Contains(component1, list); Assert.Contains(component2, list); }
public void DeRegisterComponentRemovesComponentFrom() { var component1 = new DummyStayOnDeathComp(this.TestEntity); var component2 = new DummyDieOnDeathComp(this.TestEntity); this.TestSystem.RegisterComponent(component1); this.TestSystem.RegisterComponent(component2); this.TestSystem.DeRegisterComponent(component1); List <IComponent> compList = this.TestSystem.GetComponentsOfEntity(this.TestEntity); Assert.Contains(component2, compList); Assert.IsFalse(compList.Contains(component1)); }
public void CanQueryAllComponentsOnEntity() { var component1 = new DummyStayOnDeathComp(this.TestEntity); var component2 = new DummyDieOnDeathComp(this.TestEntity); var component3 = new DummyStayOnDeathComp(this.TestEntity2); this.TestSystem.RegisterComponent(component1); this.TestSystem.RegisterComponent(component2); this.TestSystem.RegisterComponent(component3); List <IComponent> compList = this.TestSystem.GetComponentsOfEntity(this.TestEntity); Assert.Contains(component1, compList); Assert.Contains(component2, compList); Assert.IsFalse(compList.Contains(component3)); }
public void DifferentComponentsStoredInDifferendLists() { var component1 = new DummyStayOnDeathComp(this.TestEntity); var component2 = new DummyDieOnDeathComp(this.TestEntity); this.TestSystem.RegisterComponent(component1); this.TestSystem.RegisterComponent(component2); var comps1 = this.TestSystem.GetComponentsOfType <DummyStayOnDeathComp>(); var comps2 = this.TestSystem.GetComponentsOfType <DummyDieOnDeathComp>(); Assert.Contains(component1, comps1); Assert.Contains(component2, comps2); Assert.IsTrue(comps1.Contains(component1)); Assert.IsTrue(comps2.Contains(component2)); Assert.AreEqual(1, comps1.Count); Assert.AreEqual(1, comps2.Count); }