public void OnRemoveEntity_should_remove_entity_and_deallocate_world_command_providers() { var entity = SetupTestEntity(); var createEntityRequestsHandle = entityManager.GetComponentData <WorldCommands.CreateEntity.CommandSender>(entity).Handle; var deleteEntityRequestsHandle = entityManager.GetComponentData <WorldCommands.DeleteEntity.CommandSender>(entity).Handle; var entityQueryRequestsHandle = entityManager.GetComponentData <WorldCommands.EntityQuery.CommandSender>(entity).Handle; var reserveEntityIdsRequestsHandle = entityManager.GetComponentData <WorldCommands.ReserveEntityIds.CommandSender>(entity).Handle; using (var wrappedOp = WorkerOpFactory.CreateRemoveEntityOp(TestEntityId)) { receiveSystem.OnRemoveEntity(wrappedOp.Op); } Assert.IsFalse(entityManager.Exists(entity)); Assert.IsFalse(worker.TryGetEntity(new EntityId(TestEntityId), out _)); Assert.Throws <ArgumentException>(() => WorldCommands.CreateEntity.RequestsProvider.Get(createEntityRequestsHandle)); Assert.Throws <ArgumentException>(() => WorldCommands.DeleteEntity.RequestsProvider.Get(deleteEntityRequestsHandle)); Assert.Throws <ArgumentException>(() => WorldCommands.EntityQuery.RequestsProvider.Get(entityQueryRequestsHandle)); Assert.Throws <ArgumentException>(() => WorldCommands.ReserveEntityIds.RequestsProvider.Get(reserveEntityIdsRequestsHandle)); }
public void OnRemoveEntity_should_error_if_entity_does_not_exist() { using (var wrappedOp = WorkerOpFactory.CreateRemoveEntityOp(TestEntityId)) { Assert.Throws <InvalidSpatialEntityStateException>(() => { receiveSystem.OnRemoveEntity(wrappedOp.Op); }); } }