Exemple #1
0
        public void GetMetadata_Returns_Supplied_Value_For_Unrelated_Class()
        {
            var metadata = new PropertyMetadata();
            var target   = new TestProperty <string>("test", typeof(Class3), metadata);

            Assert.Same(metadata, target.GetMetadata <Class2>());
        }
        public void GetMetadata_Returns_Supplied_Value()
        {
            var metadata = new AvaloniaPropertyMetadata();
            var target   = new TestProperty <string>("test", typeof(Class1), metadata);

            Assert.Same(metadata, target.GetMetadata <Class1>());
        }
Exemple #3
0
        public void GetMetadata_Returns_Overridden_Value()
        {
            var metadata   = new PropertyMetadata();
            var overridden = new PropertyMetadata();
            var target     = new TestProperty <string>("test", typeof(Class1), metadata);

            target.OverrideMetadata <Class2>(overridden);

            Assert.Same(overridden, target.GetMetadata <Class2>());
        }
Exemple #4
0
        public void OverrideMetadata_Should_Merge_Values()
        {
            var metadata   = new PropertyMetadata(BindingMode.TwoWay);
            var notify     = (Action <IAvaloniaObject, bool>)((a, b) => { });
            var overridden = new PropertyMetadata();
            var target     = new TestProperty <string>("test", typeof(Class1), metadata);

            target.OverrideMetadata <Class2>(overridden);

            var result = target.GetMetadata <Class2>();

            Assert.Equal(BindingMode.TwoWay, result.DefaultBindingMode);
        }