Skip to content

Commit 738ec7e

Browse files
Tests
1 parent 406587c commit 738ec7e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Diff for: src/Arch.Tests/WorldTest.cs

+24
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,18 @@ public void Add()
604604
That(_world.GetArchetype(entity2), Is.EqualTo(_world.GetArchetype(entity)));
605605
That(arch, Is.EqualTo(_world.GetArchetype(entity)));
606606
}
607+
608+
/// <summary>
609+
/// Checks if generic TryGet works on entities.
610+
/// </summary>
611+
[Test]
612+
public void TryGet()
613+
{
614+
var entity = _world.Create(new Transform());
615+
616+
That(_world.TryGet(entity, out Transform xform), Is.EqualTo(true));
617+
That(_world.TryGet(entity, out Rotation rot), Is.EqualTo(false));
618+
}
607619
}
608620

609621

@@ -658,6 +670,18 @@ public void Add_NonGeneric()
658670
That(_world.GetArchetype(entity2), Is.EqualTo(_world.GetArchetype(entity)));
659671
That(arch, Is.EqualTo(_world.GetArchetype(entity)));
660672
}
673+
674+
/// <summary>
675+
/// Checks if generic TryGet works on entities.
676+
/// </summary>
677+
[Test]
678+
public void TryGet_NonGeneric()
679+
{
680+
var entity = _world.Create(new Transform());
681+
682+
That(_world.TryGet(entity, Component<Transform>.ComponentType, out var xform), Is.EqualTo(true));
683+
That(_world.TryGet(entity, Component<Rotation>.ComponentType, out var rot), Is.EqualTo(false));
684+
}
661685
}
662686

663687
/// <summary>

0 commit comments

Comments
 (0)