Exemplo n.º 1
0
        public void CanSetDefaultValueDoesNotStore()
        {
            var tested = new AttachedPropertyContext();

            var attachedProperty = new AttachedProperty <object, string>("CanGetDefaultWithoutSet", tested);
            var instance         = new object();

            instance.SetAttachedValue(attachedProperty, default(string), tested);
            var properties = tested.GetInstanceProperties(instance);

            Assert.Equal(0, properties.Count);
        }
Exemplo n.º 2
0
        public void CanGetPropertiesForInstance()
        {
            var tested = new AttachedPropertyContext();

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

            instance.SetAttachedValue(attachedProperty, 1, tested);
            var values = tested.GetInstanceProperties(instance);

            Assert.Equal(1, values.Count);
            Assert.All(values, x =>
            {
                Assert.Same(attachedProperty, x.Key);
                Assert.Equal(1, x.Value);
            });
        }