|
|
@ -62,6 +62,20 @@ namespace Avalonia.Base.UnitTests |
|
|
Assert.Equal(7, result[3].Value); |
|
|
Assert.Equal(7, result[3].Value); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[Fact] |
|
|
|
|
|
public void Binding_Overridden_Validated_Direct_Property_Calls_UpdateDataValidation() |
|
|
|
|
|
{ |
|
|
|
|
|
var target = new Class2(); |
|
|
|
|
|
var source = new Subject<BindingValue<int>>(); |
|
|
|
|
|
|
|
|
|
|
|
// Class2 overrides `NonValidatedDirectProperty`'s metadata to enable data validation.
|
|
|
|
|
|
target.Bind(Class1.NonValidatedDirectProperty, source); |
|
|
|
|
|
source.OnNext(1); |
|
|
|
|
|
|
|
|
|
|
|
var result = target.Notifications.Cast<BindingValue<int>>().ToList(); |
|
|
|
|
|
Assert.Equal(1, result.Count); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
[Fact] |
|
|
[Fact] |
|
|
public void Bound_Validated_Direct_String_Property_Can_Be_Set_To_Null() |
|
|
public void Bound_Validated_Direct_String_Property_Can_Be_Set_To_Null() |
|
|
{ |
|
|
{ |
|
|
@ -150,6 +164,15 @@ namespace Avalonia.Base.UnitTests |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private class Class2 : Class1 |
|
|
|
|
|
{ |
|
|
|
|
|
static Class2() |
|
|
|
|
|
{ |
|
|
|
|
|
NonValidatedDirectProperty.OverrideMetadata<Class2>( |
|
|
|
|
|
new DirectPropertyMetadata<int>(enableDataValidation: true)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public class ViewModel : NotifyingBase |
|
|
public class ViewModel : NotifyingBase |
|
|
{ |
|
|
{ |
|
|
private string _stringValue; |
|
|
private string _stringValue; |
|
|
|