Пример #1
0
		public void Deny_Unrestricted ()
		{
			ValidationPropertyAttribute vpa = new ValidationPropertyAttribute (null);
			Assert.IsNull (vpa.Name, "Name");
		}
Пример #2
0
 private static void SetValidProp(Control ctrl, string inValue, ValidationPropertyAttribute attr)
 {
     {
         System.Reflection.PropertyInfo info = ctrl.GetType().GetProperty(attr.Name);
         try
         {
             info.SetValue(ctrl,
                 Convert.ChangeType(inValue, info.PropertyType), null);
         }
         catch
         {
             try
             {
                 // try to set a mythical property named value if we failed
                 info = ctrl.GetType().GetProperty("Value");
                 info.SetValue(ctrl,
                     Convert.ChangeType(inValue, info.PropertyType), null);
             }
             catch { }
         }
     }
 }