add test for singular ReadMessageWithEntity
parent
511a05f18e
commit
4d67b4ddf7
|
@ -497,6 +497,58 @@ namespace Tests
|
|||
entityMessageResults.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Sends(typeof(EntityMessage), typeof(MockMessage))]
|
||||
class EntityMessageSingularEmitterEngine : Engine
|
||||
{
|
||||
private Entity _entity;
|
||||
|
||||
public EntityMessageSingularEmitterEngine(Entity entity)
|
||||
{
|
||||
_entity = entity;
|
||||
}
|
||||
|
||||
public override void Update(double dt)
|
||||
{
|
||||
SendMessage(new EntityMessage(_entity, 2));
|
||||
SendMessage(new MockMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static EntityMessage entityMessageResult;
|
||||
|
||||
[Receives(typeof(EntityMessage))]
|
||||
class SingularMessageWithEntityEngine : Engine
|
||||
{
|
||||
private Entity _entity;
|
||||
|
||||
public SingularMessageWithEntityEngine(Entity entity)
|
||||
{
|
||||
_entity = entity;
|
||||
}
|
||||
|
||||
public override void Update(double dt)
|
||||
{
|
||||
entityMessageResult = ReadMessageWithEntity<EntityMessage>(_entity);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MessageWithEntity()
|
||||
{
|
||||
var worldBuilder = new WorldBuilder();
|
||||
|
||||
var entity = worldBuilder.CreateEntity();
|
||||
|
||||
worldBuilder.AddEngine(new EntityMessageSingularEmitterEngine(entity));
|
||||
worldBuilder.AddEngine(new SingularMessageWithEntityEngine(entity));
|
||||
|
||||
var world = worldBuilder.Build();
|
||||
|
||||
world.Update(0.01);
|
||||
|
||||
entityMessageResult.Should().Be(new EntityMessage(entity, 2));
|
||||
}
|
||||
|
||||
class SomeComponentTestEngine : Engine
|
||||
{
|
||||
public override void Update(double dt)
|
||||
|
|
Loading…
Reference in New Issue