public void Load_AddsEntity() { Entity testEntity = new Entity(10, "Entity", new IEntityComponent[0]); engine.Load(10, testEntity); engine.AllEntities.Single().Should().Be(testEntity); testEntity.EntityId.Should().Be(10); }
public void SetUp() { SystemContainer = new SystemContainer(); SystemContainer.PositionSystem = Substitute.For <IPositionSystem>(); SystemContainer.EventSystem = Substitute.For <IEventSystem>(); SystemContainer.Random = Substitute.For <IRandom>(); entityEngine = Substitute.For <IEntityEngine>(); entityEngine.New(Arg.Any <string>(), Arg.Any <IEntityComponent[]>()).ReturnsForAnyArgs(callInfo => { var entity = new Entity(0, "entity", callInfo.ArgAt <IEntityComponent[]>(1)); entity.Name = callInfo.ArgAt <string>(0); return(entity); }); entityEngine.Load(Arg.Any <uint>(), Arg.Any <Entity>()).ReturnsForAnyArgs(callInfo => { var entity = callInfo.ArgAt <Entity>(1); return(entity); }); entityEngine.ComponentTypes.ReturnsForAnyArgs(new[] { typeof(Appearance), typeof(Position), typeof(Stairs), typeof(AttackClosestEnemyBehaviour), typeof(Script) }); SystemContainer.EntityEngine = entityEngine; }