예제 #1
0
        public void AddAndRemoveComponent()
        {
            Assert.AreEqual(1, entities.NumberOfEntities);
            var entity = new MockEntity().Add(new object());

            Assert.AreEqual(2, entities.NumberOfEntities);
            Assert.AreEqual(1, entity.NumberOfComponents);
            Assert.IsNotNull(entity.Get <object>());
            entity.Remove <object>();
            Assert.AreEqual(0, entity.NumberOfComponents);
            Assert.IsFalse(entity.Contains <object>());
            Assert.Throws <ArgumentNullException>(() => new MockEntity().Add <object>(null));
        }