public void DependencyPropertyAmbiguityTest()
        {
            ElementB element = new ElementB();

            element.SetValue(ElementA.Value0Property, 1);
            element.SetValue(ElementB.Value0Property2, 2);

            Assert.AreEqual(1, element.GetValue(ElementA.Value0Property));
            Assert.AreEqual(2, element.GetValue(ElementB.Value0Property2));

            Assert.AreEqual(ElementA.Value0Property, DependencyProperty.GetProperty(typeof(ElementA), "Value0"));
            Assert.AreEqual(ElementB.Value0Property2, DependencyProperty.GetProperty(typeof(ElementB), "Value0"));
        }
        public void OverrideMetadataDefaultValueTest()
        {
            ElementA element1 = new ElementA();
            ElementB element2 = new ElementB();
            ElementC element3 = new ElementC();
            ElementD element4 = new ElementD();

            int propertyChangedCount = 0;

            element1.PropertyChanged += (sender, e) => propertyChangedCount++;
            element2.PropertyChanged += (sender, e) => propertyChangedCount++;
            element3.PropertyChanged += (sender, e) => propertyChangedCount++;
            element4.PropertyChanged += (sender, e) => propertyChangedCount++;

            Assert.AreEqual(1, element1.GetValue(ElementA.Value1Property));
            Assert.AreEqual(2, element2.GetValue(ElementA.Value1Property));
            Assert.AreEqual(3, element3.GetValue(ElementA.Value1Property));
            Assert.AreEqual(4, element4.GetValue(ElementA.Value1Property));

            Assert.AreEqual(1, element1.GetValue(ElementA.Value2Property));
            Assert.AreEqual(2, element2.GetValue(ElementA.Value2Property));
            Assert.AreEqual(3, element3.GetValue(ElementA.Value2Property));
            Assert.AreEqual(4, element4.GetValue(ElementA.Value2Property));

            element1.SetValue(ElementA.Value1Property, 1);
            element2.SetValue(ElementA.Value1Property, 2);
            element3.SetValue(ElementA.Value1Property, 3);
            element4.SetValue(ElementA.Value1Property, 4);

            Assert.AreEqual(0, propertyChangedCount);

            element1.SetValue(ElementA.Value1Property, 100);

            Assert.AreEqual(1, propertyChangedCount);

            element1.SetValue(ElementA.Value2Property, 1);
            element2.SetValue(ElementA.Value2Property, 2);
            element3.SetValue(ElementA.Value2Property, 3);
            element4.SetValue(ElementA.Value2Property, 4);

            Assert.AreEqual(1, propertyChangedCount);

            element1.SetValue(ElementA.Value2Property, 100);

            Assert.AreEqual(2, propertyChangedCount);
        }
        public void DependencyPropertyAmbiguityTest()
        {
            ElementB element = new ElementB();

            element.SetValue(ElementA.Value0Property, 1);
            element.SetValue(ElementB.Value0Property2, 2);

            Assert.AreEqual(1, element.GetValue(ElementA.Value0Property));
            Assert.AreEqual(2, element.GetValue(ElementB.Value0Property2));

            Assert.AreEqual(ElementA.Value0Property, DependencyProperty.GetOwnedProperty(typeof(ElementA), "Value0"));
            Assert.AreEqual(ElementB.Value0Property2, DependencyProperty.GetOwnedProperty(typeof(ElementB), "Value0"));

            DependencyProperty[] elementAProperties = new [] { ElementA.Value0Property, ElementA.Value1Property, ElementA.Value2Property, ElementA.Value3Property };
            DependencyProperty[] elementBProperties = new [] { ElementB.Value0Property2 };

            CollectionAssert.AreEqual(elementAProperties, DependencyProperty.GetProperties(typeof(ElementA)).ToArray());
            CollectionAssert.AreEqual(elementBProperties, DependencyProperty.GetProperties(typeof(ElementB)).ToArray());
            CollectionAssert.AreEqual(elementAProperties.Concat(elementBProperties).Cast <object>().ToArray(), DependencyProperty.GetFlattenedProperties(typeof(ElementB)).ToArray());

            try
            {
                DependencyProperty.GetSingleProperty(typeof(ElementB), "Value0");
                Assert.Fail();
            }
            catch
            {
                //
            }

            try
            {
                ElementA.Value0Property.AddOwner(typeof(ElementB));
                Assert.Fail();
            }
            catch
            {
                //
            }
        }