public void GetAllEntities_WithEmptyEntity() { var entity = m_Manager.CreateEntity(); var debugEntities = DebugEntity.GetAllEntities(m_Manager); EntitiesAssert.AreEqual( new[] { new DebugEntity(entity) }, debugEntities); }
public void GetAllEntities_WithTaggedEntity() { var entity = m_Manager.CreateEntity(typeof(EcsTestTag)); var debugEntities = DebugEntity.GetAllEntities(m_Manager); EntitiesAssert.AreEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(EcsTestTag), Data = new EcsTestTag() }) }, debugEntities); }
public void GetAllEntities_WithBufferElementData() { var entity = m_Manager.CreateEntity(); var buffer = m_Manager.AddBuffer <EcsIntElement>(entity); buffer.Add(1); buffer.Add(5); buffer.Add(9); var debugEntities = DebugEntity.GetAllEntities(m_Manager); EntitiesAssert.AreEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(EcsIntElement), Data = new EcsIntElement[] { 1, 5, 9 } }) }, debugEntities); }
public void GetAllEntities_WithSharedTagEntity() { var entity = m_Manager.CreateEntity(typeof(EcsTestSharedTag)); var debugEntities = DebugEntity.GetAllEntities(m_Manager); #if NET_DOTS // until ManagedComponentStore.GetSharedComponentDataBoxed supports an alternative to Activator to construct // a default instance of T, we can't support it here. once implemented, remove this special case to the test // and drop the try/catch from DebugComponent ctor. Assert.That( debugEntities[0].Components[0].Data, Is.InstanceOf <Exception>().With.Message.Match("Implement TypeManager.*DefaultValue")); #else EntitiesAssert.AreEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(EcsTestSharedTag), Data = new EcsTestSharedTag() }) }, debugEntities); #endif }
public void GetAllEntities_WithSharedComponentData() { var entity = m_Manager.CreateEntity(); m_Manager.AddSharedComponentData(entity, new EcsTestSharedComp(5)); var debugEntities = DebugEntity.GetAllEntities(m_Manager); EntitiesAssert.AreEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(EcsTestSharedComp), Data = new EcsTestSharedComp(5) }) }, debugEntities); EntitiesAssert.AreNotEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(EcsTestSharedComp), Data = new EcsTestSharedComp(6) }) }, debugEntities); }
public void GetAllEntities_WithComponentObject() { var entity = m_Manager.CreateEntity(); var component = new TestClassComponent { Value = 5 }; m_Manager.AddComponentObject(entity, component); var debugEntities = DebugEntity.GetAllEntities(m_Manager); EntitiesAssert.AreEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(TestClassComponent), Data = component }) }, debugEntities); // currently we are doing Equals comparisons, so validate it EntitiesAssert.AreEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(TestClassComponent), Data = new TestClassComponent { Value = 5 } }) }, debugEntities); EntitiesAssert.AreNotEqual( new[] { new DebugEntity(entity, new DebugComponent { Type = typeof(TestClassComponent), Data = new TestClassComponent { Value = 6 } }) }, debugEntities); }