Skip to content

Commit

Permalink
Update tests to use entity and id extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
BeanCheeseBurrito committed Nov 18, 2024
1 parent 3370be6 commit 488cc38
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 100 deletions.
10 changes: 8 additions & 2 deletions src/Flecs.NET.Tests/CSharp/Core/QueryBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,27 @@ private void TermAt()
world.Component<Velocity>();

world.QueryBuilder()
.Cached()
.With<Position>()
.TermAt<Position>(0)
.Build();

world.QueryBuilder()
.Cached()
.With<Tag, Position>()
.TermAt<Position>(0)
.Build();

world.QueryBuilder()
.Cached()
.With<Tag>().Second<Position>()
.TermAt<Position>(0)
.Build();

Assert.Throws<Ecs.AssertionException>(() =>
{
world.QueryBuilder()
.Cached()
.With<Tag>().Second<Position>()
.TermAt<Tag>(0)
.Build();
Expand All @@ -117,21 +121,23 @@ private void TermAt()
Assert.Throws<Ecs.AssertionException>(() =>
{
world.QueryBuilder()
.Cached()
.With<Velocity>().Second<Position>()
.TermAt<Position>(0)
.Build();
});

Assert.Throws<Ecs.AssertionException>(() =>
{
world.Component<Tag>().Entity.Add(Ecs.PairIsTag);
world.Component<Tag>().Add(Ecs.PairIsTag);

world.QueryBuilder()
.Cached()
.With<Tag, Position>()
.TermAt<Position>(0)
.Build();

world.Component<Tag>().Entity.Remove(Ecs.PairIsTag);
world.Component<Tag>().Remove(Ecs.PairIsTag);
});
}
}
16 changes: 8 additions & 8 deletions src/Flecs.NET.Tests/CSharp/Core/QueryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ private void EachSharedUnmanaged()
{
using World world = World.Create();

world.Component<SharedComponent>().Entity.Add(Ecs.OnInstantiate, Ecs.Inherit);
world.Component<SharedComponent>().Add(Ecs.OnInstantiate, Ecs.Inherit);

using Query<UnmanagedComponent, SharedComponent> query = world.Query<UnmanagedComponent, SharedComponent>();

Expand All @@ -848,7 +848,7 @@ private void EachSharedManaged()
{
using World world = World.Create();

world.Component<SharedComponent>().Entity.Add(Ecs.OnInstantiate, Ecs.Inherit);
world.Component<SharedComponent>().Add(Ecs.OnInstantiate, Ecs.Inherit);

using Query<ManagedComponent, SharedComponent> query = world.Query<ManagedComponent, SharedComponent>();

Expand All @@ -875,7 +875,7 @@ private void EachSparseUnmanaged()
{
using World world = World.Create();

world.Component<SparseComponent>().Entity.Add(Ecs.Sparse);
world.Component<SparseComponent>().Add(Ecs.Sparse);

using Query<UnmanagedComponent, SparseComponent> query = world.Query<UnmanagedComponent, SparseComponent>();

Expand All @@ -902,7 +902,7 @@ private void EachSparseManaged()
{
using World world = World.Create();

world.Component<SparseComponent>().Entity.Add(Ecs.Sparse);
world.Component<SparseComponent>().Add(Ecs.Sparse);

using Query<ManagedComponent, SparseComponent> query = world.Query<ManagedComponent, SparseComponent>();

Expand All @@ -929,8 +929,8 @@ private void EachSparseSharedUnmanaged()
{
using World world = World.Create();

world.Component<SparseComponent>().Entity.Add(Ecs.Sparse);
world.Component<SharedComponent>().Entity.Add(Ecs.OnInstantiate, Ecs.Inherit);
world.Component<SparseComponent>().Add(Ecs.Sparse);
world.Component<SharedComponent>().Add(Ecs.OnInstantiate, Ecs.Inherit);

using Query<UnmanagedComponent, SparseComponent, SharedComponent> query =
world.Query<UnmanagedComponent, SparseComponent, SharedComponent>();
Expand Down Expand Up @@ -960,8 +960,8 @@ private void EachSparseSharedManaged()
{
using World world = World.Create();

world.Component<SparseComponent>().Entity.Add(Ecs.Sparse);
world.Component<SharedComponent>().Entity.Add(Ecs.OnInstantiate, Ecs.Inherit);
world.Component<SparseComponent>().Add(Ecs.Sparse);
world.Component<SharedComponent>().Add(Ecs.OnInstantiate, Ecs.Inherit);

using Query<ManagedComponent, SparseComponent, SharedComponent> query =
world.Query<ManagedComponent, SparseComponent, SharedComponent>();
Expand Down
Loading

0 comments on commit 488cc38

Please sign in to comment.