コード例 #1
0
        public void GetValidPropertyReturnsAValidProperty()
        {
            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(SimpleEntity));

            PropertyDescriptor result = TypeDescriptionHelper.GetValidProperty(properties, "Name");

            Assert.IsNotNull(result);
        }
コード例 #2
0
 private object FindInstance(IDictionary keys)
 {
     return(_data.Find(delegate(object obj)
     {
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj);
         foreach (string keyName in keys.Keys)
         {
             PropertyDescriptor property = TypeDescriptionHelper.GetValidProperty(properties, keyName);
             if (!property.GetValue(obj).Equals(keys[keyName]))
             {
                 return false;
             }
         }
         return true;
     }));
 }
コード例 #3
0
 public void GetValidPropertyThrowsIfPropertiesIsNull()
 {
     TypeDescriptionHelper.GetValidProperty(null, "Unexistant");
 }
コード例 #4
0
        public void GetValidPropertyThrowsIfPropertyIsInvalid()
        {
            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(SimpleEntity));

            TypeDescriptionHelper.GetValidProperty(properties, "Unexistant");
        }