public void AddingAndRemovingHandlerInTheSameFrameExecutesNoCode()
        {
            var entity = new MockEntity().Start <IncrementCounter>();

            entity.Stop <IncrementCounter>();
            entities.RunEntities();
            Assert.IsFalse(entity.Contains <string>());
        }
        public void AddingAndRemovingTheSameHandlerDoesNothing()
        {
            var entity = new MockEntity().Add(0);

            entity.Start <IncrementCounter>();
            entity.Stop <IncrementCounter>();
            entities.RunEntities();
            Assert.AreEqual(0, entity.Get <int>());
        }
        public void RemovingHandlerWhenNeverAddedExecutesNoCode()
        {
            var entity = new MockEntity();

            entities.RunEntities();
            entity.Stop <IncrementCounter>();
            entities.RunEntities();
            Assert.IsFalse(entity.Contains <string>());
        }
Beispiel #4
0
 public override void Update(IEnumerable <Entity> entities)
 {
     foreach (Entity entity in entities)
     {
         var child = new MockEntity();
         child.Start <MockUpdateBehavior>();
         child.Stop <MockUpdateBehavior>();
         entity.Add(child);
     }
 }
        public void AddEntityAndAttachHandlerLater()
        {
            var entity = new MockEntity().Add(0);

            entities.RunEntities();
            Assert.AreEqual(0, entity.Get <int>());
            entity.Start <IncrementCounter>();
            entities.RunEntities();
            Assert.AreEqual(1, entity.Get <int>());
            entity.Stop <IncrementCounter>();
            entities.RunEntities();
            Assert.AreEqual(1, entity.Get <int>());
        }