Пример #1
0
        public void DeleteEntity_DeletesTheEntityAndAllComponents()
        {
            var scriptComponent   = new Mock <IScriptComponent>();
            var positionComponent = new PositionComponent();

            var entity = _target.CreateEntity();

            _target.AddComponent(entity, scriptComponent.Object);
            _target.AddComponent(entity, positionComponent);
            _target.DeleteEntity(entity);

            Assert.IsFalse(_target.GetComponents <IScriptComponent>().Any());
            Assert.IsFalse(_target.GetComponents <PositionComponent>().Any());
            Assert.IsFalse(_target.GetEntitiesWithComponent <IScriptComponent>().Any());
            Assert.IsFalse(_target.GetEntitiesWithComponent <PositionComponent>().Any());
            Assert.IsFalse(_target.Entities.Any());
        }