Пример #1
0
        /// <summary>
        /// Checks that the property can be retrieved correctly by it's PropertyInfo using the reflector.
        /// </summary>
        public void GetPropertyValueByPropertyInfo()
        {
            LightHouse.Core.Elite.Reflecting.Reflector reflector = new LightHouse.Core.Elite.Reflecting.Reflector();

            Project project = new Project()
            {
                Name = new Localization.LocalString("LightHouse")
            };

            PropertyInfo propertyInfo = reflector.GetProperty(typeof(Project), "Name");
            LocalString name = (LocalString)reflector.GetPropertyValue(propertyInfo, project);

            Assert.True(name.GetContent() == "LightHouse");

            propertyInfo = null;
            Object empty = reflector.GetPropertyValue(propertyInfo, project);

            Assert.True(empty == null);
        }
Пример #2
0
        /// <summary>
        /// Checks that the property can be retrieved correctly by it's name using the reflector.
        /// </summary>
        public void GetPropertyValueByString()
        {
            LightHouse.Core.Elite.Reflecting.Reflector reflector = new LightHouse.Core.Elite.Reflecting.Reflector();

            Project project = new Project()
            {
                Name = new Localization.LocalString("LightHouse")
            };

            LocalString name = (LocalString)reflector.GetPropertyValue("Name", project);

            Assert.True(name.GetContent() == "LightHouse");
        }