public InterfaceTypeDescriptor(InterfacePropertiesTypeDescriptionProvider provider,
                                ICustomTypeDescriptor descriptor, Type objectType)
     : base(descriptor)
 {
     if (provider == null) throw new ArgumentNullException("provider");
     if (descriptor == null) throw new ArgumentNullException("descriptor");
     if (objectType == null) throw new ArgumentNullException("objectType");
     this.objectType = objectType;
     this.provider = provider;
 }
        public void GetPropertiesFromBaseInterface()
        {
            var provider = new InterfacePropertiesTypeDescriptionProvider(typeof (IDerivedInterface));
            var properties = provider.GetTypeDescriptor(typeof(IDerivedInterface)).GetProperties();
            Assert.AreEqual(2, properties.Count);

            var propertyNamesList = new List<string>(new[] {properties[0].Name, properties[1].Name});
            Assert.Contains("DerivedInterfaceProperty", propertyNamesList);
            Assert.Contains("BaseInterfaceProperty", propertyNamesList);

        }
Exemple #3
0
 public InterfaceTypeDescriptor(InterfacePropertiesTypeDescriptionProvider provider,
                                ICustomTypeDescriptor descriptor, Type objectType)
     : base(descriptor)
 {
     if (provider == null)
     {
         throw new ArgumentNullException("provider");
     }
     if (descriptor == null)
     {
         throw new ArgumentNullException("descriptor");
     }
     if (objectType == null)
     {
         throw new ArgumentNullException("objectType");
     }
     this.objectType = objectType;
     this.provider   = provider;
 }
 public void DoesNotWorkOnClass()
 {
     var provider = new InterfacePropertiesTypeDescriptionProvider(typeof (object));
     Assert.IsNull(provider);
 }