void GetValue(ChangeMode mode)
        {
            EmptySystem.Update();
            var entityArray = EmptySystem.GetComponentGroup(typeof(EcsTestData)).GetEntityArray();

            if (mode == ChangeMode.ComponentDataArray)
            {
                var array = EmptySystem.GetComponentGroup(typeof(EcsTestData)).GetComponentDataArray <EcsTestData>();
                for (int i = 0; i != array.Length; i++)
                {
                    var val = array[i];
                }
            }
            else if (mode == ChangeMode.SetComponentData)
            {
                for (int i = 0; i != entityArray.Length; i++)
                {
                    m_Manager.GetComponentData <EcsTestData>(entityArray[i]);
                }
            }
            else if (mode == ChangeMode.SetComponentDataFromEntity)
            {
                for (int i = 0; i != entityArray.Length; i++)
                {
                    m_Manager.GetComponentData <EcsTestData>(entityArray[i]);
                }
            }
            else if (mode == ChangeMode.ComponentGroupArray)
            {
                foreach (var e in EmptySystem.GetEntities <GroupRO>())
                {
                    ;
                }
            }
        }
#pragma warning restore 649

        unsafe void SetValue(int index, int value, ChangeMode mode)
        {
            EmptySystem.Update();
            var entityArray = EmptySystem.GetComponentGroup(typeof(EcsTestData)).GetEntityArray();
            var entity      = entityArray[index];

            if (mode == ChangeMode.ComponentDataArray)
            {
                var array = EmptySystem.GetComponentGroup(typeof(EcsTestData)).GetComponentDataArray <EcsTestData>();
                array[index] = new EcsTestData(value);
            }
            else if (mode == ChangeMode.SetComponentData)
            {
                m_Manager.SetComponentData(entity, new EcsTestData(value));
            }
            else if (mode == ChangeMode.SetComponentDataFromEntity)
            {
                //@TODO: Chaining correctness... Definately not implemented right now...
                var array = EmptySystem.GetComponentDataFromEntity <EcsTestData>(false);
                array[entity] = new EcsTestData(value);
            }
            else if (mode == ChangeMode.ComponentGroupArray)
            {
                *(EmptySystem.GetEntities <GroupRW>()[index].Data) = new EcsTestData(value);
            }
        }
        public void ComponentGroupArraySubtractive()
        {
            m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));
            m_Manager.CreateEntity(typeof(EcsTestData));

            var entities = EmptySystem.GetEntities <TestEntitySub2>();

            Assert.AreEqual(1, entities.Length);
        }
        public void ComponentGroupArrayJobScheduleReadOnlyParallelIsAllowed()
        {
            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            m_Manager.SetComponentData(entity, new EcsTestData(42));

            var job = new TestReadOnlyJob();

            job.entities = EmptySystem.GetEntities <TestEntityReadOnly>();

            var fence  = job.Schedule();
            var fence2 = job.Schedule();

            JobHandle.CompleteAll(ref fence, ref fence2);
        }
        public void ComponentGroupArrayJobScheduleDetectsWriteDependency()
        {
            var entity = m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            m_Manager.SetComponentData(entity, new EcsTestData(42));

            var job = new TestCopy1To2Job();

            job.entities = EmptySystem.GetEntities <TestEntity>();

            var fence = job.Schedule();

            Assert.Throws <System.InvalidOperationException>(() => { job.Schedule(); });

            fence.Complete();
        }
        public void ComponentAccessAfterScheduledJobThrowsEntityArray()
        {
            m_Manager.CreateEntity(typeof(EcsTestData), typeof(EcsTestData2));

            var job = new TestCopy1To2Job();

            job.entities = EmptySystem.GetEntities <TestEntity>();

            var fence = job.Schedule();

            var entityArray = EmptySystem.GetEntities <TestEntity>();

            Assert.Throws <System.InvalidOperationException>(() => { var temp = entityArray[0]; });

            fence.Complete();
        }
        unsafe public void ComponentEnumerator()
        {
            var go     = new GameObject("test", typeof(Rigidbody), typeof(Light));
            var entity = GameObjectEntity.AddToEntityManager(m_Manager, go);

            m_Manager.AddComponentData(entity, new EcsTestData(5));
            m_Manager.AddComponentData(entity, new EcsTestData2(6));

            int iterations = 0;

            foreach (var e in EmptySystem.GetEntities <MyEntity>())
            {
                Assert.AreEqual(5, e.testData->value);
                Assert.AreEqual(6, e.testData2->value0);
                Assert.AreEqual(go.GetComponent <Light>(), e.light);
                Assert.AreEqual(go.GetComponent <Rigidbody>(), e.rigidbody);
                iterations++;
            }
            Assert.AreEqual(1, iterations);

            Object.DestroyImmediate(go);
        }