Browse Source

Tidy up API.

Steven Kirk 6 years ago
parent
commit
b8717bf6dc

+ 45 - 11
src/Avalonia.Base/AvaloniaObject.cs

@@ -9,7 +9,6 @@ using Avalonia.Diagnostics;
 using Avalonia.Logging;
 using Avalonia.PropertyStore;
 using Avalonia.Threading;
-using Avalonia.Utilities;
 
 namespace Avalonia
 {
@@ -136,7 +135,8 @@ namespace Avalonia
         /// <param name="property">The property.</param>
         public void ClearValue(AvaloniaProperty property)
         {
-            Contract.Requires<ArgumentNullException>(property != null);
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
             property.RouteClearValue(this);
         }
 
@@ -146,24 +146,47 @@ namespace Avalonia
         /// <param name="property">The property.</param>
         public void ClearValue<T>(AvaloniaProperty<T> property)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
             VerifyAccess();
 
             switch (property)
             {
                 case StyledPropertyBase<T> styled:
-                    _values.ClearLocalValue(styled);
+                    ClearValue(styled);
                     break;
                 case DirectPropertyBase<T> direct:
-                    var p = AvaloniaPropertyRegistry.Instance.GetRegisteredDirect(this, direct);
-                    p.InvokeSetter(this, p.GetUnsetValue(GetType()));
+                    ClearValue(direct);
                     break;
-                case null:
-                    throw new ArgumentNullException(nameof(property));
                 default:
                     throw new NotSupportedException("Unsupported AvaloniaProperty type.");
             }
         }
 
+        /// <summary>
+        /// Clears a <see cref="AvaloniaProperty"/>'s local value.
+        /// </summary>
+        /// <param name="property">The property.</param>
+        public void ClearValue<T>(StyledPropertyBase<T> property)
+        {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            VerifyAccess();
+
+            _values?.ClearLocalValue(property);
+        }
+
+        /// <summary>
+        /// Clears a <see cref="AvaloniaProperty"/>'s local value.
+        /// </summary>
+        /// <param name="property">The property.</param>
+        public void ClearValue<T>(DirectPropertyBase<T> property)
+        {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            VerifyAccess();
+
+            var p = AvaloniaPropertyRegistry.Instance.GetRegisteredDirect(this, property);
+            p.InvokeSetter(this, p.GetUnsetValue(GetType()));
+        }
+
         /// <summary>
         /// Compares two objects using reference equality.
         /// </summary>
@@ -202,6 +225,8 @@ namespace Avalonia
         /// <returns>The value.</returns>
         public object GetValue(AvaloniaProperty property)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
             return property.RouteGetValue(this);
         }
 
@@ -213,11 +238,12 @@ namespace Avalonia
         /// <returns>The value.</returns>
         public T GetValue<T>(AvaloniaProperty<T> property)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
             return property switch
             {
                 StyledPropertyBase<T> styled => GetValue(styled),
                 DirectPropertyBase<T> direct => GetValue(direct),
-                null => throw new ArgumentNullException(nameof(property)),
                 _ => throw new NotSupportedException("Unsupported AvaloniaProperty type.")
             };
         }
@@ -292,6 +318,8 @@ namespace Avalonia
             object value,
             BindingPriority priority = BindingPriority.LocalValue)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
             property.RouteSetValue(this, value, priority);
         }
 
@@ -307,6 +335,8 @@ namespace Avalonia
             T value,
             BindingPriority priority = BindingPriority.LocalValue)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
             switch (property)
             {
                 case StyledPropertyBase<T> styled:
@@ -315,8 +345,6 @@ namespace Avalonia
                 case DirectPropertyBase<T> direct:
                     SetValue(direct, value);
                     break;
-                case null:
-                    throw new ArgumentNullException(nameof(property));
                 default:
                     throw new NotSupportedException("Unsupported AvaloniaProperty type.");
             }
