Browse Source

Update tests

pull/4880/head
Giuseppe Lippolis 6 years ago
parent
commit
c98918bc2a
  1. 8
      tests/Avalonia.Animation.UnitTests/AnimatableTests.cs
  2. 4
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Metadata.cs
  3. 4
      tests/Avalonia.Base.UnitTests/Collections/AvaloniaListExtenionsTests.cs
  4. 2
      tests/Avalonia.Base.UnitTests/Data/Core/BindingExpressionTests.cs
  5. 14
      tests/Avalonia.Base.UnitTests/Data/DefaultValueConverterTests.cs
  6. 3
      tests/Avalonia.Benchmarks/NullRenderer.cs
  7. 3
      tests/Avalonia.Benchmarks/NullThreadingPlatform.cs
  8. 2
      tests/Avalonia.Controls.UnitTests/BorderTests.cs
  9. 2
      tests/Avalonia.Controls.UnitTests/PanelTests.cs
  10. 10
      tests/Avalonia.Controls.UnitTests/Platform/DefaultMenuInteractionHandlerTests.cs
  11. 2
      tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Standalone.cs
  12. 4
      tests/Avalonia.Controls.UnitTests/TextBlockTests.cs
  13. 13
      tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs
  14. 20
      tests/Avalonia.DesignerSupport.TestApp/Program.cs
  15. 6
      tests/Avalonia.Layout.UnitTests/LayoutableTests.cs
  16. 2
      tests/Avalonia.Layout.UnitTests/LayoutableTests_EffectiveViewportChanged.cs
  17. 7
      tests/Avalonia.LeakTests/ControlTests.cs
  18. 15
      tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_Negation.cs
  19. 2
      tests/Avalonia.RenderTests/Media/BitmapTests.cs
  20. 12
      tests/Avalonia.Styling.UnitTests/ResourceDictionaryTests.cs
  21. 75
      tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs
  22. 74
      tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs
  23. 2
      tests/Avalonia.Styling.UnitTests/StyleTests.cs
  24. 8
      tests/Avalonia.Styling.UnitTests/StylesTests.cs
  25. 2
      tests/Avalonia.Visuals.UnitTests/Rendering/DeferredRendererTests.cs
  26. 2
      tests/Avalonia.Visuals.UnitTests/VisualTests.cs

8
tests/Avalonia.Animation.UnitTests/AnimatableTests.cs

@ -113,7 +113,7 @@ namespace Avalonia.Animation.UnitTests
It.IsAny<IClock>(), It.IsAny<IClock>(),
1.0, 1.0,
0.5)); 0.5));
target.ResetCalls(); target.Invocations.Clear();
control.SetValue(Visual.OpacityProperty, 0.8, BindingPriority.StyleTrigger); control.SetValue(Visual.OpacityProperty, 0.8, BindingPriority.StyleTrigger);
@ -135,7 +135,7 @@ namespace Avalonia.Animation.UnitTests
target.Setup(x => x.Apply(control, It.IsAny<IClock>(), 1.0, 0.5)).Returns(sub.Object); target.Setup(x => x.Apply(control, It.IsAny<IClock>(), 1.0, 0.5)).Returns(sub.Object);
control.Opacity = 0.5; control.Opacity = 0.5;
sub.ResetCalls(); sub.Invocations.Clear();
control.Opacity = 0.4; control.Opacity = 0.4;
sub.Verify(x => x.Dispose()); sub.Verify(x => x.Dispose());
@ -158,7 +158,7 @@ namespace Avalonia.Animation.UnitTests
control.Opacity = 0.5; control.Opacity = 0.5;
Assert.Equal(0.9, control.Opacity); Assert.Equal(0.9, control.Opacity);
target.ResetCalls(); target.Invocations.Clear();
control.Opacity = 0.4; control.Opacity = 0.4;
@ -182,7 +182,7 @@ namespace Avalonia.Animation.UnitTests
It.IsAny<IClock>(), It.IsAny<IClock>(),
1.0, 1.0,
0.5)); 0.5));
target.ResetCalls(); target.Invocations.Clear();
var root = (TestRoot)control.Parent; var root = (TestRoot)control.Parent;
root.Child = null; root.Child = null;

4
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Metadata.cs

