예제 #1
0
        /// <summary>
        /// Checks that the property can be setted correctly by it's name using the reflector.
        /// </summary>
        public void SetPropertyValueByString()
        {
            LightHouse.Core.Elite.Reflecting.Reflector reflector = new LightHouse.Core.Elite.Reflecting.Reflector();

            Project project = new Project();

            reflector.SetPropertyValue("Name", project, new Localization.LocalString("LightHouse"));

            Assert.True(project.Name.GetContent() == "LightHouse");
        }
예제 #2
0
        /// <summary>
        /// Checks that the property can be setted correctly by it's PropertyInfo using the reflector.
        /// </summary>
        public void SetPropertyValueByPropertyInfo()
        {
            LightHouse.Core.Elite.Reflecting.Reflector reflector = new LightHouse.Core.Elite.Reflecting.Reflector();

            Project project = new Project();

            PropertyInfo propertyInfo = reflector.GetProperty(typeof(Project), "Name");
            reflector.SetPropertyValue(propertyInfo, project, new LocalString("LightHouse"));

            Assert.True(project.Name.GetContent() == "LightHouse");

            propertyInfo = null;
            reflector.SetPropertyValue(propertyInfo, project, new LocalString("LightHouse"));
        }