public void Attached_Property_Should_Be_Validated()
        {
            var target = new Class2();

            target.SetValue(Class1.AttachedProperty, 15);
            Assert.Equal(10, target.GetValue(Class1.AttachedProperty));
        }
Exemple #2
0
        public void SetValue_Sets_Attached_Value()
        {
            Class2 target = new Class2();

            target.SetValue(AttachedOwner.AttachedProperty, "newvalue");

            Assert.Equal("newvalue", target.GetValue(AttachedOwner.AttachedProperty));
        }
Exemple #3
0
        public void GetValue_Returns_Inherited_Value()
        {
            Class1 parent = new Class1();
            Class2 child  = new Class2 {
                Parent = parent
            };

            parent.SetValue(Class1.BazProperty, "changed");

            Assert.Equal("changed", child.GetValue(Class1.BazProperty));
        }
Exemple #4
0
        public void SetValue_Can_Convert_To_Nullable()
        {
            Class2 target = new Class2();

            target.SetValue((AvaloniaProperty)Class2.FredProperty, 4.0);

            var value = target.GetValue(Class2.FredProperty);

            Assert.IsType <double>(value);
            Assert.Equal(4, value);
        }
Exemple #5
0
        public void SetValue_Respects_Implicit_Conversions()
        {
            Class2 target = new Class2();

            target.SetValue((AvaloniaProperty)Class2.FlobProperty, new ImplictDouble(4));

            var value = target.GetValue(Class2.FlobProperty);

            Assert.IsType <double>(value);
            Assert.Equal(4, value);
        }
Exemple #6
0
        public void SetValue_Of_Integer_On_Double_Property_Works()
        {
            Class2 target = new Class2();

            target.SetValue((AvaloniaProperty)Class2.FlobProperty, 4);

            var value = target.GetValue(Class2.FlobProperty);

            Assert.IsType <double>(value);
            Assert.Equal(4, value);
        }
Exemple #7
0
        public void this_Operator_Binds_One_Way()
        {
            Class1            target1 = new Class1();
            Class2            target2 = new Class2();
            IndexerDescriptor binding = Class2.BarProperty.Bind().WithMode(BindingMode.OneWay);

            target1.SetValue(Class1.FooProperty, "first");
            target2[binding] = target1[!Class1.FooProperty];
            target1.SetValue(Class1.FooProperty, "second");

            Assert.Equal("second", target2.GetValue(Class2.BarProperty));
        }
Exemple #8
0
        public void GetValue_Returns_Overridden_Default_Value()
        {
            Class2 target = new Class2();

            Assert.Equal("foooverride", target.GetValue(Class1.FooProperty));
        }
        public void AddOwnered_Property_Retains_Default_Value()
        {
            var target = new Class2();

            Assert.Equal("foodefault", target.GetValue(Class2.FooProperty));
        }
Exemple #10
0
        public void GetValue_On_Unregistered_Property_Throws_Exception()
        {
            var target = new Class2();

            Assert.Throws <ArgumentException>(() => target.GetValue(Class1.BarProperty));
        }
Exemple #11
0
        public void GetValue_Gets_Value_On_AddOwnered_Property_Using_Original_NonGeneric()
        {
            var target = new Class2();

            Assert.Equal("initial2", target.GetValue((AvaloniaProperty)Class1.FooProperty));
        }
Exemple #12
0
        public void GetValue_Gets_Value_On_AddOwnered_Property()
        {
            var target = new Class2();

            Assert.Equal("initial2", target.GetValue(Class2.FooProperty));
        }