public void ConvertFrom_Finds_Attached_Property_With_Parentheses() { var target = new AvaloniaPropertyTypeConverter(); var context = CreateContext(); var result = target.ConvertFrom(context, null, "(AttachedOwner.Attached)"); Assert.Equal(AttachedOwner.AttachedProperty, result); }
public void ConvertFrom_Finds_Fully_Qualified_Property() { var target = new AvaloniaPropertyTypeConverter(); var context = CreateContext(); var result = target.ConvertFrom(context, null, "Class1.Foo"); Assert.Equal(Class1.FooProperty, result); }
public void ConvertFrom_Finds_Attached_Property() { var target = new AvaloniaPropertyTypeConverter(); var style = new Style(x => x.OfType <Class1>()); var context = CreateContext(style); var result = target.ConvertFrom(context, null, "AttachedOwner.Attached"); Assert.Equal(AttachedOwner.AttachedProperty, result); }
public void ConvertFrom_Uses_Selector_TargetType() { var target = new AvaloniaPropertyTypeConverter(); var style = new Style(x => x.OfType <Class1>()); var context = CreateContext(style); var result = target.ConvertFrom(context, null, "Foo"); Assert.Equal(Class1.FooProperty, result); }
public void ConvertFrom_Throws_For_Nonexistent_Attached_Property() { var target = new AvaloniaPropertyTypeConverter(); var style = new Style(x => x.OfType <Class1>()); var context = CreateContext(style); var ex = Assert.Throws <XamlLoadException>(() => target.ConvertFrom(context, null, "AttachedOwner.NonExistent")); Assert.Equal("Could not find property 'AttachedOwner.NonExistent'.", ex.Message); }