public void GetMetadata_Returns_Supplied_Value_For_Unrelated_Class() { var metadata = new AvaloniaPropertyMetadata(); var target = new TestProperty <string>("test", typeof(Class3), metadata); Assert.Same(metadata, target.GetMetadata <Class2>()); }
public void GetMetadata_Returns_Overridden_Value() { var metadata = new AvaloniaPropertyMetadata(); var overridden = new AvaloniaPropertyMetadata(); var target = new TestProperty <string>("test", typeof(Class1), metadata); target.OverrideMetadata <Class2>(overridden); Assert.Same(overridden, target.GetMetadata <Class2>()); }
public void OverrideMetadata_Should_Merge_Values() { var metadata = new AvaloniaPropertyMetadata(BindingMode.TwoWay); var notify = (Action <IAvaloniaObject, bool>)((a, b) => { }); var overridden = new AvaloniaPropertyMetadata(); var target = new TestProperty <string>("test", typeof(Class1), metadata); target.OverrideMetadata <Class2>(overridden); var result = target.GetMetadata <Class2>(); Assert.Equal(BindingMode.TwoWay, result.DefaultBindingMode); }
public void OverrideMetadata <T>(AvaloniaPropertyMetadata metadata) { OverrideMetadata(typeof(T), metadata); }
public TestProperty(string name, Type ownerType, AvaloniaPropertyMetadata metadata = null) : base(name, ownerType, metadata ?? new AvaloniaPropertyMetadata()) { }
public void PropertyMetadata_BindingMode_Default_Returns_OneWay() { var data = new AvaloniaPropertyMetadata(defaultBindingMode: BindingMode.Default); Assert.Equal(BindingMode.OneWay, data.DefaultBindingMode); }