public void GetPropertyOwnerShouldReturnExpectedValue() { var parent = TypeDescriptor.GetProvider( typeof( string ) ).GetTypeDescriptor( typeof( string ) ); var target = new CustomTypeDescriptor<string>( parent ); var property = target.GetProperties().Cast<PropertyDescriptor>().First(); var owner = target.GetPropertyOwner( property ); Assert.Equal( target, owner ); }
public void GetPropertiesShouldIncludeExtensionProperties() { var parent = TypeDescriptor.GetProvider( typeof( string ) ).GetTypeDescriptor( typeof( string ) ); var target = new CustomTypeDescriptor<string>( parent ); target.AddExtensionProperty( "Name", ObjectExtensions.GetName ); var properties = target.GetProperties(); Assert.Equal( 2, properties.Count ); Assert.Equal( "Name", properties[1].Name ); }
public void GetPropertiesWithFilterShouldIncludeExtensionProperties() { var target = new CustomTypeDescriptor<string>(); target.AddExtensionProperty( "Name", ObjectExtensions.GetName, ObjectExtensions.SetName ); var properties = target.GetProperties( null ); Assert.Equal( 1, properties.Count ); Assert.Equal( "Name", properties[0].Name ); }