Пример #1
0
        public void TestBuildEntityMixed(uint id)
        {
            TestIt testIt = new TestIt(2);

            _entityFactory.BuildEntity <TestEntityWithComponentViewAndComponent>(new EGID(id, group1), new[] { testIt });
            _simpleSubmissionEntityViewScheduler.SubmitEntities();

            Assert.IsTrue(_neverDoThisIsJustForTheTest.HasEntity <TestEntityViewComponent>(new EGID(id, group1)));
            Assert.IsTrue(_neverDoThisIsJustForTheTest.HasAnyEntityInGroup <TestEntityComponent>(group1));
            Assert.IsTrue(_neverDoThisIsJustForTheTest.HasAnyEntityInGroup <TestEntityViewComponent>(group1));
            var(entityCollection, count) =
                _neverDoThisIsJustForTheTest.entitiesDB.QueryEntities <TestEntityViewComponent>(group1);
            Assert.AreSame(entityCollection[0].TestIt, testIt);
        }
Пример #2
0
        public void TestBuildEntityWithViewStructWithImplementorAndTestQueryEntitiesAndIndex(uint id)
        {
            var testIt = new TestIt(2);

            _entityFactory.BuildEntity <TestDescriptorEntityView>(new EGID(id, group1), new[] { testIt });
            _simpleSubmissionEntityViewScheduler.SubmitEntities();

            Assert.IsTrue(_neverDoThisIsJustForTheTest.HasAnyEntityInGroup <TestEntityViewComponent>(group1));

            uint index;
            var  testEntityView2 =
                _neverDoThisIsJustForTheTest.entitiesDB.QueryEntitiesAndIndex <TestEntityViewComponent>(
                    new EGID(id, group1), out index)[index];

            Assert.AreEqual(testEntityView2.TestIt, testIt);
        }