示例#1
0
        public void AddComponent_AddsComponentToEntityAndContainer()
        {
            var entity    = new Mock <IEntity>(MockBehavior.Strict);
            var component = new Mock <IScriptComponent>();

            entity.Setup(_ => _.AddComponent(component.Object));

            _target.AddComponent(entity.Object, component.Object);

            Assert.IsTrue(_target.GetComponents <IScriptComponent>().Any());
            Assert.IsTrue(_target.GetEntitiesWithComponent <IScriptComponent>().Any());
            entity.Verify(_ => _.AddComponent(component.Object), Times.Once);
        }