A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.7 KiB

// 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();
}
}
}
}