EntitiesRunnerTests AddingBehaviorTwiceIsIgnored Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Entities
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void AddingBehaviorTwiceIsIgnored()
Examples

[Test]
public void AddingBehaviorTwiceIsIgnored()
{
    var entity = new MockEntity().Start<IncrementCounter>().Add(0);
    var behavior = EntitiesRunner.Current.GetUpdateBehavior<IncrementCounter>();
    entities.RunEntities();
    Assert.AreEqual(1, entity.Get<int>());
    entity.Start<IncrementCounter>();
    Assert.AreEqual(behavior, EntitiesRunner.Current.GetUpdateBehavior<IncrementCounter>());
    entities.RunEntities();
    Assert.AreEqual(2, entity.Get<int>());
    Assert.AreEqual(1, EntitiesRunner.Current.NumberOfEntities);
}
See Also