DependencyInjectionSpecificationTests Class¶
- Namespace
Microsoft.Extensions.DependencyInjection.Specification- Assemblies
- Microsoft.Extensions.DependencyInjection.Specification.Tests
Syntax¶
public abstract class DependencyInjectionSpecificationTests
-
class
Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests
Methods¶
-
AttemptingToResolveNonexistentServiceReturnsNull()¶ [Fact] public void AttemptingToResolveNonexistentServiceReturnsNull()
-
ClosedServicesPreferredOverOpenGenericServices()¶ [Fact] public void ClosedServicesPreferredOverOpenGenericServices()
-
CreateServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)¶ Return type: System.IServiceProvider protected abstract IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)
-
DisposingScopeDisposesService()¶ [Fact] public void DisposingScopeDisposesService()
-
FactoryServicesAreCreatedAsPartOfCreatingObjectGraph()¶ [Fact] public void FactoryServicesAreCreatedAsPartOfCreatingObjectGraph()
-
FactoryServicesCanBeCreatedByGetService()¶ [Fact] public void FactoryServicesCanBeCreatedByGetService()
-
GetServiceOrCreateInstanceRegisteredServiceSingleton()¶ [Fact] public void GetServiceOrCreateInstanceRegisteredServiceSingleton()
-
GetServiceOrCreateInstanceRegisteredServiceTransient()¶ [Fact] public void GetServiceOrCreateInstanceRegisteredServiceTransient()
-
GetServiceOrCreateInstanceUnregisteredService()¶ [Fact] public void GetServiceOrCreateInstanceUnregisteredService()
-
LastServiceReplacesPreviousServices()¶ [Fact] public void LastServiceReplacesPreviousServices()
-
MultipleServiceCanBeIEnumerableResolved()¶ [Fact] public void MultipleServiceCanBeIEnumerableResolved()
-
NestedScopedServiceCanBeResolved()¶ [Fact] public void NestedScopedServiceCanBeResolved()
-
NestedScopedServiceCanBeResolvedWithNoFallbackProvider()¶ [Fact] public void NestedScopedServiceCanBeResolvedWithNoFallbackProvider()
-
NonexistentServiceCanBeIEnumerableResolved()¶ [Fact] public void NonexistentServiceCanBeIEnumerableResolved()
-
OpenGenericServicesCanBeResolved()¶ [Fact] public void OpenGenericServicesCanBeResolved()
-
OuterServiceCanHaveOtherServicesInjected()¶ [Fact] public void OuterServiceCanHaveOtherServicesInjected()
-
RegistrationOrderIsPreservedWhenServicesAreIEnumerableResolved()¶ [Fact] public void RegistrationOrderIsPreservedWhenServicesAreIEnumerableResolved()
-
SafelyDisposeNestedProviderReferences()¶ [Fact] public void SafelyDisposeNestedProviderReferences()
-
ScopedServiceCanBeResolved()¶ [Fact] public void ScopedServiceCanBeResolved()
-
ScopedServices_FromCachedScopeFactory_CanBeResolvedAndDisposed()¶ [Fact] public void ScopedServices_FromCachedScopeFactory_CanBeResolvedAndDisposed()
-
SelfResolveThenDispose()¶ [Fact] public void SelfResolveThenDispose()
-
ServiceContainerPicksConstructorWithLongestMatches(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.Extensions.DependencyInjection.Specification.Fakes.TypeWithSupersetConstructors)¶ [Theory] [MemberData("ServiceContainerPicksConstructorWithLongestMatchesData", new object[]{})] public void ServiceContainerPicksConstructorWithLongestMatches(IServiceCollection serviceCollection, TypeWithSupersetConstructors expected)
-
ServiceInstanceCanBeResolved()¶ [Fact] public void ServiceInstanceCanBeResolved()
-
ServiceProviderRegistersServiceScopeFactory()¶ [Fact] public void ServiceProviderRegistersServiceScopeFactory()
-
ServicesRegisteredWithImplementationTypeCanBeResolved()¶ [Fact] public void ServicesRegisteredWithImplementationTypeCanBeResolved()
-
ServicesRegisteredWithImplementationType_ReturnDifferentInstancesPerResolution_ForTransientServices()¶ [Fact] public void ServicesRegisteredWithImplementationType_ReturnDifferentInstancesPerResolution_ForTransientServices()
-
ServicesRegisteredWithImplementationType_ReturnSameInstancesPerResolution_ForSingletons()¶ [Fact] public void ServicesRegisteredWithImplementationType_ReturnSameInstancesPerResolution_ForSingletons()
-
SingleServiceCanBeIEnumerableResolved()¶ [Fact] public void SingleServiceCanBeIEnumerableResolved()
-
SingletonServiceCanBeResolved()¶ [Fact] public void SingletonServiceCanBeResolved()
-
SingletonServicesComeFromRootProvider()¶ [Fact] public void SingletonServicesComeFromRootProvider()
-
TransientServiceCanBeResolvedFromProvider()¶ [Fact] public void TransientServiceCanBeResolvedFromProvider()
-
TransientServiceCanBeResolvedFromScope()¶ [Fact] public void TransientServiceCanBeResolvedFromScope()
-
TypeActivatorAcceptsAnyNumberOfAdditionalConstructorParametersToProvide(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorAcceptsAnyNumberOfAdditionalConstructorParametersToProvide(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
TypeActivatorCanDisambiguateConstructorsWithUniqueArguments(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorCanDisambiguateConstructorsWithUniqueArguments(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
TypeActivatorCreateFactoryDoesNotAllowForAmbiguousConstructorMatches(System.Type)¶ [Theory] [InlineData(new object[]{typeof (string)})] [InlineData(new object[]{typeof (int)})] public void TypeActivatorCreateFactoryDoesNotAllowForAmbiguousConstructorMatches(Type paramType)
-
TypeActivatorEnablesYouToCreateAnyTypeWithServicesEvenWhenNotInIocContainer(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorEnablesYouToCreateAnyTypeWithServicesEvenWhenNotInIocContainer(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
TypeActivatorRequiresAllArgumentsCanBeAccepted(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorRequiresAllArgumentsCanBeAccepted(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
TypeActivatorRequiresPublicConstructor(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc, System.Type)¶ [Theory] [MemberData("TypesWithNonPublicConstructorData", new object[]{})] public void TypeActivatorRequiresPublicConstructor(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc, Type type)
-
TypeActivatorRethrowsOriginalExceptionFromConstructor(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorRethrowsOriginalExceptionFromConstructor(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
TypeActivatorWorksWithCtorWithOptionalArgs(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorWorksWithCtorWithOptionalArgs(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
TypeActivatorWorksWithStaticCtor(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void TypeActivatorWorksWithStaticCtor(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
UnRegisteredServiceAsConstructorParameterThrowsException(Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFunc)¶ [Theory] [MemberData("CreateInstanceFuncs", new object[]{})] public void UnRegisteredServiceAsConstructorParameterThrowsException(DependencyInjectionSpecificationTests.CreateInstanceFunc createFunc)
-
Properties¶
-
Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.CreateInstanceFuncs¶ Return type: System.Collections.Generic.IEnumerable<System.Object<System.Object>[]> public static IEnumerable<object[]> CreateInstanceFuncs { get; }
-
Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.ServiceContainerPicksConstructorWithLongestMatchesData¶ Return type: Xunit.TheoryData public static TheoryData ServiceContainerPicksConstructorWithLongestMatchesData { get; }
-
Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests.TypesWithNonPublicConstructorData¶ Return type: System.Collections.Generic.IEnumerable<System.Object<System.Object>[]> public static IEnumerable<object[]> TypesWithNonPublicConstructorData { get; }
-