Example #1
0
        public void ValidateThatCachedGroupContainsNewlyCreatedEntity()
        {
            SetupGroupEntities();

            var g = _defaultContext.GetGroup(matcherAB);

            eA.AddComponentB();
            Assert.Contains(eA, g.GetEntities());
        }
Example #2
0
        private void SetupGroupEntities()
        {
            eAB1 = _defaultContext.CreateEntity();
            eAB1.AddComponentA();
            eAB1.AddComponentB();

            eAB2 = _defaultContext.CreateEntity();
            eAB2.AddComponentA();
            eAB2.AddComponentB();

            eA = _defaultContext.CreateEntity();
            eA.AddComponentA();
        }
Example #3
0
        public void OnlyAddsCopiesOfSpecifiedComponentsToTargetEntity()
        {
            _originalEntity.AddComponentA();
            _originalEntity.AddComponentB();
            _originalEntity.AddComponentC();
            _originalEntity.CopyTo(
                _targetEntity,
                false,
                MyTestComponentsLookup.ComponentB,
                MyTestComponentsLookup.ComponentC);

            Assert.AreEqual(2, _targetEntity.GetComponents().Length);
            Assert.IsTrue(_targetEntity.HasComponentB());
            Assert.IsTrue(_targetEntity.HasComponentC());
        }
        public void Setup()
        {
            _eA = TestTools.CreateEntity();
            _eA.AddComponentA();

            _eB = TestTools.CreateEntity();
            _eB.AddComponentB();

            _eC = TestTools.CreateEntity();
            _eC.AddComponentC();

            _eAb = TestTools.CreateEntity();
            _eAb.AddComponentA();
            _eAb.AddComponentB();

            _eAbc = TestTools.CreateEntity();
            _eAbc.AddComponentA();
            _eAbc.AddComponentB();
            _eAbc.AddComponentC();
        }
        public void OnlyAddsCopiesOfSpecifiedComponentsToTargetEntity()
        {
            _entity.AddComponentA();
            _entity.AddComponentB();
            _entity.AddComponentC();

#pragma warning disable CS0618  // Type or member is obsolete
#pragma warning disable HAA0101 // Array allocation for params parameter
            _entity.CopyTo(
                _target,
                false,
                CID.ComponentB,
                CID.ComponentC);
#pragma warning restore HAA0101 // Array allocation for params parameter
#pragma warning restore CS0618  // Type or member is obsolete

            Assert.AreEqual(2, _target.GetComponents().Length);
            Assert.IsTrue(_target.HasComponentB());
            Assert.IsTrue(_target.HasComponentC());
        }
Example #6
0
        public void ValidateGetAllComponents()
        {
            _defaultEntity.AddComponentA();
            _defaultEntity.AddComponentB();

            var components = _defaultEntity.GetComponents();

            Assert.AreEqual(2, components.Length);
            Assert.Contains(Component.A, components);
            Assert.Contains(Component.B, components);
        }