Reduce dependencies (#401)
This commit is contained in:
Родитель
74476cee7e
Коммит
1c9943570d
|
@ -1,51 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using Castle.MicroKernel;
|
||||
using Castle.MicroKernel.Registration;
|
||||
using Castle.MicroKernel.Resolvers.SpecializedResolvers;
|
||||
using Castle.Windsor;
|
||||
using Microsoft.Owin.Hosting.Loader;
|
||||
using Microsoft.Owin.Hosting.Services;
|
||||
|
||||
namespace Microsoft.Owin.Hosting.Tests.Containers
|
||||
{
|
||||
public class CastleWindsorContainerTests : ContainerTestsBase
|
||||
{
|
||||
public override Func<Type, object> CreateContainer()
|
||||
{
|
||||
var container = new WindsorContainer();
|
||||
|
||||
container.Kernel.Resolver.AddSubResolver(
|
||||
new CollectionResolver(container.Kernel, true));
|
||||
|
||||
container.Register(
|
||||
Component.For<IServiceProvider>().ImplementedBy<WindsorServiceProvider>());
|
||||
|
||||
ServicesFactory.ForEach((service, implementation) =>
|
||||
container.Register(Component.For(service).ImplementedBy(implementation)));
|
||||
|
||||
container.Register(
|
||||
Component.For<IAppLoaderFactory>().ImplementedBy<TestAppLoader1>(),
|
||||
Component.For<IAppLoaderFactory>().ImplementedBy<TestAppLoader2>());
|
||||
|
||||
return container.Resolve;
|
||||
}
|
||||
|
||||
public class WindsorServiceProvider : IServiceProvider
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
|
||||
public WindsorServiceProvider(IKernel kernel)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
return _kernel.Resolve(serviceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Owin.Hosting.Loader;
|
||||
using Microsoft.Owin.Hosting.Services;
|
||||
using Ninject;
|
||||
|
||||
namespace Microsoft.Owin.Hosting.Tests.Containers
|
||||
{
|
||||
public class NinjectContainerTests : ContainerTestsBase
|
||||
{
|
||||
public override Func<Type, object> CreateContainer()
|
||||
{
|
||||
var kernel = new StandardKernel();
|
||||
kernel.Bind<IServiceProvider>().To<NinjectServiceProvider>();
|
||||
ServicesFactory.ForEach((service, implementation) => kernel.Bind(service).To(implementation));
|
||||
kernel.Bind<IAppLoaderFactory>().To<TestAppLoader1>();
|
||||
kernel.Bind<IAppLoaderFactory>().To<TestAppLoader2>();
|
||||
return serviceType => kernel.Get(serviceType);
|
||||
}
|
||||
|
||||
public class NinjectServiceProvider : IServiceProvider
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
|
||||
public NinjectServiceProvider(IKernel kernel)
|
||||
{
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
return _kernel.Get(serviceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -50,14 +50,6 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Castle.Core.3.2.2\lib\net45\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Windsor, Version=3.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Castle.Windsor.3.2.1\lib\net45\Castle.Windsor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Ninject.3.0.1.10\lib\net45-full\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
|
@ -93,14 +85,12 @@
|
|||
<Compile Include="ServerFactories\StaticServerFactory.cs" />
|
||||
<Compile Include="ServerFactories\InstanceServerFactory.cs" />
|
||||
<Compile Include="Containers\AutofacContainerTests.cs" />
|
||||
<Compile Include="Containers\CastleWindsorContainerTests.cs" />
|
||||
<Compile Include="Containers\ContainerTestsBase.cs" />
|
||||
<Compile Include="Containers\DefaultServicesTests.cs" />
|
||||
<Compile Include="Containers\ReplaceDefaultServiceWithTextFileTests.cs" />
|
||||
<Compile Include="ServerFactoryLoaderTests.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="HostingEngineTests.cs" />
|
||||
<Compile Include="Containers\NinjectContainerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ServerFactories\OwinServerFactory.cs" />
|
||||
<Compile Include="ServerFactoryAdapterTests.cs" />
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
<packages>
|
||||
<package id="Autofac" version="3.3.0" targetFramework="net45" />
|
||||
<package id="Castle.Core" version="3.2.2" targetFramework="net45" />
|
||||
<package id="Castle.Windsor" version="3.2.1" targetFramework="net45" />
|
||||
<package id="Ninject" version="3.0.1.10" targetFramework="net45" />
|
||||
<package id="Owin" version="1.0" targetFramework="net45" />
|
||||
<package id="Shouldly" version="1.1.1.1" targetFramework="net45" />
|
||||
<package id="structuremap" version="2.6.4.1" targetFramework="net45" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче