|
|
|
@ -73,7 +73,7 @@ namespace Microsoft.Extensions.DependencyInjection |
|
|
|
//Assert
|
|
|
|
_services.ShouldContain(typeof(IMyService1), typeof(MyServiceWithExposeList), ServiceLifetime.Transient); |
|
|
|
_services.ShouldContain(typeof(IMyService2), typeof(MyServiceWithExposeList), ServiceLifetime.Transient); |
|
|
|
_services.ShouldNotContain(typeof(MyServiceWithExposeList)); |
|
|
|
_services.ShouldNotContainService(typeof(MyServiceWithExposeList)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
@ -130,6 +130,15 @@ namespace Microsoft.Extensions.DependencyInjection |
|
|
|
instances[0].ShouldBeOfType(typeof(FirstImplOfMyService)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Should_Not_Register_Classes_Marked_With_DisableConventionalRegistration() |
|
|
|
{ |
|
|
|
_services.AddType(typeof(NonConventionalImplOfMyService)); |
|
|
|
|
|
|
|
_services.ShouldNotContainService(typeof(IMyService)); |
|
|
|
_services.ShouldNotContainService(typeof(NonConventionalImplOfMyService)); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void AddObjectAccessor_Test() |
|
|
|
{ |
|
|
|
@ -213,6 +222,12 @@ namespace Microsoft.Extensions.DependencyInjection |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
[DisableConventionalRegistration] |
|
|
|
public class NonConventionalImplOfMyService : IMyService |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public class MyEmptyClass |
|
|
|
{ |
|
|
|
|
|
|
|
|