| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- // 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<IWindowImpl>();
- var renderInterface = fixture.Create<IPlatformRenderInterface>();
- var threadingInterface = Mock.Of<IPlatformThreadingInterface>(x =>
- x.CurrentThreadIsLoopThread == true);
- PerspexLocator.CurrentMutable
- .Bind<IAssetLoader>().ToConstant(new AssetLoader())
- .Bind<ILayoutManager>().ToConstant(new LayoutManager())
- .Bind<IPclPlatformWrapper>().ToConstant(new PclPlatformWrapper())
- .Bind<IPlatformRenderInterface>().ToConstant(renderInterface)
- .Bind<IPlatformThreadingInterface>().ToConstant(threadingInterface)
- .Bind<IStandardCursorFactory>().ToConstant(new Mock<IStandardCursorFactory>().Object)
- .Bind<IWindowingPlatform>().ToConstant(new WindowingPlatformMock(() => windowImpl.Object));
- Styles = new DefaultTheme();
- }
- public static void Initialize()
- {
- if (Current == null)
- {
- new TestApp();
- }
- }
- }
- }
|