From d7703d619ca96f29b1f6284b205b00c79fe20c89 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Sun, 12 Mar 2017 00:53:24 +0100 Subject: [PATCH] Fixed failing test. And removed `TestServices.WindowImpl` as it was being ignored. --- tests/Avalonia.Controls.UnitTests/WindowTests.cs | 9 +++++---- tests/Avalonia.UnitTests/TestServices.cs | 4 ---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/Avalonia.Controls.UnitTests/WindowTests.cs b/tests/Avalonia.Controls.UnitTests/WindowTests.cs index ad88cf518c..7b5e3197df 100644 --- a/tests/Avalonia.Controls.UnitTests/WindowTests.cs +++ b/tests/Avalonia.Controls.UnitTests/WindowTests.cs @@ -5,6 +5,7 @@ // ----------------------------------------------------------------------- using Avalonia.Platform; +using Avalonia.UnitTests; using Moq; using Xunit; @@ -15,11 +16,11 @@ namespace Avalonia.Controls.UnitTests [Fact] public void Setting_Title_Should_Set_Impl_Title() { - using (AvaloniaLocator.EnterScope()) - { - var windowImpl = new Mock(); - AvaloniaLocator.CurrentMutable.Bind().ToConstant(windowImpl.Object); + var windowImpl = new Mock(); + var windowingPlatform = new MockWindowingPlatform(() => windowImpl.Object); + using (UnitTestApplication.Start(new TestServices(windowingPlatform: windowingPlatform))) + { var target = new Window(); target.Title = "Hello World"; diff --git a/tests/Avalonia.UnitTests/TestServices.cs b/tests/Avalonia.UnitTests/TestServices.cs index 8dc838163f..a5d9fb6d2f 100644 --- a/tests/Avalonia.UnitTests/TestServices.cs +++ b/tests/Avalonia.UnitTests/TestServices.cs @@ -67,7 +67,6 @@ namespace Avalonia.UnitTests IStyler styler = null, Func theme = null, IPlatformThreadingInterface threadingInterface = null, - IWindowImpl windowImpl = null, IWindowingPlatform windowingPlatform = null) { AssetLoader = assetLoader; @@ -83,7 +82,6 @@ namespace Avalonia.UnitTests Styler = styler; Theme = theme; ThreadingInterface = threadingInterface; - WindowImpl = windowImpl; WindowingPlatform = windowingPlatform; } @@ -100,7 +98,6 @@ namespace Avalonia.UnitTests public IStyler Styler { get; } public Func Theme { get; } public IPlatformThreadingInterface ThreadingInterface { get; } - public IWindowImpl WindowImpl { get; } public IWindowingPlatform WindowingPlatform { get; } public TestServices With( @@ -134,7 +131,6 @@ namespace Avalonia.UnitTests styler: styler ?? Styler, theme: theme ?? Theme, threadingInterface: threadingInterface ?? ThreadingInterface, - windowImpl: windowImpl ?? WindowImpl, windowingPlatform: windowingPlatform ?? WindowingPlatform); }