public void BackingProperties(DependencyPropertyType source)
        {
            string result = "";

            foreach (var field in source.DependencyPropertyFields)
            {
                var dp         = (DependencyProperty)field.GetValue(null);
                var descriptor = DependencyPropertyDescriptor.FromProperty(dp, source.ControlType);
                if (descriptor == null)
                {
                    result += dp.Name;
                }
                if (descriptor != null && !descriptor.IsAttached)
                {
                    var propertyInfo = source.ControlType.GetProperty(dp.Name);
                    Assert.IsNotNull(propertyInfo);
                    Assert.AreEqual(dp.PropertyType, propertyInfo.PropertyType);
                }
            }

            if (!string.IsNullOrEmpty(result))
            {
                Assert.Inconclusive(result);
            }
        }
 public void FieldNames(DependencyPropertyType source)
 {
     foreach (var field in source.DependencyPropertyFields)
     {
         Console.WriteLine(field.Name);
         var dp = (DependencyProperty)field.GetValue(null);
         Assert.AreEqual(field.Name, dp.Name + "Property");
     }
 }
        public void OwnerTypes(DependencyPropertyType source)
        {
            string result = "";

            foreach (var field in source.DependencyPropertyFields)
            {
                var dp         = (DependencyProperty)field.GetValue(null);
                var descriptor = DependencyPropertyDescriptor.FromProperty(dp, source.ControlType);
                if (descriptor == null)
                {
                    result += dp.Name;
                    continue;
                }
                Assert.AreEqual(dp.OwnerType, source.ControlType);
            }

            if (!string.IsNullOrEmpty(result))
            {
                Assert.Inconclusive(result);
            }
        }
 public void CreateInstanceOfControl(DependencyPropertyType source)
 {
     Assert.IsNotNull(source.Control);
 }
 public void Values(DependencyPropertyType source)
 {
     Assert.Fail("Write to backing prop, then GetValue");
     Assert.Fail("SetValue then read from backing prop");
 }
Ejemplo n.º 6
0
 public DependencyPropertyAttribute(DependencyPropertyType type)
 {
     Type = type;
 }