@@ -386,6 +414,9 @@ namespace Avalonia
             IObservable<BindingValue<object>> source,
             BindingPriority priority = BindingPriority.LocalValue)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
+
             return property.RouteBind(this, source, priority);
         }
 
@@ -404,11 +435,13 @@ namespace Avalonia
             IObservable<BindingValue<T>> source,
             BindingPriority priority = BindingPriority.LocalValue)
         {
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
+
             return property switch
             {
                 StyledPropertyBase<T> styled => Bind(styled, source, priority),
                 DirectPropertyBase<T> direct => Bind(direct, source),
-                null => throw new ArgumentNullException(nameof(property)),
                 _ => throw new NotSupportedException("Unsupported AvaloniaProperty type."),
             };
         }
@@ -429,6 +462,7 @@ namespace Avalonia
             BindingPriority priority = BindingPriority.LocalValue)
         {
             property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
             VerifyAccess();
 
             return Values.AddBinding(property, source, priority);

+ 184 - 5
src/Avalonia.Base/AvaloniaObjectExtensions.cs

@@ -125,7 +125,7 @@ namespace Avalonia
         /// for the specified property.
         /// </returns>
         public static IObservable<AvaloniaPropertyChangedEventArgs> GetPropertyChangedObservable(
-            this IAvaloniaObject o, 
+            this IAvaloniaObject o,
             AvaloniaProperty property)
         {
             Contract.Requires<ArgumentNullException>(o != null);
@@ -236,6 +236,58 @@ namespace Avalonia
                 o.GetBindingObservable(property));
         }
 
+        /// <summary>
+        /// Binds a <see cref="AvaloniaProperty"/> to an observable.
+        /// </summary>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        /// <param name="source">The observable.</param>
+        /// <param name="priority">The priority of the binding.</param>
+        /// <returns>
+        /// A disposable which can be used to terminate the binding.
+        /// </returns>
+        public static IDisposable Bind(
+            this IAvaloniaObject target,
+            AvaloniaProperty property,
+            IObservable<BindingValue<object>> source,
+            BindingPriority priority = BindingPriority.LocalValue)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
+
+            return property.RouteBind(target, source, priority);
+        }
+
+        /// <summary>
+        /// Binds a <see cref="AvaloniaProperty"/> to an observable.
+        /// </summary>
+        /// <typeparam name="T">The type of the property.</typeparam>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        /// <param name="source">The observable.</param>
+        /// <param name="priority">The priority of the binding.</param>
+        /// <returns>
+        /// A disposable which can be used to terminate the binding.
+        /// </returns>
+        public static IDisposable Bind<T>(
+            this IAvaloniaObject target,
+            AvaloniaProperty<T> property,
+            IObservable<BindingValue<T>> source,
+            BindingPriority priority = BindingPriority.LocalValue)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
+
+            return property switch
+            {
+                StyledPropertyBase<T> styled => target.Bind(styled, source, priority),
+                DirectPropertyBase<T> direct => target.Bind(direct, source),
+                _ => throw new NotSupportedException("Unsupported AvaloniaProperty type."),
+            };
+        }
+
         /// <summary>
         /// Binds a <see cref="AvaloniaProperty"/> to an observable.
         /// </summary>
