Skip to content

Commit 20ceda7

Browse files
committed
Added the keyed service specification tests to the compliance test project
- This is currently failing 45 out of the 54 keyed service specification tests
1 parent 85902e7 commit 20ceda7

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
using Microsoft.Extensions.DependencyInjection;
22
using System;
33

4-
namespace Ninject.Web.AspNetCore.ComplianceTests
4+
namespace Ninject.Web.AspNetCore.ComplianceTest;
5+
6+
/// <summary>
7+
/// See https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src - the dotnet/runtime
8+
/// project which contains the dependency injection library code also contains a set of "compliance tests" that can be run against a potential alternative
9+
/// implementation to check if it is compliant. This class here is doing just that.
10+
///
11+
/// The project also contains a separate test project that includes these compliance tests for a set of compliant third party DI implementations like
12+
/// Autofac and Lightinject under https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.External.Tests.
13+
///
14+
/// All of this is part of the https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.DependencyInjection/Microsoft.Extensions.DependencyInjection.sln
15+
/// solution of dotnet/runtime.
16+
/// </summary>
17+
public class DependencyInjectionComplianceTests : Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests
518
{
6-
/// <summary>
7-
/// See https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src - the dotnet/runtime
8-
/// project which contains the dependency injection library code also contains a set of "compliance tests" that can be run against a potential alternative
9-
/// implementation to check if it is compliant. This class here is doing just that.
10-
///
11-
/// The project also contains a separate test project that includes these compliance tests for a set of compliant third party DI implementations like
12-
/// Autofac and Lightinject under https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.External.Tests.
13-
///
14-
/// All of this is part of the https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.DependencyInjection/Microsoft.Extensions.DependencyInjection.sln
15-
/// solution of dotnet/runtime.
16-
/// </summary>
17-
public class DependencyInjectionComplianceTests : Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests
19+
protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)
1820
{
19-
protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)
20-
{
21-
var kernel = new AspNetCoreKernel();
22-
var factory = new NinjectServiceProviderFactory(kernel);
21+
var kernel = new AspNetCoreKernel();
22+
var factory = new NinjectServiceProviderFactory(kernel);
2323

24-
return factory.CreateBuilder(serviceCollection).Build();
25-
}
24+
return factory.CreateBuilder(serviceCollection).Build();
2625
}
2726
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using Microsoft.Extensions.DependencyInjection;
3+
4+
namespace Ninject.Web.AspNetCore.ComplianceTest;
5+
6+
/// <summary>
7+
/// See https://github.com/dotnet/runtime/tree/main/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src - the dotnet/runtime
8+
/// project which contains the dependency injection library code also contains a set of "compliance tests" that can be run against a potential alternative
9+
/// implementation to check if it is compliant. This class is running the dedicated specification tests for KEYED services.
10+
/// </summary>
11+
public class KeyedDependencyInjectionComplianceTests : Microsoft.Extensions.DependencyInjection.Specification.KeyedDependencyInjectionSpecificationTests
12+
{
13+
protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)
14+
{
15+
var kernel = new AspNetCoreKernel();
16+
var factory = new NinjectServiceProviderFactory(kernel);
17+
18+
return factory.CreateBuilder(serviceCollection).Build();
19+
}
20+
}

0 commit comments

Comments
 (0)