protected override IEnumerator runTest()
        {
            string entityName            = "TestEntity1";
            string entityName2           = "TestEntity2";
            bool   flag                  = false;
            bool   flag2                 = false;
            bool   flag3                 = false;
            List <DataEntityHandle> list = new List <DataEntityHandle>();

            list.Add(dataEntityCollection.AddEntity(entityName));
            list.Add(dataEntityCollection.AddEntity(entityName2));
            if (dataEntityCollection.FindEntityByName(entityName) == dataEntityCollection.FindEntityByName(entityName))
            {
                flag = true;
            }
            if (dataEntityCollection.FindEntityByName(entityName) != dataEntityCollection.FindEntityByName(entityName2))
            {
                flag2 = true;
            }
            if (list.Contains(dataEntityCollection.FindEntityByName(entityName2)))
            {
                flag3 = true;
            }
            IntegrationTestEx.FailIf(!flag, "DataEntityHandle Equality Test Failed");
            IntegrationTestEx.FailIf(!flag2, "DataEntityHandle Inequality Test Failed");
            IntegrationTestEx.FailIf(!flag3, "DataEntityHandle List.Contains() Test Failed");
            yield break;
        }
Ejemplo n.º 2
0
 private static DataEntityHandle createRemotePlayerEntity(DataEntityCollection dataEntityCollection, string displayName)
 {
     if (!dataEntityCollection.TryFindEntity <DisplayNameData, string>(displayName, out DataEntityHandle dataEntityHandle))
     {
         dataEntityHandle = dataEntityCollection.AddEntity("rp_" + displayName);
     }
     if (!dataEntityCollection.HasComponent <DisplayNameData>(dataEntityHandle))
     {
         dataEntityCollection.AddComponent <DisplayNameData>(dataEntityHandle).DisplayName = displayName;
     }
     return(dataEntityHandle);
 }
        protected override IEnumerator runTest()
        {
            bool   addEntityPassed       = false;
            bool   removeEntityPassed    = false;
            bool   addComponentPassed    = false;
            bool   removeComponentPassed = false;
            string testEntity1           = "TestEntity1";

            dataEntityCollection.EventDispatcher.AddListener(delegate(DataEntityEvents.EntityAddedEvent evt)
            {
                if (evt.EntityHandle == dataEntityCollection.FindEntityByName(testEntity1))
                {
                    addEntityPassed = true;
                }
                return(false);
            });
            dataEntityCollection.EventDispatcher.AddListener(delegate(DataEntityEvents.EntityRemovedEvent evt)
            {
                if (evt.EntityHandle.Id == testEntity1)
                {
                    removeEntityPassed = true;
                }
                return(false);
            });
            dataEntityCollection.EventDispatcher.AddListener(delegate(DataEntityEvents.ComponentAddedEvent <MockComponent1> evt)
            {
                if (evt.Handle == dataEntityCollection.FindEntityByName(testEntity1) && evt.Component != null)
                {
                    addComponentPassed = true;
                }
                return(false);
            });
            dataEntityCollection.EventDispatcher.AddListener(delegate(DataEntityEvents.ComponentRemovedEvent evt)
            {
                if (dataEntityCollection.GetEntityByComponent(evt.Component) == dataEntityCollection.FindEntityByName(testEntity1) && evt.Component is MockComponent1)
                {
                    removeComponentPassed = true;
                }
                return(false);
            });
            DataEntityHandle handle = dataEntityCollection.AddEntity(testEntity1);

            dataEntityCollection.AddComponent <MockComponent1>(handle);
            dataEntityCollection.RemoveComponent <MockComponent1>(handle);
            dataEntityCollection.RemoveEntityByName(testEntity1);
            yield return(null);

            IntegrationTestEx.FailIf(!addEntityPassed, "Add Entity Failed");
            IntegrationTestEx.FailIf(!removeEntityPassed, "Remove Entity Failed");
            IntegrationTestEx.FailIf(!addComponentPassed, "Add Component Failed");
            IntegrationTestEx.FailIf(!removeComponentPassed, "Remove Component Failed");
        }
Ejemplo n.º 4
0
        protected override IEnumerator runTest()
        {
            string           testEntity1 = "TestEntity1";
            DataEntityHandle handle      = dataEntityCollection.AddEntity(testEntity1);

            dataEntityCollection.RemoveEntityByName(testEntity1);
            IntegrationTestEx.FailIf(!handle.IsNull, "DataEntityHandle is still valid");
            GC.Collect();
            yield return(null);

            Debug.Log("-*-*-*-*-*-*-*-* Hello there -*-*-*-*-*-*-*");
            IntegrationTestEx.FailIf(!handle.IsNull, "DataEntityHandle is still valid");
        }
Ejemplo n.º 5
0
        public override void AddComponent(DataEntityCollection dataEntityCollection)
        {
            DataEntityHandle handle = dataEntityCollection.AddEntity(entityName);

            dataEntityCollection.AddComponent <T>(handle);
        }