@@ -252,6 +304,10 @@ namespace Avalonia
             IObservable<object> source,
             BindingPriority priority = BindingPriority.LocalValue)
         {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
+
             return target.Bind(
                 property,
                 source.ToBindingValue(),
@@ -274,6 +330,10 @@ namespace Avalonia
             IObservable<T> source,
             BindingPriority priority = BindingPriority.LocalValue)
         {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            source = source ?? throw new ArgumentNullException(nameof(source));
+
             return target.Bind(
                 property,
                 source.ToBindingValue(),
@@ -299,16 +359,16 @@ namespace Avalonia
             IBinding binding,
             object anchor = null)
         {
-            Contract.Requires<ArgumentNullException>(target != null);
-            Contract.Requires<ArgumentNullException>(property != null);
-            Contract.Requires<ArgumentNullException>(binding != null);
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+            binding = binding ?? throw new ArgumentNullException(nameof(binding));
 
             var metadata = property.GetMetadata(target.GetType()) as IDirectPropertyMetadata;
 
             var result = binding.Initiate(
                 target,
                 property,
-                anchor, 
+                anchor,
                 metadata?.EnableDataValidation ?? false);
 
             if (result != null)
@@ -321,6 +381,125 @@ namespace Avalonia
             }
         }
 
+        /// <summary>
+        /// Clears a <see cref="AvaloniaProperty"/>'s local value.
+        /// </summary>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        public static void ClearValue(this IAvaloniaObject target, AvaloniaProperty property)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
+            property.RouteClearValue(target);
+        }
+
+        /// <summary>
+        /// Clears a <see cref="AvaloniaProperty"/>'s local value.
+        /// </summary>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        public static void ClearValue<T>(this IAvaloniaObject target, AvaloniaProperty<T> property)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
+            switch (property)
+            {
+                case StyledPropertyBase<T> styled:
+                    target.ClearValue(styled);
+                    break;
+                case DirectPropertyBase<T> direct:
+                    target.ClearValue(direct);
+                    break;
+                default:
+                    throw new NotSupportedException("Unsupported AvaloniaProperty type.");
+            }
+        }
+
+        /// <summary>
+        /// Gets a <see cref="AvaloniaProperty"/> value.
+        /// </summary>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        /// <returns>The value.</returns>
+        public static object GetValue(this IAvaloniaObject target, AvaloniaProperty property)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
+            return property.RouteGetValue(target);
+        }
+
+        /// <summary>
+        /// Gets a <see cref="AvaloniaProperty"/> value.
+        /// </summary>
+        /// <typeparam name="T">The type of the property.</typeparam>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        /// <returns>The value.</returns>
+        public static T GetValue<T>(this IAvaloniaObject target, AvaloniaProperty<T> property)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
+            return property switch
+            {
+                StyledPropertyBase<T> styled => target.GetValue(styled),
+                DirectPropertyBase<T> direct => target.GetValue(direct),
+                _ => throw new NotSupportedException("Unsupported AvaloniaProperty type.")
+            };
+        }
+
+        /// <summary>
+        /// Sets a <see cref="AvaloniaProperty"/> value.
+        /// </summary>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        /// <param name="value">The value.</param>
+        /// <param name="priority">The priority of the value.</param>
+        public static void SetValue(
+            this IAvaloniaObject target,
+            AvaloniaProperty property,
+            object value,
+            BindingPriority priority = BindingPriority.LocalValue)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
+            property.RouteSetValue(target, value, priority);
+        }
+
+        /// <summary>
+        /// Sets a <see cref="AvaloniaProperty"/> value.
+        /// </summary>
+        /// <typeparam name="T">The type of the property.</typeparam>
+        /// <param name="target">The object.</param>
+        /// <param name="property">The property.</param>
+        /// <param name="value">The value.</param>
+        /// <param name="priority">The priority of the value.</param>
+        public static void SetValue<T>(
+            this IAvaloniaObject target,
+            AvaloniaProperty<T> property,
+            T value,
+            BindingPriority priority = BindingPriority.LocalValue)
+        {
+            target = target ?? throw new ArgumentNullException(nameof(target));
+            property = property ?? throw new ArgumentNullException(nameof(property));
+
+            switch (property)
+            {
+                case StyledPropertyBase<T> styled:
+                    target.SetValue(styled, value, priority);
+                    break;
+                case DirectPropertyBase<T> direct:
+                    target.SetValue(direct, value);
+                    break;
+                default:
+                    throw new NotSupportedException("Unsupported AvaloniaProperty type.");
+            }
+        }
+
         /// <summary>
         /// Subscribes to a property changed notifications for changes that originate from a
         /// <typeparamref name="TTarget"/>.

