public void SetAsChildOf_Should_set_created_entity_as_child() { using EntityCommandRecorder recorder = new EntityCommandRecorder(1024); using World world = new World(); Entity parent = world.CreateEntity(); EntityRecord record = recorder.CreateEntity(); record.SetAsChildOf(recorder.Record(parent)); recorder.Execute(world); Check.That(parent.GetChildren()).Contains(world.Skip(1).Single()); }
public void SetAsChildOf_Should_set_recorded_entity_as_child() { using (EntityCommandRecorder recorder = new EntityCommandRecorder(1024)) using (World world = new World()) { Entity parent = world.CreateEntity(); Entity entity = world.CreateEntity(); EntityRecord record = recorder.Record(entity); record.SetAsChildOf(recorder.Record(parent)); recorder.Execute(world); Check.That(parent.GetChildren()).Contains(entity); } }
public void RemoveFromChildrenOf_Should_set_created_entity_as_child() { using EntityCommandRecorder recorder = new EntityCommandRecorder(1024); using World world = new World(); Entity parent = world.CreateEntity(); EntityRecord parentRecord = recorder.Record(parent); EntityRecord record = recorder.CreateEntity(); record.SetAsChildOf(parentRecord); record.RemoveFromChildrenOf(parentRecord); recorder.Execute(world); Check.That(parent.GetChildren()).IsEmpty(); }