public void AddSystemsToEntity(IEntity entity, ISystemContainer container) { for (int i = 0; i < container.SetupSystems.Length; i++) { var system = container.SetupSystems[i]; var subscription = SetupSystemHandler.ProcessEntity(system, entity); if (subscription != null) { _entitySubscribtionsOnSystems[system].Add(entity, subscription); } } for (int i = 0; i < container.EntityReactionSystems.Length; i++) { var system = container.EntityReactionSystems[i]; var subscription = EntityReactionSystemHandler.ProcessEntity(system, entity); if (subscription != null) { _entitySubscribtionsOnSystems[system].Add(entity, subscription); } } for (int i = 0; i < container.InteractReactionSystems.Length; i++) { var system = container.InteractReactionSystems[i]; var subscription = InteractReactionSystemHandler.ProcessEntity(system, entity); if (subscription != null) { _entitySubscribtionsOnSystems[system].Add(entity, subscription); } } }
public void should_return_valid_subscription_token_when_processing() { var mockPoolManager = Substitute.For <IPoolManager>(); var mockEntity = Substitute.For <IEntity>(); var mockSystem = Substitute.For <IEntityReactionSystem>(); var mockSubscription = Substitute.For <IObservable <IEntity> >(); mockSystem.Impact(mockEntity).Returns(mockSubscription); var handler = new EntityReactionSystemHandler(mockPoolManager); var subscriptionToken = handler.ProcessEntity(mockSystem, mockEntity); Assert.That(subscriptionToken, Is.Not.Null); //Assert.That(subscriptionToken.AssociatedObject, Is.EqualTo(mockEntity)); //Assert.That(subscriptionToken.Disposable, Is.Not.Null); }