+ 0 - 5
src/Avalonia.Base/AvaloniaProperty`1.cs

@@ -43,11 +43,6 @@ namespace Avalonia
         {
         }
 
-        internal override void RouteClearValue(IAvaloniaObject o)
-        {
-            o.ClearValue<TValue>(this);
-        }
-
         protected BindingValue<object> TryConvert(object value)
         {
             if (value == UnsetValue)

+ 8 - 2
src/Avalonia.Base/DirectPropertyBase.cs

@@ -116,6 +116,12 @@ namespace Avalonia
             }
         }
 
+        /// <inheritdoc/>
+        internal override void RouteClearValue(IAvaloniaObject o)
+        {
+            o.ClearValue<TValue>(this);
+        }
+
         /// <inheritdoc/>
         internal override object? RouteGetValue(IAvaloniaObject o)
         {
@@ -132,7 +138,7 @@ namespace Avalonia
 
             if (v.HasValue)
             {
-                o.SetValue<TValue>(this, (TValue)v.Value, priority);
+                o.SetValue<TValue>(this, (TValue)v.Value);
             }
             else if (v.Type == BindingValueType.UnsetValue)
             {
@@ -151,7 +157,7 @@ namespace Avalonia
             BindingPriority priority)
         {
             var adapter = TypedBindingAdapter<TValue>.Create(o, this, source);
-            return o.Bind<TValue>(this, adapter, priority);
+            return o.Bind<TValue>(this, adapter);
         }
 
         internal override void RouteInheritanceParentChanged(AvaloniaObject o, IAvaloniaObject oldParent)

+ 20 - 28
src/Avalonia.Base/IAvaloniaObject.cs

@@ -17,23 +17,24 @@ namespace Avalonia
         event EventHandler<AvaloniaPropertyChangedEventArgs> PropertyChanged;
 
         /// <summary>
-        /// Clears a <see cref="AvaloniaProperty"/>'s local value.
+        /// Clears an <see cref="AvaloniaProperty"/>'s local value.
         /// </summary>
         /// <param name="property">The property.</param>
-        public void ClearValue(AvaloniaProperty property);
+        void ClearValue<T>(StyledPropertyBase<T> property);
 
         /// <summary>
-        /// Clears a <see cref="AvaloniaProperty"/>'s local value.
+        /// Clears an <see cref="AvaloniaProperty"/>'s local value.
         /// </summary>
         /// <param name="property">The property.</param>
-        public void ClearValue<T>(AvaloniaProperty<T> property);
+        void ClearValue<T>(DirectPropertyBase<T> property);
 
         /// <summary>
         /// Gets a <see cref="AvaloniaProperty"/> value.
         /// </summary>
+        /// <typeparam name="T">The type of the property.</typeparam>
         /// <param name="property">The property.</param>
         /// <returns>The value.</returns>
-        object GetValue(AvaloniaProperty property);
+        T GetValue<T>(StyledPropertyBase<T> property);
 
         /// <summary>
         /// Gets a <see cref="AvaloniaProperty"/> value.
@@ -41,7 +42,7 @@ namespace Avalonia
         /// <typeparam name="T">The type of the property.</typeparam>
         /// <param name="property">The property.</param>
         /// <returns>The value.</returns>
-        T GetValue<T>(AvaloniaProperty<T> property);
+        T GetValue<T>(DirectPropertyBase<T> property);
 
         /// <summary>
         /// Checks whether a <see cref="AvaloniaProperty"/> is animating.
@@ -60,12 +61,13 @@ namespace Avalonia
         /// <summary>
         /// Sets a <see cref="AvaloniaProperty"/> value.
         /// </summary>
+        /// <typeparam name="T">The type of the property.</typeparam>
         /// <param name="property">The property.</param>
         /// <param name="value">The value.</param>
         /// <param name="priority">The priority of the value.</param>
-        void SetValue(
-            AvaloniaProperty property, 
-            object value, 
+        void SetValue<T>(
+            StyledPropertyBase<T> property,
+            T value,
             BindingPriority priority = BindingPriority.LocalValue);
 
         /// <summary>
@@ -74,24 +76,21 @@ namespace Avalonia
         /// <typeparam name="T">The type of the property.</typeparam>
         /// <param name="property">The property.</param>
         /// <param name="value">The value.</param>
-        /// <param name="priority">The priority of the value.</param>
-        void SetValue<T>(
-            AvaloniaProperty<T> property,
-            T value,
-            BindingPriority priority = BindingPriority.LocalValue);
+        void SetValue<T>(DirectPropertyBase<T> property, T value);
 
         /// <summary>
         /// Binds a <see cref="AvaloniaProperty"/> to an observable.
         /// </summary>
+        /// <typeparam name="T">The type of the property.</typeparam>
         /// <param name="property">The property.</param>
         /// <param name="source">The observable.</param>
         /// <param name="priority">The priority of the binding.</param>
         /// <returns>
         /// A disposable which can be used to terminate the binding.
         /// </returns>
-        IDisposable Bind(
-            AvaloniaProperty property,
-            IObservable<BindingValue<object>> source,
+        IDisposable Bind<T>(
+            StyledPropertyBase<T> property,
+            IObservable<BindingValue<T>> source,
             BindingPriority priority = BindingPriority.LocalValue);
 
         /// <summary>
@@ -100,14 +99,12 @@ namespace Avalonia
         /// <typeparam name="T">The type of the property.</typeparam>
         /// <param name="property">The property.</param>
         /// <param name="source">The observable.</param>
-        /// <param name="priority">The priority of the binding.</param>
         /// <returns>
         /// A disposable which can be used to terminate the binding.
         /// </returns>
         IDisposable Bind<T>(
-            AvaloniaProperty<T> property,
-            IObservable<BindingValue<T>> source,
-            BindingPriority priority = BindingPriority.LocalValue);
+            DirectPropertyBase<T> property,
+            IObservable<BindingValue<T>> source);
 
         /// <summary>
         /// Registers an object as an inheritance child.
@@ -130,19 +127,14 @@ namespace Avalonia
         /// </remarks>
         void RemoveInheritanceChild(IAvaloniaObject child);
 
-        //void InheritanceParentChanged<T>(
-        //    StyledPropertyBase<T> property,
-        //    IAvaloniaObject oldParent,
-        //    IAvaloniaObject newParent);
-
         /// <summary>
         /// Called when an inheritable property changes on an object registered as an inheritance
         /// parent.
         /// </summary>
         /// <typeparam name="T">The type of the value.</typeparam>
         /// <param name="property">The property that has changed.</param>
-        /// <param name="oldValue">The old property value.</param>
-        /// <param name="newValue">The new property value.</param>
+        /// <param name="oldValue"></param>
+        /// <param name="newValue"></param>
         void InheritedPropertyChanged<T>(
             AvaloniaProperty<T> property,
             Optional<T> oldValue,

+ 6 - 0
src/Avalonia.Base/StyledPropertyBase.cs

@@ -153,6 +153,12 @@ namespace Avalonia
             }
         }
 
+        /// <inheritdoc/>
+        internal override void RouteClearValue(IAvaloniaObject o)
+        {
+            o.ClearValue<TValue>(this);
+        }
+
         /// <inheritdoc/>
         internal override object RouteGetValue(IAvaloniaObject o)
         {

+ 5 - 0
tests/Avalonia.Base.UnitTests/AvaloniaPropertyTests.cs

@@ -154,6 +154,11 @@ namespace Avalonia.Base.UnitTests
                 throw new NotImplementedException();
             }
 
+            internal override void RouteClearValue(IAvaloniaObject o)
+            {
+                throw new NotImplementedException();
+            }
+
             internal override object RouteGetValue(IAvaloniaObject o)
             {
                 throw new NotImplementedException();

+ 5 - 7
tests/Avalonia.Markup.UnitTests/Data/BindingTests_TemplatedParent.cs

@@ -35,8 +35,7 @@ namespace Avalonia.Markup.UnitTests.Data
 
             target.Verify(x => x.Bind(
                 TextBox.TextProperty, 
-                It.IsAny<IObservable<BindingValue<object>>>(), 
-                BindingPriority.TemplatedParent));
+                It.IsAny<IObservable<BindingValue<string>>>()));
         }
 
         [Fact]
@@ -55,8 +54,7 @@ namespace Avalonia.Markup.UnitTests.Data
 
             target.Verify(x => x.Bind(
                 TextBox.TextProperty,
-                It.IsAny<IObservable<BindingValue<object>>>(),
-                BindingPriority.TemplatedParent));
+                It.IsAny<IObservable<BindingValue<string>>>()));
         }
 
         private Mock<IControl> CreateTarget(
@@ -66,9 +64,9 @@ namespace Avalonia.Markup.UnitTests.Data
             var result = new Mock<IControl>();
 
             result.Setup(x => x.GetValue(Control.TemplatedParentProperty)).Returns(templatedParent);
-            result.Setup(x => x.GetValue((AvaloniaProperty)Control.TemplatedParentProperty)).Returns(templatedParent);
-            result.Setup(x => x.GetValue((AvaloniaProperty)TextBox.TextProperty)).Returns(text);
-            result.Setup(x => x.Bind(It.IsAny<AvaloniaProperty>(), It.IsAny<IObservable<BindingValue<object>>>(), It.IsAny<BindingPriority>()))
+            result.Setup(x => x.GetValue(Control.TemplatedParentProperty)).Returns(templatedParent);
+            result.Setup(x => x.GetValue(TextBox.TextProperty)).Returns(text);
+            result.Setup(x => x.Bind(It.IsAny<DirectPropertyBase<string>>(), It.IsAny<IObservable<BindingValue<string>>>()))
                 .Returns(Disposable.Empty);
             return result;
         }

+ 40 - 0
tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs

@@ -195,6 +195,46 @@ namespace Avalonia.Styling.UnitTests
             {
                 throw new NotImplementedException();
             }
+
+            public void ClearValue<T>(StyledPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void ClearValue<T>(DirectPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public T GetValue<T>(StyledPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public T GetValue<T>(DirectPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void SetValue<T>(StyledPropertyBase<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void SetValue<T>(DirectPropertyBase<T> property, T value)
+            {
+                throw new NotImplementedException();
+            }
+
+            public IDisposable Bind<T>(StyledPropertyBase<T> property, IObservable<BindingValue<T>> source, BindingPriority priority = BindingPriority.LocalValue)
+            {
+                throw new NotImplementedException();
+            }
+
+            public IDisposable Bind<T>(DirectPropertyBase<T> property, IObservable<BindingValue<T>> source)
+            {
+                throw new NotImplementedException();
+            }
         }
 
         public class TestLogical1 : TestLogical

+ 40 - 0
tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs

@@ -225,6 +225,46 @@ namespace Avalonia.Styling.UnitTests
             {
                 throw new NotImplementedException();
             }
+
+            public void ClearValue<T>(StyledPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void ClearValue<T>(DirectPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public T GetValue<T>(StyledPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public T GetValue<T>(DirectPropertyBase<T> property)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void SetValue<T>(StyledPropertyBase<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
+            {
+                throw new NotImplementedException();
+            }
+
+            public void SetValue<T>(DirectPropertyBase<T> property, T value)
+            {
+                throw new NotImplementedException();
+            }
+
+            public IDisposable Bind<T>(StyledPropertyBase<T> property, IObservable<BindingValue<T>> source, BindingPriority priority = BindingPriority.LocalValue)
+            {
+                throw new NotImplementedException();
+            }
+
+            public IDisposable Bind<T>(DirectPropertyBase<T> property, IObservable<BindingValue<T>> source)
+            {
+                throw new NotImplementedException();
+            }
         }
 
         public class TestLogical1 : TestLogical

+ 4 - 8
tests/Avalonia.Styling.UnitTests/SetterTests.cs

@@ -83,8 +83,7 @@ namespace Avalonia.Styling.UnitTests
 
             control.Verify(x => x.Bind(
                 TextBlock.TextProperty,
-                It.IsAny<IObservable<BindingValue<object>>>(),
-                BindingPriority.Style));
+                It.IsAny<IObservable<BindingValue<string>>>()));
         }
 
         [Fact]
@@ -99,8 +98,7 @@ namespace Avalonia.Styling.UnitTests
 
             control.Verify(x => x.Bind(
                 TextBlock.TextProperty,
-                It.IsAny<IObservable<BindingValue<object>>>(),
-                BindingPriority.StyleTrigger));
+                It.IsAny<IObservable<BindingValue<string>>>()));
         }
 
         [Fact]
@@ -114,8 +112,7 @@ namespace Avalonia.Styling.UnitTests
 
             control.Verify(x => x.Bind(
                 TextBlock.TextProperty,
-                It.IsAny<IObservable<BindingValue<object>>>(),
-                BindingPriority.Style));
+                It.IsAny<IObservable<BindingValue<string>>>()));
         }
 
         [Fact]
@@ -130,8 +127,7 @@ namespace Avalonia.Styling.UnitTests
 
             control.Verify(x => x.Bind(
                 TextBlock.TextProperty,
-                It.IsAny<IObservable<BindingValue<object>>>(),
-                BindingPriority.StyleTrigger));
+                It.IsAny<IObservable<BindingValue<string>>>()));
         }
 
         private IBinding CreateMockBinding(AvaloniaProperty property)

+ 40 - 0
tests/Avalonia.Styling.UnitTests/TestControlBase.cs

@@ -109,5 +109,45 @@ namespace Avalonia.Styling.UnitTests
         {
             throw new NotImplementedException();
         }
+
+        public void ClearValue<T>(StyledPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void ClearValue<T>(DirectPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public T GetValue<T>(StyledPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public T GetValue<T>(DirectPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SetValue<T>(StyledPropertyBase<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SetValue<T>(DirectPropertyBase<T> property, T value)
+        {
+            throw new NotImplementedException();
+        }
+
+        public IDisposable Bind<T>(StyledPropertyBase<T> property, IObservable<BindingValue<T>> source, BindingPriority priority = BindingPriority.LocalValue)
+        {
+            throw new NotImplementedException();
+        }
+
+        public IDisposable Bind<T>(DirectPropertyBase<T> property, IObservable<BindingValue<T>> source)
+        {
+            throw new NotImplementedException();
+        }
     }
 }

+ 40 - 0
tests/Avalonia.Styling.UnitTests/TestTemplatedControl.cs

@@ -107,5 +107,45 @@ namespace Avalonia.Styling.UnitTests
         {
             throw new NotImplementedException();
         }
+
+        public void ClearValue<T>(StyledPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void ClearValue<T>(DirectPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public T GetValue<T>(StyledPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public T GetValue<T>(DirectPropertyBase<T> property)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SetValue<T>(StyledPropertyBase<T> property, T value, BindingPriority priority = BindingPriority.LocalValue)
+        {
+            throw new NotImplementedException();
+        }
+
+        public void SetValue<T>(DirectPropertyBase<T> property, T value)
+        {
+            throw new NotImplementedException();
+        }
+
+        public IDisposable Bind<T>(StyledPropertyBase<T> property, IObservable<BindingValue<T>> source, BindingPriority priority = BindingPriority.LocalValue)
+        {
+            throw new NotImplementedException();
+        }
+
+        public IDisposable Bind<T>(DirectPropertyBase<T> property, IObservable<BindingValue<T>> source)
+        {
+            throw new NotImplementedException();
+        }
     }
 }