@ -67,7 +67,7 @@ namespace Avalonia.Base.UnitTests
public static readonly DirectProperty<Class1, string> DirectProperty = public static readonly DirectProperty<Class1, string> DirectProperty =
AvaloniaProperty.RegisterDirect<Class1, string>("Styled", o => o.Direct, unsetValue: "foo"); AvaloniaProperty.RegisterDirect<Class1, string>("Styled", o => o.Direct, unsetValue: "foo");
private string _direct; private string _direct = default;
public string Direct public string Direct
{ {
@ -92,7 +92,7 @@ namespace Avalonia.Base.UnitTests
public static readonly DirectProperty<Class3, string> DirectProperty = public static readonly DirectProperty<Class3, string> DirectProperty =
Class1.DirectProperty.AddOwner<Class3>(o => o.Direct, unsetValue: "baz"); Class1.DirectProperty.AddOwner<Class3>(o => o.Direct, unsetValue: "baz");
private string _direct; private string _direct = default;
static Class3() static Class3()
{ {

4
tests/Avalonia.Base.UnitTests/Collections/AvaloniaListExtenionsTests.cs

@ -6,10 +6,12 @@ namespace Avalonia.Base.UnitTests.Collections
{ {
public class AvaloniaListExtenionsTests public class AvaloniaListExtenionsTests
{ {
#pragma warning disable CS0618 // Type or member is obsolete
[Fact] [Fact]
public void CreateDerivedList_Creates_Initial_Items() public void CreateDerivedList_Creates_Initial_Items()
{ {
var source = new AvaloniaList<int>(new[] { 0, 1, 2, 3 }); var source = new AvaloniaList<int>(new[] { 0, 1, 2, 3 });
var target = source.CreateDerivedList(x => new Wrapper(x)); var target = source.CreateDerivedList(x => new Wrapper(x));
var result = target.Select(x => x.Value).ToList(); var result = target.Select(x => x.Value).ToList();
@ -137,6 +139,8 @@ namespace Avalonia.Base.UnitTests.Collections
Assert.Equal(source, result); Assert.Equal(source, result);
} }
#pragma warning restore CS0618 // Type or member is obsolete
private class Wrapper private class Wrapper
{ {

2
tests/Avalonia.Base.UnitTests/Data/Core/BindingExpressionTests.cs

@ -356,7 +356,7 @@ namespace Avalonia.Base.UnitTests.Data.Core
} }
[Fact] [Fact]
public async Task Null_Value_Should_Use_TargetNullValue() public void Null_Value_Should_Use_TargetNullValue()
{ {
var data = new Class1 { StringValue = "foo" }; var data = new Class1 { StringValue = "foo" };

14
tests/Avalonia.Base.UnitTests/Data/DefaultValueConverterTests.cs

@ -1,12 +1,11 @@
using System;
using System.ComponentModel;
using System.Globalization; using System.Globalization;
using Avalonia.Controls;
using Avalonia.Data;
using Xunit;
using System.Windows.Input; using System.Windows.Input;
using System; using Avalonia.Data;
using Avalonia.Data.Converters; using Avalonia.Data.Converters;
using Avalonia.Layout; using Avalonia.Layout;
using System.ComponentModel; using Xunit;
namespace Avalonia.Base.UnitTests.Data.Converters namespace Avalonia.Base.UnitTests.Data.Converters
{ {
@ -251,6 +250,11 @@ namespace Avalonia.Base.UnitTests.Data.Converters
{ {
return obj is CustomType other && this.Value == other.Value; return obj is CustomType other && this.Value == other.Value;
} }
public override int GetHashCode()
{
return 8399587^Value.GetHashCode();
}
} }
private class CustomTypeConverter : TypeConverter private class CustomTypeConverter : TypeConverter

3
tests/Avalonia.Benchmarks/NullRenderer.cs

@ -9,8 +9,9 @@ namespace Avalonia.Benchmarks
{ {
public bool DrawFps { get; set; } public bool DrawFps { get; set; }
public bool DrawDirtyRects { get; set; } public bool DrawDirtyRects { get; set; }
#pragma warning disable CS0067
public event EventHandler<SceneInvalidatedEventArgs> SceneInvalidated; public event EventHandler<SceneInvalidatedEventArgs> SceneInvalidated;
#pragma warning restore CS0067
public void AddDirty(IVisual visual) public void AddDirty(IVisual visual)
{ {
} }

3
tests/Avalonia.Benchmarks/NullThreadingPlatform.cs

@ -23,6 +23,9 @@ namespace Avalonia.Benchmarks
public bool CurrentThreadIsLoopThread => true; public bool CurrentThreadIsLoopThread => true;
#pragma warning disable CS0067
public event Action<DispatcherPriority?> Signaled; public event Action<DispatcherPriority?> Signaled;
#pragma warning restore CS0067
} }
} }

2
tests/Avalonia.Controls.UnitTests/BorderTests.cs

@ -54,7 +54,7 @@ namespace Avalonia.Controls.UnitTests
var root = new TestRoot(target); var root = new TestRoot(target);
var renderer = Mock.Get(root.Renderer); var renderer = Mock.Get(root.Renderer);
renderer.ResetCalls(); renderer.Invocations.Clear();
((SolidColorBrush)target.Background).Color = Colors.Green; ((SolidColorBrush)target.Background).Color = Colors.Green;

2
tests/Avalonia.Controls.UnitTests/PanelTests.cs

@ -127,7 +127,7 @@ namespace Avalonia.Controls.UnitTests
var root = new TestRoot(target); var root = new TestRoot(target);
var renderer = Mock.Get(root.Renderer); var renderer = Mock.Get(root.Renderer);
renderer.ResetCalls(); renderer.Invocations.Clear();
((SolidColorBrush)target.Background).Color = Colors.Green; ((SolidColorBrush)target.Background).Color = Colors.Green;

10
tests/Avalonia.Controls.UnitTests/Platform/DefaultMenuInteractionHandlerTests.cs

@ -503,26 +503,26 @@ namespace Avalonia.Controls.UnitTests.Platform
target.PointerEnter(item, enter); target.PointerEnter(item, enter);
Assert.True(timer.ActionIsQueued); Assert.True(timer.ActionIsQueued);
Mock.Get(parentItem).VerifySet(x => x.SelectedItem = item); Mock.Get(parentItem).VerifySet(x => x.SelectedItem = item);
Mock.Get(parentItem).ResetCalls(); Mock.Get(parentItem).Invocations.Clear();
// SubMenu shown after a delay. // SubMenu shown after a delay.
timer.Pulse(); timer.Pulse();
Mock.Get(item).Verify(x => x.Open()); Mock.Get(item).Verify(x => x.Open());
Mock.Get(item).SetupGet(x => x.IsSubMenuOpen).Returns(true); Mock.Get(item).SetupGet(x => x.IsSubMenuOpen).Returns(true);
Mock.Get(item).ResetCalls(); Mock.Get(item).Invocations.Clear();
// Pointer briefly exits item, but submenu remains open. // Pointer briefly exits item, but submenu remains open.
target.PointerLeave(item, leave); target.PointerLeave(item, leave);
Mock.Get(item).Verify(x => x.Close(), Times.Never); Mock.Get(item).Verify(x => x.Close(), Times.Never);
Mock.Get(item).ResetCalls(); Mock.Get(item).Invocations.Clear();
// Pointer enters child item; is selected. // Pointer enters child item; is selected.
enter.Source = childItem; enter.Source = childItem;
target.PointerEnter(childItem, enter); target.PointerEnter(childItem, enter);
Mock.Get(item).VerifySet(x => x.SelectedItem = childItem); Mock.Get(item).VerifySet(x => x.SelectedItem = childItem);
Mock.Get(parentItem).VerifySet(x => x.SelectedItem = item); Mock.Get(parentItem).VerifySet(x => x.SelectedItem = item);
Mock.Get(item).ResetCalls(); Mock.Get(item).Invocations.Clear();
Mock.Get(parentItem).ResetCalls(); Mock.Get(parentItem).Invocations.Clear();
} }
[Fact] [Fact]

2
tests/Avalonia.Controls.UnitTests/Presenters/ContentPresenterTests_Standalone.cs

@ -212,7 +212,7 @@ namespace Avalonia.Controls.UnitTests.Presenters
var root = new TestRoot(target); var root = new TestRoot(target);
var renderer = Mock.Get(root.Renderer); var renderer = Mock.Get(root.Renderer);
renderer.ResetCalls(); renderer.Invocations.Clear();
((SolidColorBrush)target.Background).Color = Colors.Green; ((SolidColorBrush)target.Background).Color = Colors.Green;

4
tests/Avalonia.Controls.UnitTests/TextBlockTests.cs

@ -37,7 +37,7 @@ namespace Avalonia.Controls.UnitTests
var root = new TestRoot(target); var root = new TestRoot(target);
var renderer = Mock.Get(root.Renderer); var renderer = Mock.Get(root.Renderer);
renderer.ResetCalls(); renderer.Invocations.Clear();
((SolidColorBrush)target.Background).Color = Colors.Green; ((SolidColorBrush)target.Background).Color = Colors.Green;
@ -54,7 +54,7 @@ namespace Avalonia.Controls.UnitTests
var root = new TestRoot(target); var root = new TestRoot(target);
var renderer = Mock.Get(root.Renderer); var renderer = Mock.Get(root.Renderer);
renderer.ResetCalls(); renderer.Invocations.Clear();
((SolidColorBrush)target.Foreground).Color = Colors.Green; ((SolidColorBrush)target.Foreground).Color = Colors.Green;

13
tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs

@ -1,8 +1,4 @@
using System; using Avalonia.Controls.ApplicationLifetimes;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
namespace Avalonia.DesignerSupport.TestApp namespace Avalonia.DesignerSupport.TestApp
@ -13,5 +9,12 @@ namespace Avalonia.DesignerSupport.TestApp
{ {
AvaloniaXamlLoader.Load(this); AvaloniaXamlLoader.Load(this);
} }
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
desktop.MainWindow = new MainWindow();
base.OnFrameworkInitializationCompleted();
}
} }
} }

20
tests/Avalonia.DesignerSupport.TestApp/Program.cs

@ -1,24 +1,14 @@
using System; namespace Avalonia.DesignerSupport.TestApp
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Avalonia.Controls;
namespace Avalonia.DesignerSupport.TestApp
{ {
static class Program static class Program
{ {
/// <summary> /// <summary>
/// The main entry point for the application. /// The main entry point for the application.
/// </summary> /// </summary>
static void Main() public static int Main(string[] args)
{ => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
BuildAvaloniaApp().Start<MainWindow>();
}
private static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
{ => AppBuilder.Configure<App>().UsePlatformDetect();
return AppBuilder.Configure<App>().UsePlatformDetect();
}
} }
} }

6
tests/Avalonia.Layout.UnitTests/LayoutableTests.cs

@ -112,7 +112,7 @@ namespace Avalonia.Layout.UnitTests
root.Measure(Size.Infinity); root.Measure(Size.Infinity);
root.Arrange(new Rect(root.DesiredSize)); root.Arrange(new Rect(root.DesiredSize));
target.ResetCalls(); target.Invocations.Clear();
control.InvalidateMeasure(); control.InvalidateMeasure();
control.InvalidateMeasure(); control.InvalidateMeasure();
@ -133,7 +133,7 @@ namespace Avalonia.Layout.UnitTests
root.Measure(Size.Infinity); root.Measure(Size.Infinity);
root.Arrange(new Rect(root.DesiredSize)); root.Arrange(new Rect(root.DesiredSize));
target.ResetCalls(); target.Invocations.Clear();
control.InvalidateArrange(); control.InvalidateArrange();
control.InvalidateArrange(); control.InvalidateArrange();
@ -163,7 +163,7 @@ namespace Avalonia.Layout.UnitTests
Assert.False(control.IsMeasureValid); Assert.False(control.IsMeasureValid);
Assert.True(root.IsMeasureValid); Assert.True(root.IsMeasureValid);
target.ResetCalls(); target.Invocations.Clear();
root.Child = control; root.Child = control;

2
tests/Avalonia.Layout.UnitTests/LayoutableTests_EffectiveViewportChanged.cs

@ -15,7 +15,9 @@ namespace Avalonia.Layout.UnitTests
[Fact] [Fact]
public async Task EffectiveViewportChanged_Not_Raised_When_Control_Added_To_Tree() public async Task EffectiveViewportChanged_Not_Raised_When_Control_Added_To_Tree()
{ {
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
await RunOnUIThread.Execute(async () => await RunOnUIThread.Execute(async () =>
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{ {
var root = CreateRoot(); var root = CreateRoot();
var target = new Canvas(); var target = new Canvas();

7
tests/Avalonia.LeakTests/ControlTests.cs

@ -460,7 +460,7 @@ namespace Avalonia.LeakTests
AttachShowAndDetachContextMenu(window); AttachShowAndDetachContextMenu(window);
Mock.Get(window.PlatformImpl).ResetCalls(); Mock.Get(window.PlatformImpl).Invocations.Clear();
dotMemory.Check(memory => dotMemory.Check(memory =>
Assert.Equal(initialMenuCount, memory.GetObjects(where => where.Type.Is<ContextMenu>()).ObjectsCount)); Assert.Equal(initialMenuCount, memory.GetObjects(where => where.Type.Is<ContextMenu>()).ObjectsCount));
dotMemory.Check(memory => dotMemory.Check(memory =>
@ -505,7 +505,7 @@ namespace Avalonia.LeakTests
BuildAndShowContextMenu(window); BuildAndShowContextMenu(window);
BuildAndShowContextMenu(window); BuildAndShowContextMenu(window);
Mock.Get(window.PlatformImpl).ResetCalls(); Mock.Get(window.PlatformImpl).Invocations.Clear();
dotMemory.Check(memory => dotMemory.Check(memory =>
Assert.Equal(initialMenuCount, memory.GetObjects(where => where.Type.Is<ContextMenu>()).ObjectsCount)); Assert.Equal(initialMenuCount, memory.GetObjects(where => where.Type.Is<ContextMenu>()).ObjectsCount));
dotMemory.Check(memory => dotMemory.Check(memory =>
@ -601,8 +601,9 @@ namespace Avalonia.LeakTests
{ {
public bool DrawFps { get; set; } public bool DrawFps { get; set; }
public bool DrawDirtyRects { get; set; } public bool DrawDirtyRects { get; set; }
#pragma warning disable CS0067
public event EventHandler<SceneInvalidatedEventArgs> SceneInvalidated; public event EventHandler<SceneInvalidatedEventArgs> SceneInvalidated;
#pragma warning restore CS0067
public void AddDirty(IVisual visual) public void AddDirty(IVisual visual)
{ {
} }

15
tests/Avalonia.Markup.UnitTests/Parsers/ExpressionObserverBuilderTests_Negation.cs

@ -168,10 +168,23 @@ namespace Avalonia.Markup.UnitTests.Parsers
private class Test : INotifyDataErrorInfo private class Test : INotifyDataErrorInfo
{ {
private string _dataValidationError;
public bool Foo { get; set; } public bool Foo { get; set; }
public object Bar { get; set; } public object Bar { get; set; }
public string DataValidationError { get; set; } public string DataValidationError
{
get => _dataValidationError;
set
{
if (value == _dataValidationError)
return;
_dataValidationError = value;
ErrorsChanged?
.Invoke(this, new DataErrorsChangedEventArgs(nameof(DataValidationError)));
}
}
public bool HasErrors => !string.IsNullOrWhiteSpace(DataValidationError); public bool HasErrors => !string.IsNullOrWhiteSpace(DataValidationError);
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged; public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;

2
tests/Avalonia.RenderTests/Media/BitmapTests.cs

@ -102,7 +102,9 @@ namespace Avalonia.Direct2D1.RenderTests.Media
[InlineData(PixelFormat.Bgra8888), InlineData(PixelFormat.Rgba8888)] [InlineData(PixelFormat.Bgra8888), InlineData(PixelFormat.Rgba8888)]
public void WriteableBitmapShouldBeUsable(PixelFormat fmt) public void WriteableBitmapShouldBeUsable(PixelFormat fmt)
{ {
#pragma warning disable CS0618 // Type or member is obsolete
var writeableBitmap = new WriteableBitmap(new PixelSize(256, 256), new Vector(96, 96), fmt); var writeableBitmap = new WriteableBitmap(new PixelSize(256, 256), new Vector(96, 96), fmt);
#pragma warning restore CS0618 // Type or member is obsolete
var data = new int[256 * 256]; var data = new int[256 * 256];
for (int y = 0; y < 256; y++) for (int y = 0; y < 256; y++)

12
tests/Avalonia.Styling.UnitTests/ResourceDictionaryTests.cs

@ -108,7 +108,7 @@ namespace Avalonia.Styling.UnitTests
var target = new ResourceDictionary { { "foo", "bar" } }; var target = new ResourceDictionary { { "foo", "bar" } };
((IResourceProvider)target).AddOwner(host.Object); ((IResourceProvider)target).AddOwner(host.Object);
host.ResetCalls(); host.Invocations.Clear();
((IResourceProvider)target).RemoveOwner(host.Object); ((IResourceProvider)target).RemoveOwner(host.Object);
host.Verify(x => x.NotifyHostedResourcesChanged(It.IsAny<ResourcesChangedEventArgs>())); host.Verify(x => x.NotifyHostedResourcesChanged(It.IsAny<ResourcesChangedEventArgs>()));
@ -120,7 +120,7 @@ namespace Avalonia.Styling.UnitTests
var host = new Mock<IResourceHost>(); var host = new Mock<IResourceHost>();
var target = new ResourceDictionary(host.Object); var target = new ResourceDictionary(host.Object);
host.ResetCalls(); host.Invocations.Clear();
target.Add("foo", "bar"); target.Add("foo", "bar");
host.Verify(x => x.NotifyHostedResourcesChanged(It.IsAny<ResourcesChangedEventArgs>())); host.Verify(x => x.NotifyHostedResourcesChanged(It.IsAny<ResourcesChangedEventArgs>()));
@ -132,7 +132,7 @@ namespace Avalonia.Styling.UnitTests
var host = new Mock<IResourceHost>(); var host = new Mock<IResourceHost>();
var target = new ResourceDictionary(host.Object); var target = new ResourceDictionary(host.Object);
host.ResetCalls(); host.Invocations.Clear();
target.MergedDictionaries.Add(new ResourceDictionary target.MergedDictionaries.Add(new ResourceDictionary
{ {
{ "foo", "bar" }, { "foo", "bar" },
@ -149,7 +149,7 @@ namespace Avalonia.Styling.UnitTests
var host = new Mock<IResourceHost>(); var host = new Mock<IResourceHost>();
var target = new ResourceDictionary(host.Object); var target = new ResourceDictionary(host.Object);
host.ResetCalls(); host.Invocations.Clear();
target.MergedDictionaries.Add(new ResourceDictionary()); target.MergedDictionaries.Add(new ResourceDictionary());
host.Verify( host.Verify(
@ -169,7 +169,7 @@ namespace Avalonia.Styling.UnitTests
} }
}; };
host.ResetCalls(); host.Invocations.Clear();
target.MergedDictionaries.RemoveAt(0); target.MergedDictionaries.RemoveAt(0);
host.Verify( host.Verify(
@ -189,7 +189,7 @@ namespace Avalonia.Styling.UnitTests
} }
}; };
host.ResetCalls(); host.Invocations.Clear();
((IResourceDictionary)target.MergedDictionaries[0]).Add("foo", "bar"); ((IResourceDictionary)target.MergedDictionaries[0]).Add("foo", "bar");
host.Verify( host.Verify(

75
tests/Avalonia.Styling.UnitTests/SelectorTests_Child.cs

@ -1,12 +1,7 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Collections;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.LogicalTree; using Avalonia.LogicalTree;
using Xunit; using Xunit;
@ -85,76 +80,6 @@ namespace Avalonia.Styling.UnitTests
get => Parent; get => Parent;
set => ((ISetLogicalParent)this).SetParent(value); set => ((ISetLogicalParent)this).SetParent(value);
} }
public void ClearValue(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public void ClearValue<T>(AvaloniaProperty<T> property)
{
throw new NotImplementedException();
}
public void AddInheritanceChild(IAvaloniaObject child)
{
throw new NotImplementedException();
}
public void RemoveInheritanceChild(IAvaloniaObject child)
{
throw new NotImplementedException();
}
public void InheritanceParentChanged<T>(StyledPropertyBase<T> property, IAvaloniaObject oldParent, IAvaloniaObject newParent)
{
throw new NotImplementedException();
}
public void InheritedPropertyChanged<T>(AvaloniaProperty<T> property, Optional<T> oldValue, Optional<T> newValue)
{
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 public class TestLogical1 : TestLogical

74
tests/Avalonia.Styling.UnitTests/SelectorTests_Descendent.cs

@ -1,11 +1,7 @@
using System;
using System.Linq; using System.Linq;
using System.Reactive;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Collections;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Data;
using Avalonia.LogicalTree; using Avalonia.LogicalTree;
using Xunit; using Xunit;
@ -115,76 +111,6 @@ namespace Avalonia.Styling.UnitTests
get => Parent; get => Parent;
set => ((ISetLogicalParent)this).SetParent(value); set => ((ISetLogicalParent)this).SetParent(value);
} }
public void ClearValue(AvaloniaProperty property)
{
throw new NotImplementedException();
}
public void ClearValue<T>(AvaloniaProperty<T> property)
{
throw new NotImplementedException();
}
public void AddInheritanceChild(IAvaloniaObject child)
{
throw new NotImplementedException();
}
public void RemoveInheritanceChild(IAvaloniaObject child)
{
throw new NotImplementedException();
}
public void InheritanceParentChanged<T>(StyledPropertyBase<T> property, IAvaloniaObject oldParent, IAvaloniaObject newParent)
{
throw new NotImplementedException();
}
public void InheritedPropertyChanged<T>(AvaloniaProperty<T> property, Optional<T> oldValue, Optional<T> newValue)
{
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 public class TestLogical1 : TestLogical

2
tests/Avalonia.Styling.UnitTests/StyleTests.cs

@ -443,7 +443,7 @@ namespace Avalonia.Styling.UnitTests
var resources = new Mock<IResourceDictionary>(); var resources = new Mock<IResourceDictionary>();
target.Resources = resources.Object; target.Resources = resources.Object;
host.ResetCalls(); host.Invocations.Clear();
((IResourceProvider)target).AddOwner(host.Object); ((IResourceProvider)target).AddOwner(host.Object);
resources.Verify(x => x.AddOwner(host.Object), Times.Once); resources.Verify(x => x.AddOwner(host.Object), Times.Once);
} }

8
tests/Avalonia.Styling.UnitTests/StylesTests.cs

@ -15,7 +15,7 @@ namespace Avalonia.Styling.UnitTests
var style = new Mock<IStyle>(); var style = new Mock<IStyle>();
var rp = style.As<IResourceProvider>(); var rp = style.As<IResourceProvider>();
host.ResetCalls(); host.Invocations.Clear();
target.Add(style.Object); target.Add(style.Object);
rp.Verify(x => x.AddOwner(host.Object)); rp.Verify(x => x.AddOwner(host.Object));
@ -29,7 +29,7 @@ namespace Avalonia.Styling.UnitTests
var style = new Mock<IStyle>(); var style = new Mock<IStyle>();
var rp = style.As<IResourceProvider>(); var rp = style.As<IResourceProvider>();
host.ResetCalls(); host.Invocations.Clear();
target.Add(style.Object); target.Add(style.Object);
target.Remove(style.Object); target.Remove(style.Object);
@ -58,7 +58,7 @@ namespace Avalonia.Styling.UnitTests
var resources = new Mock<IResourceDictionary>(); var resources = new Mock<IResourceDictionary>();
target.Resources = resources.Object; target.Resources = resources.Object;
host.ResetCalls(); host.Invocations.Clear();
((IResourceProvider)target).AddOwner(host.Object); ((IResourceProvider)target).AddOwner(host.Object);
resources.Verify(x => x.AddOwner(host.Object), Times.Once); resources.Verify(x => x.AddOwner(host.Object), Times.Once);
} }
@ -87,7 +87,7 @@ namespace Avalonia.Styling.UnitTests
var resourceProvider = style.As<IResourceProvider>(); var resourceProvider = style.As<IResourceProvider>();
target.Add(style.Object); target.Add(style.Object);
host.ResetCalls(); host.Invocations.Clear();
((IResourceProvider)target).AddOwner(host.Object); ((IResourceProvider)target).AddOwner(host.Object);
resourceProvider.Verify(x => x.AddOwner(host.Object), Times.Once); resourceProvider.Verify(x => x.AddOwner(host.Object), Times.Once);
} }

2
tests/Avalonia.Visuals.UnitTests/Rendering/DeferredRendererTests.cs

@ -756,7 +756,7 @@ namespace Avalonia.Visuals.UnitTests.Rendering
private void IgnoreFirstFrame(IRenderLoopTask task, Mock<ISceneBuilder> sceneBuilder) private void IgnoreFirstFrame(IRenderLoopTask task, Mock<ISceneBuilder> sceneBuilder)
{ {
RunFrame(task); RunFrame(task);
sceneBuilder.ResetCalls(); sceneBuilder.Invocations.Clear();
} }
private void RunFrame(IRenderLoopTask task) private void RunFrame(IRenderLoopTask task)

2
tests/Avalonia.Visuals.UnitTests/VisualTests.cs

@ -173,7 +173,7 @@ namespace Avalonia.Visuals.UnitTests
}; };
root.Child = child; root.Child = child;
renderer.ResetCalls(); renderer.Invocations.Clear();
root.Child = null; root.Child = null;
renderer.Verify(x => x.AddDirty(child)); renderer.Verify(x => x.AddDirty(child));

Loading…
Cancel
Save