diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs index 6e9447fff1..56735cc90b 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs @@ -81,89 +81,12 @@ namespace Avalonia.Styling.UnitTests Assert.Equal("TestLogical1 > TestLogical3", selector.ToString()); } - public abstract class TestLogical : ILogical, IStyleable + public abstract class TestLogical : Control { - public TestLogical() + public ILogical LogicalParent { - Classes = new Classes(); - } - - public event EventHandler PropertyChanged; - public event EventHandler InheritablePropertyChanged; - public event EventHandler AttachedToLogicalTree; - public event EventHandler DetachedFromLogicalTree; - - public Classes Classes { get; } - - public string Name { get; set; } - - public bool IsAttachedToLogicalTree { get; } - - public IAvaloniaReadOnlyList LogicalChildren { get; set; } - - public ILogical LogicalParent { get; set; } - - public Type StyleKey { get; } - - public ITemplatedControl TemplatedParent { get; } - - IObservable IStyleable.StyleDetach { get; } - - IAvaloniaReadOnlyList IStyleable.Classes => Classes; - - public object GetValue(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public T GetValue(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public void SetValue(AvaloniaProperty property, object value, BindingPriority priority) - { - throw new NotImplementedException(); - } - - public void SetValue(AvaloniaProperty property, T value, BindingPriority priority = BindingPriority.LocalValue) - { - throw new NotImplementedException(); - } - - public IDisposable Bind(AvaloniaProperty property, IObservable> source, BindingPriority priority) - { - throw new NotImplementedException(); - } - - public bool IsAnimating(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public bool IsSet(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public IDisposable Bind(AvaloniaProperty property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) - { - throw new NotImplementedException(); - } - - public void NotifyAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) - { - throw new NotImplementedException(); - } - - public void NotifyDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e) - { - throw new NotImplementedException(); - } - - public void NotifyResourcesChanged(ResourcesChangedEventArgs e) - { - throw new NotImplementedException(); + get => Parent; + set => ((ISetLogicalParent)this).SetParent(value); } public void ClearValue(AvaloniaProperty property) diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Class.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Class.cs index 496998ecd9..fd25b17ba4 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Class.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Class.cs @@ -144,7 +144,7 @@ namespace Avalonia.Styling.UnitTests Assert.Equal(new[] { true, false }, result); } - public class Control1 : TestControlBase + public class Control1 : Control { } } diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs index f64a3010c4..099562b1cf 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs @@ -111,89 +111,12 @@ namespace Avalonia.Styling.UnitTests Assert.Equal("TestLogical1.foo TestLogical3", selector.ToString()); } - public abstract class TestLogical : ILogical, IStyleable + public abstract class TestLogical : Control { - public TestLogical() + public ILogical LogicalParent { - Classes = new Classes(); - } - - public event EventHandler PropertyChanged; - public event EventHandler InheritablePropertyChanged; - public event EventHandler AttachedToLogicalTree; - public event EventHandler DetachedFromLogicalTree; - - public Classes Classes { get; } - - public string Name { get; set; } - - public bool IsAttachedToLogicalTree { get; } - - public IAvaloniaReadOnlyList LogicalChildren { get; set; } - - public ILogical LogicalParent { get; set; } - - public Type StyleKey { get; } - - public ITemplatedControl TemplatedParent { get; } - - IAvaloniaReadOnlyList IStyleable.Classes => Classes; - - IObservable IStyleable.StyleDetach { get; } - - public object GetValue(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public T GetValue(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public void SetValue(AvaloniaProperty property, object value, BindingPriority priority) - { - throw new NotImplementedException(); - } - - public void SetValue(AvaloniaProperty property, T value, BindingPriority priority = BindingPriority.LocalValue) - { - throw new NotImplementedException(); - } - - public IDisposable Bind(AvaloniaProperty property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) - { - throw new NotImplementedException(); - } - - public bool IsAnimating(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public bool IsSet(AvaloniaProperty property) - { - throw new NotImplementedException(); - } - - public IDisposable Bind(AvaloniaProperty property, IObservable> source, BindingPriority priority = BindingPriority.LocalValue) - { - throw new NotImplementedException(); - } - - public void NotifyAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) - { - throw new NotImplementedException(); - } - - public void NotifyDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e) - { - throw new NotImplementedException(); - } - - public void NotifyResourcesChanged(ResourcesChangedEventArgs e) - { - throw new NotImplementedException(); + get => Parent; + set => ((ISetLogicalParent)this).SetParent(value); } public void ClearValue(AvaloniaProperty property) diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Name.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Name.cs index 1c8a3a406e..26734a494b 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Name.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Name.cs @@ -1,6 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using Avalonia.Controls; using Moq; using Xunit; @@ -52,7 +53,7 @@ namespace Avalonia.Styling.UnitTests Assert.Equal("Control1#foo", target.ToString()); } - public class Control1 : TestControlBase + public class Control1 : Control { } } diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Not.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Not.cs index 2f3e2b8f34..7c23cb4d2c 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Not.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Not.cs @@ -103,11 +103,11 @@ namespace Avalonia.Styling.UnitTests Assert.Equal(typeof(Control1), target.TargetType); } - public class Control1 : TestControlBase + public class Control1 : Control { } - public class Control2 : TestControlBase + public class Control2 : Control { } } diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_OfType.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_OfType.cs index 05f3544366..a254c73c03 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_OfType.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_OfType.cs @@ -1,6 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using Avalonia.Controls; using Moq; using Xunit; @@ -44,11 +45,11 @@ namespace Avalonia.Styling.UnitTests Assert.Equal(SelectorMatchResult.AlwaysThisType, target.Match(control).Result); } - public class Control1 : TestControlBase + public class Control1 : Control { } - public class Control2 : TestControlBase + public class Control2 : Control { } } diff --git a/tests/Avalonia.Styling.UnitTests/SelectorTests_Or.cs b/tests/Avalonia.Styling.UnitTests/SelectorTests_Or.cs index 521c73ce27..e9bc93c957 100644 --- a/tests/Avalonia.Styling.UnitTests/SelectorTests_Or.cs +++ b/tests/Avalonia.Styling.UnitTests/SelectorTests_Or.cs @@ -1,6 +1,7 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. +using Avalonia.Controls; using Xunit; namespace Avalonia.Styling.UnitTests @@ -78,7 +79,7 @@ namespace Avalonia.Styling.UnitTests default(Selector).OfType().Class("foo"), default(Selector).OfType().Class("bar")); - Assert.Equal(typeof(TestControlBase), target.TargetType); + Assert.Equal(typeof(Control), target.TargetType); } [Fact] @@ -91,15 +92,15 @@ namespace Avalonia.Styling.UnitTests Assert.Equal(null, target.TargetType); } - public class Control1 : TestControlBase + public class Control1 : Control { } - public class Control2 : TestControlBase + public class Control2 : Control { } - public class Control3 : TestControlBase + public class Control3 : Control { } }