Exemple #1
0
        public void GetValue_Always_DelegateToWrappedPropertyDescriptor()
        {
            // Setup
            var component = new SomeTestClass
            {
                SomeEditableProperty = 1.1
            };

            PropertyDescriptorCollection properties     = TypeDescriptor.GetProperties(component);
            PropertyDescriptor           getSetProperty = properties[0];

            var wrappedProperty = new ReadOnlyPropertyDescriptorDecorator(getSetProperty);

            // Call
            object result = wrappedProperty.GetValue(component);

            // Assert
            Assert.AreEqual(getSetProperty.GetValue(component), result);
            Assert.AreEqual(component.SomeEditableProperty, result);
        }