Browse Source

Fix for tests

pull/332/head
Nikita Tsukanov 10 years ago
parent
commit
3c78704f55
  1. 1
      tests/Perspex.Controls.UnitTests/Perspex.Controls.UnitTests.csproj
  2. 2
      tests/Perspex.Controls.UnitTests/Primitives/PopupTests.cs
  3. 21
      tests/Perspex.Controls.UnitTests/Primitives/WindowingPlatformMock.cs
  4. 4
      tests/Perspex.Controls.UnitTests/Utils/HotKeyManagerTests.cs

1
tests/Perspex.Controls.UnitTests/Perspex.Controls.UnitTests.csproj

@ -88,6 +88,7 @@
<Compile Include="BorderTests.cs" /> <Compile Include="BorderTests.cs" />
<Compile Include="ListBoxTests_Single.cs" /> <Compile Include="ListBoxTests_Single.cs" />
<Compile Include="Primitives\SelectingItemsControlTests_Multiple.cs" /> <Compile Include="Primitives\SelectingItemsControlTests_Multiple.cs" />
<Compile Include="Primitives\WindowingPlatformMock.cs" />
<Compile Include="TreeViewTests.cs" /> <Compile Include="TreeViewTests.cs" />
<Compile Include="Mixins\SelectableMixinTests.cs" /> <Compile Include="Mixins\SelectableMixinTests.cs" />
<Compile Include="StackPanelTests.cs" /> <Compile Include="StackPanelTests.cs" />

2
tests/Perspex.Controls.UnitTests/Primitives/PopupTests.cs

@ -267,7 +267,7 @@ namespace Perspex.Controls.UnitTests.Primitives
PerspexLocator.CurrentMutable PerspexLocator.CurrentMutable
.Bind<ILayoutManager>().ToTransient<LayoutManager>() .Bind<ILayoutManager>().ToTransient<LayoutManager>()
.Bind<IGlobalStyles>().ToFunc(() => globalStyles.Object) .Bind<IGlobalStyles>().ToFunc(() => globalStyles.Object)
.Bind<IPopupImpl>().ToConstant(new Mock<IPopupImpl>().Object) .Bind<IWindowingPlatform>().ToConstant(new WindowingPlatformMock())
.Bind<IStyler>().ToTransient<Styler>(); .Bind<IStyler>().ToTransient<Styler>();
return result; return result;

21
tests/Perspex.Controls.UnitTests/Primitives/WindowingPlatformMock.cs

@ -0,0 +1,21 @@
using System;
using Moq;
using Perspex.Platform;
namespace Perspex.Controls.UnitTests.Primitives
{
class WindowingPlatformMock : IWindowingPlatform
{
public IWindowImpl CreateWindow()
{
return new Mock<IWindowImpl>().Object;
}
public IWindowImpl CreateDesignerFriendlyWindow()
{
throw new NotImplementedException();
}
public IPopupImpl CreatePopup() => new Mock<IPopupImpl>().Object;
}
}

4
tests/Perspex.Controls.UnitTests/Utils/HotKeyManagerTests.cs

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Moq; using Moq;
using Perspex.Controls.Presenters; using Perspex.Controls.Presenters;
using Perspex.Controls.Templates; using Perspex.Controls.Templates;
using Perspex.Controls.UnitTests.Primitives;
using Perspex.Input; using Perspex.Input;
using Perspex.Platform; using Perspex.Platform;
using Perspex.Styling; using Perspex.Styling;
@ -20,11 +21,10 @@ namespace Perspex.Controls.UnitTests.Utils
{ {
using (PerspexLocator.EnterScope()) using (PerspexLocator.EnterScope())
{ {
var windowImpl = new Mock<IWindowImpl>();
var styler = new Mock<Styler>(); var styler = new Mock<Styler>();
PerspexLocator.CurrentMutable PerspexLocator.CurrentMutable
.Bind<IWindowImpl>().ToConstant(windowImpl.Object) .Bind<IWindowingPlatform>().ToConstant(new WindowingPlatformMock())
.Bind<IStyler>().ToConstant(styler.Object); .Bind<IStyler>().ToConstant(styler.Object);
var gesture1 = new KeyGesture {Key = Key.A, Modifiers = InputModifiers.Control}; var gesture1 = new KeyGesture {Key = Key.A, Modifiers = InputModifiers.Control};

Loading…
Cancel
Save