// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using Moq; using Perspex.Controls.UnitTests; using Perspex.Layout; using Perspex.Platform; using Perspex.Shared.PlatformSupport; using Perspex.Themes.Default; using Ploeh.AutoFixture; using Ploeh.AutoFixture.AutoMoq; namespace Perspex.LeakTests { internal class TestApp : Application { private TestApp() { RegisterServices(); var fixture = new Fixture().Customize(new AutoMoqCustomization()); var windowImpl = new Mock(); var renderInterface = fixture.Create(); var threadingInterface = Mock.Of(x => x.CurrentThreadIsLoopThread == true); PerspexLocator.CurrentMutable .Bind().ToConstant(new AssetLoader()) .Bind().ToConstant(new LayoutManager()) .Bind().ToConstant(new PclPlatformWrapper()) .Bind().ToConstant(renderInterface) .Bind().ToConstant(threadingInterface) .Bind().ToConstant(new Mock().Object) .Bind().ToConstant(new WindowingPlatformMock(() => windowImpl.Object)); Styles = new DefaultTheme(); } public static void Initialize() { if (Current == null) { new TestApp(); } } } }