public void CanGetInstancesDefaultValue()
        {
            var tested = new AttachedPropertyContext();

            var attachedProperty = new AttachedProperty <object, int>("PropertyName", tested);
            var instance         = new object();

            instance.SetAttachedValue(attachedProperty, default(int), tested);
            var instances = tested.GetInstances();

            Assert.Equal(0, instances.Count);
        }
        public void CanGetInstancesNoReference()
        {
            var tested = new AttachedPropertyContext();

            var attachedProperty = new AttachedProperty <object, int>("PropertyName", tested);
            var instance         = new object();

            instance.SetAttachedValue(attachedProperty, 1, tested);
            instance = null;
            GC.Collect(0, GCCollectionMode.Forced, true);
            var instances = tested.GetInstances();

            Assert.Null(instance);
            Assert.Equal(0, instances.Count);
        }
        public void CanGetInstances()
        {
            var tested = new AttachedPropertyContext();

            var attachedProperty = new AttachedProperty <object, int>("PropertyName", tested);
            var instance         = new object();

            instance.SetAttachedValue(attachedProperty, 1, tested);
            var instances = tested.GetInstances();

            Assert.Equal(1, instances.Count);
            Assert.All(instances, x =>
            {
                Assert.Same(instance, x);
            });
        }