示例#1
0
文件: Entity.cs 项目: girvel/Imperium
 /// <summary>
 /// Adds component to a prototype
 /// </summary>
 /// <param name="e">Prototype</param>
 /// <param name="component">New component</param>
 /// <returns>Given protype</returns>
 public static Entity operator |(Entity e, Component component)
 {
     e.Components.Add(component);
     component.Parent = e;
     RequirementsAttribute.CheckRequirements(component);
     return(e);
 }
        public void CheckRequirements_ThrowsExceptionIfThereAreSomeOutstandingRequirements()
        {
            var exceptionThrown = false;

            // arrange
            var a = new A();

            // act
            try
            {
                RequirementsAttribute.CheckRequirements(a);
            }
            catch (RequirementsException)
            {
                exceptionThrown = true;
            }

            // assert
            Assert.True(exceptionThrown);
        }
        public void CheckRequirements_ThrowsRequirementsExceptionWhenThereAreSomeOutstandingRequirements()
        {
            // arrange
            var system = new TestSystem
            {
                Ecs = Mock.Of <EcsManager>(ecs => ecs.SystemManager == Mock.Of <SystemManager>())
            };
            var exceptionThrown = false;

            // act
            try
            {
                RequirementsAttribute.CheckRequirements(system);
            }
            catch (RequirementsException)
            {
                exceptionThrown = true;
            }

            // assert
            Assert.True(exceptionThrown);
        }
示例#4
0
 public virtual void Start()
 {
     RequirementsAttribute.CheckRequirements(this);
 }