diff --git a/src/Tests/ECS/CommandBuffer/Test_CommandBuffer_Events.cs b/src/Tests/ECS/CommandBuffer/Test_CommandBuffer_Events.cs index 656a797d..13b9c629 100644 --- a/src/Tests/ECS/CommandBuffer/Test_CommandBuffer_Events.cs +++ b/src/Tests/ECS/CommandBuffer/Test_CommandBuffer_Events.cs @@ -21,8 +21,10 @@ public static void Test_CommandBuffer_Events_Components() break; case 1: Mem.IsTrue(ComponentChangedAction.Update == changed.Action); - var old = changed.OldComponent(); - Mem.AreEqual(new Position(1,1,1), old); + Mem.AreEqual(new Position(1,1,1), changed.OldComponent()); +#pragma warning disable CS0618 // Type or member is obsolete + Mem.AreEqual(new Position(1,1,1), (Position)changed.DebugOldComponent); +#pragma warning restore CS0618 // Type or member is obsolete break; } }; @@ -56,6 +58,22 @@ public static void Test_CommandBuffer_Events_Components() AreEqual(1, removeCount); } + /// Cover changed Action == null at + [Test] + public static void Test_CommandBuffer_Events_cover_change_null() + { + var store = new EntityStore(); + store.OnComponentAdded += changed => { }; + + var entity = store.CreateEntity(); + entity.AddComponent(new Position()); + var ecb = store.GetCommandBuffer(); + ecb.ReuseBuffer = true; + + ecb.RemoveComponent(entity.Id); + ecb.Playback(); + } + [Test] public static void Test_CommandBuffer_Events_Tags() {