|
|
|
@ -4,11 +4,20 @@ using Perspex.Platform; |
|
|
|
|
|
|
|
namespace Perspex.Controls.UnitTests.Primitives |
|
|
|
{ |
|
|
|
class WindowingPlatformMock : IWindowingPlatform |
|
|
|
public class WindowingPlatformMock : IWindowingPlatform |
|
|
|
{ |
|
|
|
private readonly Func<IWindowImpl> _windowImpl; |
|
|
|
private readonly Func<IPopupImpl> _popupImpl; |
|
|
|
|
|
|
|
public WindowingPlatformMock(Func<IWindowImpl> windowImpl = null, Func<IPopupImpl> popupImpl = null ) |
|
|
|
{ |
|
|
|
_windowImpl = windowImpl; |
|
|
|
_popupImpl = popupImpl; |
|
|
|
} |
|
|
|
|
|
|
|
public IWindowImpl CreateWindow() |
|
|
|
{ |
|
|
|
return new Mock<IWindowImpl>().Object; |
|
|
|
return _windowImpl?.Invoke() ?? new Mock<IWindowImpl>().Object; |
|
|
|
} |
|
|
|
|
|
|
|
public IWindowImpl CreateDesignerFriendlyWindow() |
|
|
|
@ -16,6 +25,6 @@ namespace Perspex.Controls.UnitTests.Primitives |
|
|
|
throw new NotImplementedException(); |
|
|
|
} |
|
|
|
|
|
|
|
public IPopupImpl CreatePopup() => new Mock<IPopupImpl>().Object; |
|
|
|
public IPopupImpl CreatePopup() => _popupImpl?.Invoke() ?? new Mock<IPopupImpl>().Object; |
|
|
|
} |
|
|
|
} |