From 8d14b0cd6999cb05f25d11c8d97ea6bfd9a85a95 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 2 Nov 2018 00:22:14 -0700 Subject: [PATCH 01/16] Reorganize source code in preparation to move into aspnet/Extensions Prior to reorganization, this source code was found in https://github.com/aspnet/DependencyInjection/tree/7a283947c231b6585c8ac95e653950b660f3da96 Commit migrated from https://github.com/dotnet/Extensions/commit/689c4a891cc0783d6c7ed1f9bab1e9854981e65b --- .../ActivatorUtilitiesTests.cs | 394 +++++ .../DependencyInjectionSpecificationTests.cs | 746 ++++++++ .../Fakes/AnotherClass.cs | 15 + .../Fakes/AnotherClassAcceptingData.cs | 21 + .../Fakes/ClassWithAmbiguousCtors.cs | 39 + .../ClassWithAmbiguousCtorsAndAttribute.cs | 26 + .../Fakes/ClassWithInternalConstructor.cs | 12 + .../Fakes/ClassWithMultipleMarkedCtors.cs | 18 + .../ClassWithNestedReferencesToProvider.cs | 34 + .../Fakes/ClassWithOptionalArgsCtor.cs | 15 + .../ClassWithOptionalArgsCtorWithStructs.cs | 27 + .../Fakes/ClassWithPrivateCtor.cs | 12 + .../Fakes/ClassWithProtectedConstructor.cs | 12 + .../Fakes/ClassWithStaticCtor.cs | 13 + .../Fakes/ClassWithThrowingCtor.cs | 15 + .../Fakes/ClassWithThrowingEmptyCtor.cs | 15 + .../Fakes/CreationCountFakeService.cs | 20 + .../FakeDisposableCallbackInnerService.cs | 12 + .../FakeDisposableCallbackOuterService.cs | 22 + .../Fakes/FakeDisposableCallbackService.cs | 30 + .../Fakes/FakeDisposeCallback.cs | 12 + .../Fakes/FakeOneMultipleService.cs | 9 + .../Fakes/FakeOpenGenericService.cs | 15 + .../Fakes/FakeOuterService.cs | 22 + .../Fakes/FakeService.cs | 24 + .../Fakes/FakeTwoMultipleService.cs | 9 + .../Fakes/IFactoryService.cs | 12 + .../Fakes/IFakeEveryService.cs | 15 + .../Fakes/IFakeMultipleService.cs | 9 + .../Fakes/IFakeOpenGenericService.cs | 10 + .../Fakes/IFakeOuterService.cs | 14 + .../Fakes/IFakeScopedService.cs | 9 + .../Fakes/IFakeService.cs | 9 + .../Fakes/IFakeServiceInstance.cs | 9 + .../Fakes/IFakeSingletonService.cs | 9 + .../Fakes/INonexistentService.cs | 9 + .../DI.Specification.Tests/Fakes/PocoClass.cs | 9 + .../Fakes/ScopedFactoryService.cs | 10 + .../Fakes/ServiceAcceptingFactoryService.cs | 20 + .../Fakes/TransientFactoryService.cs | 12 + .../Fakes/TypeWithSupersetConstructors.cs | 64 + ...ndencyInjection.Specification.Tests.csproj | 24 + .../ServiceCollection.cs | 11 + .../baseline.netcore.json | 1563 +++++++++++++++++ 44 files changed, 3407 insertions(+) create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs new file mode 100644 index 00000000000000..7a3ee944942173 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs @@ -0,0 +1,394 @@ +// 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 System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.DependencyInjection.Specification.Fakes; +using Xunit; + +namespace Microsoft.Extensions.DependencyInjection.Specification +{ + public abstract partial class DependencyInjectionSpecificationTests + { + public delegate object CreateInstanceFunc(IServiceProvider provider, Type type, object[] args); + + private static object CreateInstanceDirectly(IServiceProvider provider, Type type, object[] args) + { + return ActivatorUtilities.CreateInstance(provider, type, args); + } + + private static object CreateInstanceFromFactory(IServiceProvider provider, Type type, object[] args) + { + var factory = ActivatorUtilities.CreateFactory(type, args.Select(a => a.GetType()).ToArray()); + return factory(provider, args); + } + + private static T CreateInstance(CreateInstanceFunc func, IServiceProvider provider, params object[] args) + { + return (T)func(provider, typeof(T), args); + } + + public static IEnumerable CreateInstanceFuncs + { + get + { + yield return new[] { (CreateInstanceFunc)CreateInstanceDirectly }; + yield return new[] { (CreateInstanceFunc)CreateInstanceFromFactory }; + } + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorEnablesYouToCreateAnyTypeWithServicesEvenWhenNotInIocContainer(CreateInstanceFunc createFunc) + { + // Arrange + var serviceCollection = new TestServiceCollection() + .AddTransient(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + var anotherClass = CreateInstance(createFunc, serviceProvider); + + Assert.NotNull(anotherClass.FakeService); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorAcceptsAnyNumberOfAdditionalConstructorParametersToProvide(CreateInstanceFunc createFunc) + { + // Arrange + var serviceCollection = new TestServiceCollection() + .AddTransient(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + // Act + var anotherClass = CreateInstance(createFunc, serviceProvider, "1", "2"); + + // Assert + Assert.NotNull(anotherClass.FakeService); + Assert.Equal("1", anotherClass.One); + Assert.Equal("2", anotherClass.Two); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorWorksWithStaticCtor(CreateInstanceFunc createFunc) + { + // Act + var anotherClass = CreateInstance(createFunc, provider: null); + + // Assert + Assert.NotNull(anotherClass); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorWorksWithCtorWithOptionalArgs(CreateInstanceFunc createFunc) + { + // Arrange + var provider = new TestServiceCollection(); + var serviceProvider = CreateServiceProvider(provider); + + // Act + var anotherClass = CreateInstance(createFunc, serviceProvider); + + // Assert + Assert.NotNull(anotherClass); + Assert.Equal("BLARGH", anotherClass.Whatever); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorWorksWithCtorWithOptionalArgs_WithStructDefaults(CreateInstanceFunc createFunc) + { + // Arrange + var provider = new TestServiceCollection(); + var serviceProvider = CreateServiceProvider(provider); + + // Act + var anotherClass = CreateInstance(createFunc, serviceProvider); + + // Assert + Assert.NotNull(anotherClass); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorCanDisambiguateConstructorsWithUniqueArguments(CreateInstanceFunc createFunc) + { + // Arrange + var serviceCollection = new TestServiceCollection() + .AddTransient(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + // Act + var instance = CreateInstance(createFunc, serviceProvider, "1", 2); + + // Assert + Assert.NotNull(instance); + Assert.NotNull(instance.FakeService); + Assert.Equal("1", instance.Data1); + Assert.Equal(2, instance.Data2); + } + + public static IEnumerable TypesWithNonPublicConstructorData => + CreateInstanceFuncs.Zip( + new[] { typeof(ClassWithPrivateCtor), typeof(ClassWithInternalConstructor), typeof(ClassWithProtectedConstructor) }, + (a, b) => new object[] { a[0], b }); + + [Theory] + [MemberData(nameof(TypesWithNonPublicConstructorData))] + public void TypeActivatorRequiresPublicConstructor(CreateInstanceFunc createFunc, Type type) + { + // Arrange + var expectedMessage = $"A suitable constructor for type '{type}' could not be located. " + + "Ensure the type is concrete and services are registered for all parameters of a public constructor."; + + // Act and Assert + var ex = Assert.Throws(() => + createFunc(provider: null, type: type, args: new object[0])); + + Assert.Equal(expectedMessage, ex.Message); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorRequiresAllArgumentsCanBeAccepted(CreateInstanceFunc createFunc) + { + // Arrange + var expectedMessage = $"A suitable constructor for type '{typeof(AnotherClassAcceptingData).FullName}' could not be located. " + + "Ensure the type is concrete and services are registered for all parameters of a public constructor."; + var serviceCollection = new TestServiceCollection() + .AddTransient(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + var ex1 = Assert.Throws(() => + CreateInstance(createFunc, serviceProvider, "1", "2", "3")); + var ex2 = Assert.Throws(() => + CreateInstance(createFunc, serviceProvider, 1, 2)); + + Assert.Equal(expectedMessage, ex1.Message); + Assert.Equal(expectedMessage, ex2.Message); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorRethrowsOriginalExceptionFromConstructor(CreateInstanceFunc createFunc) + { + // Act + var ex1 = Assert.Throws(() => + CreateInstance(createFunc, provider: null)); + + var ex2 = Assert.Throws(() => + CreateInstance(createFunc, provider: null, args: new[] { new FakeService() })); + + // Assert + Assert.Equal(nameof(ClassWithThrowingEmptyCtor), ex1.Message); + Assert.Equal(nameof(ClassWithThrowingCtor), ex2.Message); + } + + [Theory] + [InlineData(typeof(string))] + [InlineData(typeof(int))] + public void TypeActivatorCreateFactoryDoesNotAllowForAmbiguousConstructorMatches(Type paramType) + { + // Arrange + var type = typeof(ClassWithAmbiguousCtors); + var expectedMessage = $"Multiple constructors accepting all given argument types have been found in type '{type}'. " + + "There should only be one applicable constructor."; + + // Act + var ex = Assert.Throws(() => + ActivatorUtilities.CreateFactory(type, new[] { paramType })); + + // Assert + Assert.Equal(expectedMessage, ex.Message); + } + + [Theory] + [InlineData("", "string")] + [InlineData(5, "IFakeService, int")] + public void TypeActivatorCreateInstanceUsesFirstMathchedConstructor(object value, string ctor) + { + // Arrange + var serviceCollection = new TestServiceCollection(); + serviceCollection.AddSingleton(); + var serviceProvider = CreateServiceProvider(serviceCollection); + var type = typeof(ClassWithAmbiguousCtors); + + // Act + var instance = ActivatorUtilities.CreateInstance(serviceProvider, type, value); + + // Assert + Assert.Equal(ctor, ((ClassWithAmbiguousCtors)instance).CtorUsed); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorUsesMarkedConstructor(CreateInstanceFunc createFunc) + { + // Arrange + var serviceCollection = new TestServiceCollection(); + serviceCollection.AddSingleton(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + // Act + var instance = CreateInstance(createFunc, serviceProvider, "hello"); + + // Assert + Assert.Equal("IFakeService, string", instance.CtorUsed); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorThrowsOnMultipleMarkedCtors(CreateInstanceFunc createFunc) + { + // Act + var exception = Assert.Throws(() => CreateInstance(createFunc, null, "hello")); + + // Assert + Assert.Equal("Multiple constructors were marked with ActivatorUtilitiesConstructorAttribute.", exception.Message); + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void TypeActivatorThrowsWhenMarkedCtorDoesntAcceptArguments(CreateInstanceFunc createFunc) + { + // Act + var exception = Assert.Throws(() => CreateInstance(createFunc, null, 0, "hello")); + + // Assert + Assert.Equal("Constructor marked with ActivatorUtilitiesConstructorAttribute does not accept all given argument types.", exception.Message); + } + + [Fact] + public void GetServiceOrCreateInstanceRegisteredServiceTransient() + { + // Reset the count because test order is not guaranteed + lock (CreationCountFakeService.InstanceLock) + { + CreationCountFakeService.InstanceCount = 0; + + var serviceCollection = new TestServiceCollection() + .AddTransient() + .AddTransient(); + + var serviceProvider = CreateServiceProvider(serviceCollection); + + var service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); + Assert.NotNull(service); + Assert.Equal(1, service.InstanceId); + Assert.Equal(1, CreationCountFakeService.InstanceCount); + + service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); + Assert.NotNull(service); + Assert.Equal(2, service.InstanceId); + Assert.Equal(2, CreationCountFakeService.InstanceCount); + } + } + + [Fact] + public void GetServiceOrCreateInstanceRegisteredServiceSingleton() + { + lock (CreationCountFakeService.InstanceLock) + { + // Arrange + // Reset the count because test order is not guaranteed + CreationCountFakeService.InstanceCount = 0; + + var serviceCollection = new TestServiceCollection() + .AddTransient() + .AddSingleton(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + // Act and Assert + var service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); + Assert.NotNull(service); + Assert.Equal(1, service.InstanceId); + Assert.Equal(1, CreationCountFakeService.InstanceCount); + + service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); + Assert.NotNull(service); + Assert.Equal(1, service.InstanceId); + Assert.Equal(1, CreationCountFakeService.InstanceCount); + } + } + + [Fact] + public void GetServiceOrCreateInstanceUnregisteredService() + { + lock (CreationCountFakeService.InstanceLock) + { + // Arrange + // Reset the count because test order is not guaranteed + CreationCountFakeService.InstanceCount = 0; + + var serviceCollection = new TestServiceCollection() + .AddTransient(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + // Act and Assert + var service = (CreationCountFakeService)ActivatorUtilities.GetServiceOrCreateInstance( + serviceProvider, + typeof(CreationCountFakeService)); + Assert.NotNull(service); + Assert.Equal(1, service.InstanceId); + Assert.Equal(1, CreationCountFakeService.InstanceCount); + + service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); + Assert.NotNull(service); + Assert.Equal(2, service.InstanceId); + Assert.Equal(2, CreationCountFakeService.InstanceCount); + } + } + + [Theory] + [MemberData(nameof(CreateInstanceFuncs))] + public void UnRegisteredServiceAsConstructorParameterThrowsException(CreateInstanceFunc createFunc) + { + var serviceCollection = new TestServiceCollection() + .AddSingleton(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + var ex = Assert.Throws(() => + CreateInstance(createFunc, serviceProvider)); + Assert.Equal($"Unable to resolve service for type '{typeof(IFakeService)}' while attempting" + + $" to activate '{typeof(CreationCountFakeService)}'.", + ex.Message); + } + + [Fact] + public void CreateInstance_WithAbstractTypeAndPublicConstructor_ThrowsCorrectException() + { + // Act & Assert + var ex = Assert.Throws(() => ActivatorUtilities.CreateInstance(default(IServiceProvider), typeof(AbstractFoo))); + var msg = "A suitable constructor for type 'Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+AbstractFoo' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor."; + Assert.Equal(msg, ex.Message); + } + + [Fact] + public void CreateInstance_CapturesInnerException_OfTargetInvocationException() + { + // Act & Assert + var ex = Assert.Throws(() => ActivatorUtilities.CreateInstance(default(IServiceProvider), typeof(Bar))); + var msg = "some error"; + Assert.Equal(msg, ex.Message); + } + + abstract class AbstractFoo + { + // The constructor should be public, since that is checked as well. + public AbstractFoo() + { + } + } + + class Bar + { + public Bar() + { + throw new InvalidOperationException("some error"); + } + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs new file mode 100644 index 00000000000000..4bfa9d3fb25475 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs @@ -0,0 +1,746 @@ +// 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 System.Collections; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.DependencyInjection.Specification.Fakes; +using Xunit; + +namespace Microsoft.Extensions.DependencyInjection.Specification +{ + public abstract partial class DependencyInjectionSpecificationTests + { + protected abstract IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection); + + [Fact] + public void ServicesRegisteredWithImplementationTypeCanBeResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeService), typeof(FakeService)); + var provider = CreateServiceProvider(collection); + + // Act + var service = provider.GetService(); + + // Assert + Assert.NotNull(service); + Assert.IsType(service); + } + + [Fact] + public void ServicesRegisteredWithImplementationType_ReturnDifferentInstancesPerResolution_ForTransientServices() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeService), typeof(FakeService)); + var provider = CreateServiceProvider(collection); + + // Act + var service1 = provider.GetService(); + var service2 = provider.GetService(); + + // Assert + Assert.IsType(service1); + Assert.IsType(service2); + Assert.NotSame(service1, service2); + } + + [Fact] + public void ServicesRegisteredWithImplementationType_ReturnSameInstancesPerResolution_ForSingletons() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddSingleton(typeof(IFakeService), typeof(FakeService)); + var provider = CreateServiceProvider(collection); + + // Act + var service1 = provider.GetService(); + var service2 = provider.GetService(); + + // Assert + Assert.IsType(service1); + Assert.IsType(service2); + Assert.Same(service1, service2); + } + + [Fact] + public void ServiceInstanceCanBeResolved() + { + // Arrange + var collection = new TestServiceCollection(); + var instance = new FakeService(); + collection.AddSingleton(typeof(IFakeServiceInstance), instance); + var provider = CreateServiceProvider(collection); + + // Act + var service = provider.GetService(); + + // Assert + Assert.Same(instance, service); + } + + [Fact] + public void TransientServiceCanBeResolvedFromProvider() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeService), typeof(FakeService)); + var provider = CreateServiceProvider(collection); + + // Act + var service1 = provider.GetService(); + var service2 = provider.GetService(); + + // Assert + Assert.NotNull(service1); + Assert.NotSame(service1, service2); + } + + [Fact] + public void TransientServiceCanBeResolvedFromScope() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeService), typeof(FakeService)); + var provider = CreateServiceProvider(collection); + + // Act + var service1 = provider.GetService(); + + using (var scope = provider.CreateScope()) + { + var scopedService1 = scope.ServiceProvider.GetService(); + var scopedService2 = scope.ServiceProvider.GetService(); + + // Assert + Assert.NotSame(service1, scopedService1); + Assert.NotSame(service1, scopedService2); + Assert.NotSame(scopedService1, scopedService2); + } + } + + [Fact] + public void SingleServiceCanBeIEnumerableResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeService), typeof(FakeService)); + var provider = CreateServiceProvider(collection); + + // Act + var services = provider.GetService>(); + + // Assert + Assert.NotNull(services); + var service = Assert.Single(services); + Assert.IsType(service); + } + + [Fact] + public void MultipleServiceCanBeIEnumerableResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeOneMultipleService)); + collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeTwoMultipleService)); + var provider = CreateServiceProvider(collection); + + // Act + var services = provider.GetService>(); + + // Assert + Assert.Collection(services.OrderBy(s => s.GetType().FullName), + service => Assert.IsType(service), + service => Assert.IsType(service)); + } + + [Fact] + public void RegistrationOrderIsPreservedWhenServicesAreIEnumerableResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeOneMultipleService)); + collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeTwoMultipleService)); + + var provider = CreateServiceProvider(collection); + + collection.Reverse(); + var providerReversed = CreateServiceProvider(collection); + + // Act + var services = provider.GetService>(); + var servicesReversed = providerReversed.GetService>(); + + // Assert + Assert.Collection(services, + service => Assert.IsType(service), + service => Assert.IsType(service)); + + Assert.Collection(servicesReversed, + service => Assert.IsType(service), + service => Assert.IsType(service)); + } + + [Fact] + public void OuterServiceCanHaveOtherServicesInjected() + { + // Arrange + var collection = new TestServiceCollection(); + var fakeService = new FakeService(); + collection.AddTransient(); + collection.AddSingleton(fakeService); + collection.AddTransient(); + collection.AddTransient(); + var provider = CreateServiceProvider(collection); + + // Act + var services = provider.GetService(); + + // Assert + Assert.Same(fakeService, services.SingleService); + Assert.Collection(services.MultipleServices.OrderBy(s => s.GetType().FullName), + service => Assert.IsType(service), + service => Assert.IsType(service)); + } + + [Fact] + public void FactoryServicesCanBeCreatedByGetService() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(); + collection.AddTransient(p => + { + var fakeService = p.GetRequiredService(); + return new TransientFactoryService + { + FakeService = fakeService, + Value = 42 + }; + }); + var provider = CreateServiceProvider(collection); + + // Act + var service = provider.GetService(); + + // Assert + Assert.NotNull(service); + Assert.Equal(42, service.Value); + Assert.NotNull(service.FakeService); + Assert.IsType(service.FakeService); + } + + [Fact] + public void FactoryServicesAreCreatedAsPartOfCreatingObjectGraph() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(); + collection.AddTransient(p => + { + var fakeService = p.GetService(); + return new TransientFactoryService + { + FakeService = fakeService, + Value = 42 + }; + }); + collection.AddScoped(p => + { + var fakeService = p.GetService(); + return new ScopedFactoryService + { + FakeService = fakeService, + }; + }); + collection.AddTransient(); + var provider = CreateServiceProvider(collection); + + // Act + var service1 = provider.GetService(); + var service2 = provider.GetService(); + + // Assert + Assert.Equal(42, service1.TransientService.Value); + Assert.NotNull(service1.TransientService.FakeService); + + Assert.Equal(42, service2.TransientService.Value); + Assert.NotNull(service2.TransientService.FakeService); + + Assert.NotNull(service1.ScopedService.FakeService); + + // Verify scoping works + Assert.NotSame(service1.TransientService, service2.TransientService); + Assert.Same(service1.ScopedService, service2.ScopedService); + } + + [Fact] + public void LastServiceReplacesPreviousServices() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(); + collection.AddTransient(); + var provider = CreateServiceProvider(collection); + + // Act + var service = provider.GetService(); + + // Assert + Assert.IsType(service); + } + + [Fact] + public void SingletonServiceCanBeResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddSingleton(); + var provider = CreateServiceProvider(collection); + + // Act + var service1 = provider.GetService(); + var service2 = provider.GetService(); + + // Assert + Assert.NotNull(service1); + Assert.Same(service1, service2); + } + + [Fact] + public void ServiceProviderRegistersServiceScopeFactory() + { + // Arrange + var collection = new TestServiceCollection(); + var provider = CreateServiceProvider(collection); + + // Act + var scopeFactory = provider.GetService(); + + // Assert + Assert.NotNull(scopeFactory); + } + + [Fact] + public void ScopedServiceCanBeResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddScoped(); + var provider = CreateServiceProvider(collection); + + // Act + using (var scope = provider.CreateScope()) + { + var providerScopedService = provider.GetService(); + var scopedService1 = scope.ServiceProvider.GetService(); + var scopedService2 = scope.ServiceProvider.GetService(); + + // Assert + Assert.NotSame(providerScopedService, scopedService1); + Assert.Same(scopedService1, scopedService2); + } + } + + [Fact] + public void NestedScopedServiceCanBeResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddScoped(); + var provider = CreateServiceProvider(collection); + + // Act + using (var outerScope = provider.CreateScope()) + using (var innerScope = outerScope.ServiceProvider.CreateScope()) + { + var outerScopedService = outerScope.ServiceProvider.GetService(); + var innerScopedService = innerScope.ServiceProvider.GetService(); + + // Assert + Assert.NotNull(outerScopedService); + Assert.NotNull(innerScopedService); + Assert.NotSame(outerScopedService, innerScopedService); + } + } + + [Fact] + public void ScopedServices_FromCachedScopeFactory_CanBeResolvedAndDisposed() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddScoped(); + var provider = CreateServiceProvider(collection); + var cachedScopeFactory = provider.GetService(); + + // Act + for (var i = 0; i < 3; i++) + { + FakeService outerScopedService; + using (var outerScope = cachedScopeFactory.CreateScope()) + { + FakeService innerScopedService; + using (var innerScope = outerScope.ServiceProvider.CreateScope()) + { + outerScopedService = outerScope.ServiceProvider.GetService() as FakeService; + innerScopedService = innerScope.ServiceProvider.GetService() as FakeService; + + // Assert + Assert.NotNull(outerScopedService); + Assert.NotNull(innerScopedService); + Assert.NotSame(outerScopedService, innerScopedService); + } + + Assert.False(outerScopedService.Disposed); + Assert.True(innerScopedService.Disposed); + } + + Assert.True(outerScopedService.Disposed); + } + } + + [Fact] + public void DisposingScopeDisposesService() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddSingleton(); + collection.AddScoped(); + collection.AddTransient(); + + var provider = CreateServiceProvider(collection); + FakeService disposableService; + FakeService transient1; + FakeService transient2; + FakeService singleton; + + // Act and Assert + var transient3 = Assert.IsType(provider.GetService()); + using (var scope = provider.CreateScope()) + { + disposableService = (FakeService)scope.ServiceProvider.GetService(); + transient1 = (FakeService)scope.ServiceProvider.GetService(); + transient2 = (FakeService)scope.ServiceProvider.GetService(); + singleton = (FakeService)scope.ServiceProvider.GetService(); + + Assert.False(disposableService.Disposed); + Assert.False(transient1.Disposed); + Assert.False(transient2.Disposed); + Assert.False(singleton.Disposed); + } + + Assert.True(disposableService.Disposed); + Assert.True(transient1.Disposed); + Assert.True(transient2.Disposed); + Assert.False(singleton.Disposed); + + var disposableProvider = provider as IDisposable; + if (disposableProvider != null) + { + disposableProvider.Dispose(); + Assert.True(singleton.Disposed); + Assert.True(transient3.Disposed); + } + } + + [Fact] + public void SelfResolveThenDispose() + { + // Arrange + var collection = new TestServiceCollection(); + var provider = CreateServiceProvider(collection); + + // Act + var serviceProvider = provider.GetService(); + + // Assert + Assert.NotNull(serviceProvider); + (provider as IDisposable)?.Dispose(); + } + + [Fact] + public void SafelyDisposeNestedProviderReferences() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(); + var provider = CreateServiceProvider(collection); + + // Act + var nester = provider.GetService(); + + // Assert + Assert.NotNull(nester); + nester.Dispose(); + } + + [Fact] + public void SingletonServicesComeFromRootProvider() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddSingleton(); + var provider = CreateServiceProvider(collection); + FakeService disposableService1; + FakeService disposableService2; + + // Act and Assert + using (var scope = provider.CreateScope()) + { + var service = scope.ServiceProvider.GetService(); + disposableService1 = Assert.IsType(service); + Assert.False(disposableService1.Disposed); + } + + Assert.False(disposableService1.Disposed); + + using (var scope = provider.CreateScope()) + { + var service = scope.ServiceProvider.GetService(); + disposableService2 = Assert.IsType(service); + Assert.False(disposableService2.Disposed); + } + + Assert.False(disposableService2.Disposed); + Assert.Same(disposableService1, disposableService2); + } + + [Fact] + public void NestedScopedServiceCanBeResolvedWithNoFallbackProvider() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddScoped(); + var provider = CreateServiceProvider(collection); + + // Act + using (var outerScope = provider.CreateScope()) + using (var innerScope = outerScope.ServiceProvider.CreateScope()) + { + var outerScopedService = outerScope.ServiceProvider.GetService(); + var innerScopedService = innerScope.ServiceProvider.GetService(); + + // Assert + Assert.NotSame(outerScopedService, innerScopedService); + } + } + + [Fact] + public void OpenGenericServicesCanBeResolved() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); + collection.AddSingleton(); + var provider = CreateServiceProvider(collection); + + // Act + var genericService = provider.GetService>(); + var singletonService = provider.GetService(); + + // Assert + Assert.Same(singletonService, genericService.Value); + } + + [Fact] + public void ClosedServicesPreferredOverOpenGenericServices() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddTransient(typeof(IFakeOpenGenericService), typeof(FakeService)); + collection.AddTransient(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); + collection.AddSingleton(); + var provider = CreateServiceProvider(collection); + + // Act + var service = provider.GetService>(); + + // Assert + Assert.IsType(service); + } + + [Fact] + public void AttemptingToResolveNonexistentServiceReturnsNull() + { + // Arrange + var collection = new TestServiceCollection(); + var provider = CreateServiceProvider(collection); + + // Act + var service = provider.GetService(); + + // Assert + Assert.Null(service); + } + + [Fact] + public void NonexistentServiceCanBeIEnumerableResolved() + { + // Arrange + var collection = new TestServiceCollection(); + var provider = CreateServiceProvider(collection); + + // Act + var services = provider.GetService>(); + + // Assert + Assert.Empty(services); + } + + public static TheoryData ServiceContainerPicksConstructorWithLongestMatchesData + { + get + { + var fakeService = new FakeService(); + var multipleService = new FakeService(); + var factoryService = new TransientFactoryService(); + var scopedService = new FakeService(); + + return new TheoryData + { + { + new TestServiceCollection() + .AddSingleton(fakeService), + new TypeWithSupersetConstructors(fakeService) + }, + { + new TestServiceCollection() + .AddSingleton(factoryService), + new TypeWithSupersetConstructors(factoryService) + }, + { + new TestServiceCollection() + .AddSingleton(fakeService) + .AddSingleton(factoryService), + new TypeWithSupersetConstructors(fakeService, factoryService) + }, + { + new TestServiceCollection() + .AddSingleton(fakeService) + .AddSingleton(multipleService) + .AddSingleton(factoryService), + new TypeWithSupersetConstructors(fakeService, multipleService, factoryService) + }, + { + new TestServiceCollection() + .AddSingleton(fakeService) + .AddSingleton(multipleService) + .AddSingleton(scopedService) + .AddSingleton(factoryService), + new TypeWithSupersetConstructors(multipleService, factoryService, fakeService, scopedService) + } + }; + } + } + + [Theory] + [MemberData(nameof(ServiceContainerPicksConstructorWithLongestMatchesData))] + public void ServiceContainerPicksConstructorWithLongestMatches( + IServiceCollection serviceCollection, + TypeWithSupersetConstructors expected) + { + // Arrange + serviceCollection.AddTransient(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + // Act + var actual = serviceProvider.GetService(); + + // Assert + Assert.NotNull(actual); + Assert.Same(expected.Service, actual.Service); + Assert.Same(expected.FactoryService, actual.FactoryService); + Assert.Same(expected.MultipleService, actual.MultipleService); + Assert.Same(expected.ScopedService, actual.ScopedService); + } + + [Fact] + public void DisposesInReverseOrderOfCreation() + { + // Arrange + var serviceCollection = new TestServiceCollection(); + serviceCollection.AddSingleton(); + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(); + serviceCollection.AddScoped(); + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(); + var serviceProvider = CreateServiceProvider(serviceCollection); + + var callback = serviceProvider.GetService(); + var outer = serviceProvider.GetService(); + var multipleServices = outer.MultipleServices.ToArray(); + + // Act + ((IDisposable)serviceProvider).Dispose(); + + // Assert + Assert.Equal(outer, callback.Disposed[0]); + Assert.Equal(multipleServices.Reverse(), callback.Disposed.Skip(1).Take(3).OfType()); + Assert.Equal(outer.SingleService, callback.Disposed[4]); + } + + [Fact] + public void ResolvesMixedOpenClosedGenericsAsEnumerable() + { + // Arrange + var serviceCollection = new TestServiceCollection(); + var instance = new FakeOpenGenericService(null); + + serviceCollection.AddTransient(); + serviceCollection.AddSingleton(typeof(IFakeOpenGenericService), typeof(FakeService)); + serviceCollection.AddSingleton(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); + serviceCollection.AddSingleton>(instance); + + var serviceProvider = CreateServiceProvider(serviceCollection); + + var enumerable = serviceProvider.GetService>>().ToArray(); + + // Assert + Assert.Equal(3, enumerable.Length); + Assert.NotNull(enumerable[0]); + Assert.NotNull(enumerable[1]); + Assert.NotNull(enumerable[2]); + + Assert.Equal(instance, enumerable[2]); + Assert.IsType(enumerable[0]); + } + + [Theory] + [InlineData(typeof(IFakeService), typeof(FakeService), typeof(IFakeService), ServiceLifetime.Scoped)] + [InlineData(typeof(IFakeService), typeof(FakeService), typeof(IFakeService), ServiceLifetime.Singleton)] + [InlineData(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>), typeof(IFakeOpenGenericService), ServiceLifetime.Scoped)] + [InlineData(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>), typeof(IFakeOpenGenericService), ServiceLifetime.Singleton)] + public void ResolvesDifferentInstancesForServiceWhenResolvingEnumerable(Type serviceType, Type implementation, Type resolve, ServiceLifetime lifetime) + { + // Arrange + var serviceCollection = new TestServiceCollection + { + ServiceDescriptor.Describe(serviceType, implementation, lifetime), + ServiceDescriptor.Describe(serviceType, implementation, lifetime), + ServiceDescriptor.Describe(serviceType, implementation, lifetime) + }; + + var serviceProvider = CreateServiceProvider(serviceCollection); + using (var scope = serviceProvider.CreateScope()) + { + var enumerable = (scope.ServiceProvider.GetService(typeof(IEnumerable<>).MakeGenericType(resolve)) as IEnumerable) + .OfType().ToArray(); + var service = scope.ServiceProvider.GetService(resolve); + + // Assert + Assert.Equal(3, enumerable.Length); + Assert.NotNull(enumerable[0]); + Assert.NotNull(enumerable[1]); + Assert.NotNull(enumerable[2]); + + Assert.NotEqual(enumerable[0], enumerable[1]); + Assert.NotEqual(enumerable[1], enumerable[2]); + Assert.Equal(service, enumerable[2]); + } + } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs new file mode 100644 index 00000000000000..7b66b0a895ed0a --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs @@ -0,0 +1,15 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class AnotherClass + { + public AnotherClass(IFakeService fakeService) + { + FakeService = fakeService; + } + + public IFakeService FakeService { get; } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs new file mode 100644 index 00000000000000..6eb8982254a3ed --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs @@ -0,0 +1,21 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class AnotherClassAcceptingData + { + public AnotherClassAcceptingData(IFakeService fakeService, string one, string two) + { + FakeService = fakeService; + One = one; + Two = two; + } + + public IFakeService FakeService { get; } + + public string One { get; } + + public string Two { get; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs new file mode 100644 index 00000000000000..9f0e97891502cf --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs @@ -0,0 +1,39 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithAmbiguousCtors + { + public ClassWithAmbiguousCtors(string data) + { + CtorUsed = "string"; + } + + public ClassWithAmbiguousCtors(IFakeService service, string data) + { + CtorUsed = "IFakeService, string"; + } + + public ClassWithAmbiguousCtors(IFakeService service, int data) + { + CtorUsed = "IFakeService, int"; + } + + public ClassWithAmbiguousCtors(IFakeService service, string data1, int data2) + { + FakeService = service; + Data1 = data1; + Data2 = data2; + + CtorUsed = "IFakeService, string, string"; + } + + public IFakeService FakeService { get; } + + public string Data1 { get; } + + public int Data2 { get; } + public string CtorUsed { get; set; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs new file mode 100644 index 00000000000000..65b2494b80ce7c --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs @@ -0,0 +1,26 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithAmbiguousCtorsAndAttribute + { + public ClassWithAmbiguousCtorsAndAttribute(string data) + { + CtorUsed = "string"; + } + + [ActivatorUtilitiesConstructor] + public ClassWithAmbiguousCtorsAndAttribute(IFakeService service, string data) + { + CtorUsed = "IFakeService, string"; + } + + public ClassWithAmbiguousCtorsAndAttribute(IFakeService service, IFakeOuterService service2, string data) + { + CtorUsed = "IFakeService, IFakeService, string"; + } + + public string CtorUsed { get; set; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs new file mode 100644 index 00000000000000..269ce44d6b28d3 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection +{ + public class ClassWithInternalConstructor + { + internal ClassWithInternalConstructor() + { + } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs new file mode 100644 index 00000000000000..af364fb4f09c4a --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs @@ -0,0 +1,18 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithMultipleMarkedCtors + { + [ActivatorUtilitiesConstructor] + public ClassWithMultipleMarkedCtors(string data) + { + } + + [ActivatorUtilitiesConstructor] + public ClassWithMultipleMarkedCtors(IFakeService service, string data) + { + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs new file mode 100644 index 00000000000000..1b5b5fd075146d --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs @@ -0,0 +1,34 @@ +// 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; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithNestedReferencesToProvider : IDisposable + { + private IServiceProvider _serviceProvider; + private ClassWithNestedReferencesToProvider _nested; + + public ClassWithNestedReferencesToProvider(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + _nested = new ClassWithNestedReferencesToProvider(_serviceProvider, 0); + } + + private ClassWithNestedReferencesToProvider(IServiceProvider serviceProvider, int level) + { + _serviceProvider = serviceProvider; + if (level > 1) + { + _nested = new ClassWithNestedReferencesToProvider(_serviceProvider, level + 1); + } + } + + public void Dispose() + { + _nested?.Dispose(); + (_serviceProvider as IDisposable)?.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs new file mode 100644 index 00000000000000..52506279d57067 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs @@ -0,0 +1,15 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification +{ + public class ClassWithOptionalArgsCtor + { + public ClassWithOptionalArgsCtor(string whatever = "BLARGH") + { + Whatever = whatever; + } + + public string Whatever { get; set; } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs new file mode 100644 index 00000000000000..820c6a2c6aa3e5 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs @@ -0,0 +1,27 @@ +// 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; + +namespace Microsoft.Extensions.DependencyInjection.Specification +{ + public class ClassWithOptionalArgsCtorWithStructs + { + public ClassWithOptionalArgsCtorWithStructs( + DateTime dateTime = new DateTime(), + DateTime dateTimeDefault = default(DateTime), + TimeSpan timeSpan = new TimeSpan(), + TimeSpan timeSpanDefault = default(TimeSpan), + DateTimeOffset dateTimeOffset = new DateTimeOffset(), + DateTimeOffset dateTimeOffsetDefault = default(DateTimeOffset), + Guid guid = new Guid(), + Guid guidDefault = default(Guid), + CustomStruct customStruct = new CustomStruct(), + CustomStruct customStructDefault = default(CustomStruct) + ) + { + } + + public struct CustomStruct { } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs new file mode 100644 index 00000000000000..74ef1329ffa24c --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithPrivateCtor + { + private ClassWithPrivateCtor() + { + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs new file mode 100644 index 00000000000000..8834c3141cacf1 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithProtectedConstructor + { + internal ClassWithProtectedConstructor() + { + } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs new file mode 100644 index 00000000000000..1b427ef9294c4d --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs @@ -0,0 +1,13 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithStaticCtor + { + static ClassWithStaticCtor() + { + + } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs new file mode 100644 index 00000000000000..4f9fe3ca36dc52 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs @@ -0,0 +1,15 @@ +// 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; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithThrowingCtor + { + public ClassWithThrowingCtor(IFakeService service) + { + throw new Exception(nameof(ClassWithThrowingCtor)); + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs new file mode 100644 index 00000000000000..bd1b9ac7563106 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs @@ -0,0 +1,15 @@ +// 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; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithThrowingEmptyCtor + { + public ClassWithThrowingEmptyCtor() + { + throw new Exception(nameof(ClassWithThrowingEmptyCtor)); + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs new file mode 100644 index 00000000000000..9be98289e9b62d --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs @@ -0,0 +1,20 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class CreationCountFakeService + { + public static readonly object InstanceLock = new object(); + + public CreationCountFakeService(IFakeService dependency) + { + InstanceCount++; + InstanceId = InstanceCount; + } + + public static int InstanceCount { get; set; } + + public int InstanceId { get; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs new file mode 100644 index 00000000000000..c8581330cf7f55 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeDisposableCallbackInnerService : FakeDisposableCallbackService, IFakeMultipleService + { + public FakeDisposableCallbackInnerService(FakeDisposeCallback callback) : base(callback) + { + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs new file mode 100644 index 00000000000000..d400c122de081d --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs @@ -0,0 +1,22 @@ +// 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.Collections.Generic; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeDisposableCallbackOuterService : FakeDisposableCallbackService, IFakeOuterService + { + public FakeDisposableCallbackOuterService( + IFakeService singleService, + IEnumerable multipleServices, + FakeDisposeCallback callback) : base(callback) + { + SingleService = singleService; + MultipleServices = multipleServices; + } + + public IFakeService SingleService { get; } + public IEnumerable MultipleServices { get; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs new file mode 100644 index 00000000000000..53e095793c75fb --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs @@ -0,0 +1,30 @@ +// 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; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeDisposableCallbackService: IDisposable + { + private static int _globalId; + private readonly int _id; + private readonly FakeDisposeCallback _callback; + + public FakeDisposableCallbackService(FakeDisposeCallback callback) + { + _id = _globalId++; + _callback = callback; + } + + public void Dispose() + { + _callback.Disposed.Add(this); + } + + public override string ToString() + { + return _id.ToString(); + } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs new file mode 100644 index 00000000000000..4fab8d63528bd5 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs @@ -0,0 +1,12 @@ +// 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.Collections.Generic; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeDisposeCallback + { + public List Disposed { get; } = new List(); + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs new file mode 100644 index 00000000000000..81c0445471ddfa --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeOneMultipleService : IFakeMultipleService + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs new file mode 100644 index 00000000000000..564c758fa563f0 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs @@ -0,0 +1,15 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeOpenGenericService : IFakeOpenGenericService + { + public FakeOpenGenericService(TVal value) + { + Value = value; + } + + public TVal Value { get; } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs new file mode 100644 index 00000000000000..e5d3c3017ae38e --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs @@ -0,0 +1,22 @@ +// 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.Collections.Generic; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeOuterService : IFakeOuterService + { + public FakeOuterService( + IFakeService singleService, + IEnumerable multipleServices) + { + SingleService = singleService; + MultipleServices = multipleServices; + } + + public IFakeService SingleService { get; } + + public IEnumerable MultipleServices { get; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs new file mode 100644 index 00000000000000..1bedc0a2fcdb5c --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs @@ -0,0 +1,24 @@ +// 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; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeService : IFakeEveryService, IDisposable + { + public PocoClass Value { get; set; } + + public bool Disposed { get; private set; } + + public void Dispose() + { + if (Disposed) + { + throw new ObjectDisposedException(nameof(FakeService)); + } + + Disposed = true; + } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs new file mode 100644 index 00000000000000..d31711d2434e5a --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class FakeTwoMultipleService : IFakeMultipleService + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs new file mode 100644 index 00000000000000..6e9e60c9be1541 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFactoryService + { + IFakeService FakeService { get; } + + int Value { get; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs new file mode 100644 index 00000000000000..b044fc69eb204e --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs @@ -0,0 +1,15 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeEveryService : + IFakeService, + IFakeMultipleService, + IFakeScopedService, + IFakeServiceInstance, + IFakeSingletonService, + IFakeOpenGenericService + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs new file mode 100644 index 00000000000000..07a61cfbe50800 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeMultipleService : IFakeService + { + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs new file mode 100644 index 00000000000000..bc4b7f051eae69 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs @@ -0,0 +1,10 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeOpenGenericService + { + TValue Value { get; } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs new file mode 100644 index 00000000000000..02ba79477f99cb --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs @@ -0,0 +1,14 @@ +// 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.Collections.Generic; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeOuterService + { + IFakeService SingleService { get; } + + IEnumerable MultipleServices { get; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs new file mode 100644 index 00000000000000..2da71c1852914c --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeScopedService : IFakeService + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs new file mode 100644 index 00000000000000..1737ac6c1eb481 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeService + { + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs new file mode 100644 index 00000000000000..da58e46f7e1d36 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeServiceInstance : IFakeService + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs new file mode 100644 index 00000000000000..1fd5db82fbe8a3 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface IFakeSingletonService : IFakeService + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs new file mode 100644 index 00000000000000..b91fb36088cefe --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public interface INonexistentService + { + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs new file mode 100644 index 00000000000000..17e6e10b9ecb06 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs @@ -0,0 +1,9 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class PocoClass + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs new file mode 100644 index 00000000000000..79c3f197224b28 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs @@ -0,0 +1,10 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ScopedFactoryService + { + public IFakeService FakeService { get; set; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs new file mode 100644 index 00000000000000..b3d6aaa4320719 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs @@ -0,0 +1,20 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ServiceAcceptingFactoryService + { + public ServiceAcceptingFactoryService( + ScopedFactoryService scopedService, + IFactoryService transientService) + { + ScopedService = scopedService; + TransientService = transientService; + } + + public ScopedFactoryService ScopedService { get; private set; } + + public IFactoryService TransientService { get; private set; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs new file mode 100644 index 00000000000000..b74377011638b7 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs @@ -0,0 +1,12 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class TransientFactoryService : IFactoryService + { + public IFakeService FakeService { get; set; } + + public int Value { get; set; } + } +} \ No newline at end of file diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs new file mode 100644 index 00000000000000..009cd1a01cf83a --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs @@ -0,0 +1,64 @@ +// 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. + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class TypeWithSupersetConstructors + { + public TypeWithSupersetConstructors(IFactoryService factoryService) + : this( + fakeService: null, + factoryService: factoryService) + { + } + + public TypeWithSupersetConstructors(IFakeService fakeService) + : this( + fakeService, + factoryService: null) + { + } + + public TypeWithSupersetConstructors( + IFakeService fakeService, + IFactoryService factoryService) + : this( + fakeService, + multipleService: null, + factoryService: factoryService) + { + } + + public TypeWithSupersetConstructors( + IFakeService fakeService, + IFakeMultipleService multipleService, + IFactoryService factoryService) + : this( + multipleService, + factoryService, + fakeService, + scopedService: null) + { + } + + public TypeWithSupersetConstructors( + IFakeMultipleService multipleService, + IFactoryService factoryService, + IFakeService fakeService, + IFakeScopedService scopedService) + { + MultipleService = multipleService; + FactoryService = factoryService; + Service = fakeService; + ScopedService = scopedService; + } + + public IFakeService Service { get; } + + public IFactoryService FactoryService { get; } + + public IFakeMultipleService MultipleService { get; } + + public IFakeScopedService ScopedService { get; } + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj new file mode 100644 index 00000000000000..9f4306b5bb97ab --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -0,0 +1,24 @@ + + + + Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection. + netstandard2.0 + Microsoft.Extensions.DependencyInjection.Specification + $(NoWarn);CS1591 + + false + false + + + + + + + + + + + + diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs new file mode 100644 index 00000000000000..c3b120c1cac032 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs @@ -0,0 +1,11 @@ +// 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.Collections.Generic; + +namespace Microsoft.Extensions.DependencyInjection.Specification +{ + internal class TestServiceCollection : List, IServiceCollection + { + } +} diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json new file mode 100644 index 00000000000000..e38b7ccfccc9f3 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json @@ -0,0 +1,1563 @@ +{ + "AssemblyIdentity": "Microsoft.Extensions.DependencyInjection.Specification.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", + "Types": [ + { + "Name": "Microsoft.Extensions.DependencyInjection.ClassWithInternalConstructor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests", + "Visibility": "Public", + "Kind": "Class", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_CreateInstanceFuncs", + "Parameters": [], + "ReturnType": "System.Collections.Generic.IEnumerable", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorEnablesYouToCreateAnyTypeWithServicesEvenWhenNotInIocContainer", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorAcceptsAnyNumberOfAdditionalConstructorParametersToProvide", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorWorksWithStaticCtor", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorWorksWithCtorWithOptionalArgs", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorCanDisambiguateConstructorsWithUniqueArguments", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_TypesWithNonPublicConstructorData", + "Parameters": [], + "ReturnType": "System.Collections.Generic.IEnumerable", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorRequiresPublicConstructor", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + }, + { + "Name": "type", + "Type": "System.Type" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorRequiresAllArgumentsCanBeAccepted", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorRethrowsOriginalExceptionFromConstructor", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TypeActivatorCreateFactoryDoesNotAllowForAmbiguousConstructorMatches", + "Parameters": [ + { + "Name": "paramType", + "Type": "System.Type" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "GetServiceOrCreateInstanceRegisteredServiceTransient", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "GetServiceOrCreateInstanceRegisteredServiceSingleton", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "GetServiceOrCreateInstanceUnregisteredService", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "UnRegisteredServiceAsConstructorParameterThrowsException", + "Parameters": [ + { + "Name": "createFunc", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "CreateServiceProvider", + "Parameters": [ + { + "Name": "serviceCollection", + "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" + } + ], + "ReturnType": "System.IServiceProvider", + "Virtual": true, + "Abstract": true, + "Visibility": "Protected", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ServicesRegisteredWithImplementationTypeCanBeResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ServicesRegisteredWithImplementationType_ReturnDifferentInstancesPerResolution_ForTransientServices", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ServicesRegisteredWithImplementationType_ReturnSameInstancesPerResolution_ForSingletons", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ServiceInstanceCanBeResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TransientServiceCanBeResolvedFromProvider", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "TransientServiceCanBeResolvedFromScope", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "SingleServiceCanBeIEnumerableResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "MultipleServiceCanBeIEnumerableResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "RegistrationOrderIsPreservedWhenServicesAreIEnumerableResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "OuterServiceCanHaveOtherServicesInjected", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "FactoryServicesCanBeCreatedByGetService", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "FactoryServicesAreCreatedAsPartOfCreatingObjectGraph", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "LastServiceReplacesPreviousServices", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "SingletonServiceCanBeResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ServiceProviderRegistersServiceScopeFactory", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ScopedServiceCanBeResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "NestedScopedServiceCanBeResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ScopedServices_FromCachedScopeFactory_CanBeResolvedAndDisposed", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "DisposingScopeDisposesService", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "SelfResolveThenDispose", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "SafelyDisposeNestedProviderReferences", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "SingletonServicesComeFromRootProvider", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "NestedScopedServiceCanBeResolvedWithNoFallbackProvider", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "OpenGenericServicesCanBeResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ClosedServicesPreferredOverOpenGenericServices", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "AttemptingToResolveNonexistentServiceReturnsNull", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "NonexistentServiceCanBeIEnumerableResolved", + "Parameters": [], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_ServiceContainerPicksConstructorWithLongestMatchesData", + "Parameters": [], + "ReturnType": "Xunit.TheoryData", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ServiceContainerPicksConstructorWithLongestMatches", + "Parameters": [ + { + "Name": "serviceCollection", + "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" + }, + { + "Name": "expected", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.TypeWithSupersetConstructors" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Protected", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.ClassWithOptionalArgsCtor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_Whatever", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_Whatever", + "Parameters": [ + { + "Name": "value", + "Type": "System.String" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "whatever", + "Type": "System.String", + "DefaultValue": "\"BLARGH\"" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.AnotherClass", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_FakeService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "fakeService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.AnotherClassAcceptingData", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_FakeService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_One", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Two", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "fakeService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "one", + "Type": "System.String" + }, + { + "Name": "two", + "Type": "System.String" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithAmbiguousCtors", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_FakeService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Data1", + "Parameters": [], + "ReturnType": "System.String", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Data2", + "Parameters": [], + "ReturnType": "System.Int32", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "data", + "Type": "System.String" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "service", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "data", + "Type": "System.String" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "service", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "data", + "Type": "System.Int32" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "service", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "data1", + "Type": "System.String" + }, + { + "Name": "data2", + "Type": "System.Int32" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithNestedReferencesToProvider", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "System.IDisposable" + ], + "Members": [ + { + "Kind": "Method", + "Name": "Dispose", + "Parameters": [], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "System.IDisposable", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "serviceProvider", + "Type": "System.IServiceProvider" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithPrivateCtor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithProtectedConstructor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithStaticCtor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithThrowingCtor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "service", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithThrowingEmptyCtor", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.CreationCountFakeService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_InstanceCount", + "Parameters": [], + "ReturnType": "System.Int32", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_InstanceCount", + "Parameters": [ + { + "Name": "value", + "Type": "System.Int32" + } + ], + "ReturnType": "System.Void", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_InstanceId", + "Parameters": [], + "ReturnType": "System.Int32", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "dependency", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Field", + "Name": "InstanceLock", + "Parameters": [], + "ReturnType": "System.Object", + "Static": true, + "ReadOnly": true, + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOneMultipleService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" + ], + "Members": [ + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOpenGenericService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_Value", + "Parameters": [], + "ReturnType": "T0", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "value", + "Type": "T0" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [ + { + "ParameterName": "TVal", + "ParameterPosition": 0, + "BaseTypeOrInterfaces": [] + } + ] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOuterService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_SingleService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_MultipleServices", + "Parameters": [], + "ReturnType": "System.Collections.Generic.IEnumerable", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "singleService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "multipleServices", + "Type": "System.Collections.Generic.IEnumerable" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeEveryService", + "System.IDisposable" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_Value", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_Value", + "Parameters": [ + { + "Name": "value", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Disposed", + "Parameters": [], + "ReturnType": "System.Boolean", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Dispose", + "Parameters": [], + "ReturnType": "System.Void", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "System.IDisposable", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeTwoMultipleService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" + ], + "Members": [ + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_FakeService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Value", + "Parameters": [], + "ReturnType": "System.Int32", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeEveryService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService", + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService", + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeServiceInstance", + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeSingletonService", + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService" + ], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + ], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_Value", + "Parameters": [], + "ReturnType": "T0", + "GenericParameter": [] + } + ], + "GenericParameters": [ + { + "ParameterName": "TValue", + "ParameterPosition": 0, + "BaseTypeOrInterfaces": [] + } + ] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_SingleService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_MultipleServices", + "Parameters": [], + "ReturnType": "System.Collections.Generic.IEnumerable", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + ], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeServiceInstance", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + ], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeSingletonService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + ], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.INonexistentService", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ScopedFactoryService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_FakeService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_FakeService", + "Parameters": [ + { + "Name": "value", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ServiceAcceptingFactoryService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_ScopedService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ScopedFactoryService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_TransientService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "scopedService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ScopedFactoryService" + }, + { + "Name": "transientService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.TransientFactoryService", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" + ], + "Members": [ + { + "Kind": "Method", + "Name": "get_FakeService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_FakeService", + "Parameters": [ + { + "Name": "value", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_Value", + "Parameters": [], + "ReturnType": "System.Int32", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "set_Value", + "Parameters": [ + { + "Name": "value", + "Type": "System.Int32" + } + ], + "ReturnType": "System.Void", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.TypeWithSupersetConstructors", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "get_Service", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_FactoryService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_MultipleService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "get_ScopedService", + "Parameters": [], + "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "factoryService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "fakeService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "fakeService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "factoryService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "fakeService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "multipleService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" + }, + { + "Name": "factoryService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "multipleService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" + }, + { + "Name": "factoryService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" + }, + { + "Name": "fakeService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" + }, + { + "Name": "scopedService", + "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc", + "Visibility": "Public", + "Kind": "Class", + "Sealed": true, + "BaseType": "System.MulticastDelegate", + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "Invoke", + "Parameters": [ + { + "Name": "provider", + "Type": "System.IServiceProvider" + }, + { + "Name": "type", + "Type": "System.Type" + }, + { + "Name": "args", + "Type": "System.Object[]" + } + ], + "ReturnType": "System.Object", + "Virtual": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "BeginInvoke", + "Parameters": [ + { + "Name": "provider", + "Type": "System.IServiceProvider" + }, + { + "Name": "type", + "Type": "System.Type" + }, + { + "Name": "args", + "Type": "System.Object[]" + }, + { + "Name": "callback", + "Type": "System.AsyncCallback" + }, + { + "Name": "object", + "Type": "System.Object" + } + ], + "ReturnType": "System.IAsyncResult", + "Virtual": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "EndInvoke", + "Parameters": [ + { + "Name": "result", + "Type": "System.IAsyncResult" + } + ], + "ReturnType": "System.Object", + "Virtual": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "object", + "Type": "System.Object" + }, + { + "Name": "method", + "Type": "System.IntPtr" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + } + ] +} \ No newline at end of file From 3f330b6ca3be6758370d7c083445c474fe57a9f2 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Fri, 2 Nov 2018 00:26:10 -0700 Subject: [PATCH 02/16] Merge the source code from aspnet/DependencyInjection release/2.1 Commit migrated from https://github.com/dotnet/Extensions/commit/8b174f1f34b162f842aa793123c4bdfdd500748b --- ...ft.Extensions.DependencyInjection.Specification.Tests.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index 9f4306b5bb97ab..2a39e8a61a671b 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -4,6 +4,8 @@ Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection. netstandard2.0 Microsoft.Extensions.DependencyInjection.Specification + true + dependencyinjection;di $(NoWarn);CS1591 false + false false + + true @@ -22,5 +25,4 @@ - From a0f9369bd5813e9f1dab086089580ea3300c30ce Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 29 Jan 2019 18:34:54 -0800 Subject: [PATCH 05/16] Cleanup conversion to Arcade (dotnet/Extensions#1014) * Remove obsolete targets, properties, and scripts * Replace IsProductComponent with IsShipping * Undo bad merge to version.props * Update documentation, and put workarounds into a common file * Replace usages of RepositoryRoot with RepoRoot * Remove API baselines * Remove unnecessary restore feeds and split workarounds into two files * Enable PR checks on all branches, and disable autocancel Commit migrated from https://github.com/dotnet/Extensions/commit/f41cfded3c12eec0efea89ece1dafe43afa9c6b8 --- ...ndencyInjection.Specification.Tests.csproj | 7 +- .../baseline.netcore.json | 1563 ----------------- 2 files changed, 1 insertion(+), 1569 deletions(-) delete mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index 0731f2e828e2bd..ba8cbfd3f98dec 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -7,14 +7,9 @@ true dependencyinjection;di $(NoWarn);CS1591 - - false false - false - true + true diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json deleted file mode 100644 index e38b7ccfccc9f3..00000000000000 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/baseline.netcore.json +++ /dev/null @@ -1,1563 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.Extensions.DependencyInjection.Specification.Tests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.Extensions.DependencyInjection.ClassWithInternalConstructor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_CreateInstanceFuncs", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IEnumerable", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorEnablesYouToCreateAnyTypeWithServicesEvenWhenNotInIocContainer", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorAcceptsAnyNumberOfAdditionalConstructorParametersToProvide", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorWorksWithStaticCtor", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorWorksWithCtorWithOptionalArgs", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorCanDisambiguateConstructorsWithUniqueArguments", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_TypesWithNonPublicConstructorData", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IEnumerable", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorRequiresPublicConstructor", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - }, - { - "Name": "type", - "Type": "System.Type" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorRequiresAllArgumentsCanBeAccepted", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorRethrowsOriginalExceptionFromConstructor", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TypeActivatorCreateFactoryDoesNotAllowForAmbiguousConstructorMatches", - "Parameters": [ - { - "Name": "paramType", - "Type": "System.Type" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetServiceOrCreateInstanceRegisteredServiceTransient", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetServiceOrCreateInstanceRegisteredServiceSingleton", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetServiceOrCreateInstanceUnregisteredService", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UnRegisteredServiceAsConstructorParameterThrowsException", - "Parameters": [ - { - "Name": "createFunc", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateServiceProvider", - "Parameters": [ - { - "Name": "serviceCollection", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - } - ], - "ReturnType": "System.IServiceProvider", - "Virtual": true, - "Abstract": true, - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ServicesRegisteredWithImplementationTypeCanBeResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ServicesRegisteredWithImplementationType_ReturnDifferentInstancesPerResolution_ForTransientServices", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ServicesRegisteredWithImplementationType_ReturnSameInstancesPerResolution_ForSingletons", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ServiceInstanceCanBeResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TransientServiceCanBeResolvedFromProvider", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "TransientServiceCanBeResolvedFromScope", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "SingleServiceCanBeIEnumerableResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "MultipleServiceCanBeIEnumerableResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RegistrationOrderIsPreservedWhenServicesAreIEnumerableResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "OuterServiceCanHaveOtherServicesInjected", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "FactoryServicesCanBeCreatedByGetService", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "FactoryServicesAreCreatedAsPartOfCreatingObjectGraph", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "LastServiceReplacesPreviousServices", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "SingletonServiceCanBeResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ServiceProviderRegistersServiceScopeFactory", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ScopedServiceCanBeResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "NestedScopedServiceCanBeResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ScopedServices_FromCachedScopeFactory_CanBeResolvedAndDisposed", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "DisposingScopeDisposesService", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "SelfResolveThenDispose", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "SafelyDisposeNestedProviderReferences", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "SingletonServicesComeFromRootProvider", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "NestedScopedServiceCanBeResolvedWithNoFallbackProvider", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "OpenGenericServicesCanBeResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ClosedServicesPreferredOverOpenGenericServices", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "AttemptingToResolveNonexistentServiceReturnsNull", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "NonexistentServiceCanBeIEnumerableResolved", - "Parameters": [], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_ServiceContainerPicksConstructorWithLongestMatchesData", - "Parameters": [], - "ReturnType": "Xunit.TheoryData", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ServiceContainerPicksConstructorWithLongestMatches", - "Parameters": [ - { - "Name": "serviceCollection", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - }, - { - "Name": "expected", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.TypeWithSupersetConstructors" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Protected", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.ClassWithOptionalArgsCtor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_Whatever", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_Whatever", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "whatever", - "Type": "System.String", - "DefaultValue": "\"BLARGH\"" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.AnotherClass", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_FakeService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "fakeService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.AnotherClassAcceptingData", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_FakeService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_One", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Two", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "fakeService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "one", - "Type": "System.String" - }, - { - "Name": "two", - "Type": "System.String" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithAmbiguousCtors", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_FakeService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Data1", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Data2", - "Parameters": [], - "ReturnType": "System.Int32", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "data", - "Type": "System.String" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "service", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "data", - "Type": "System.String" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "service", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "data", - "Type": "System.Int32" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "service", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "data1", - "Type": "System.String" - }, - { - "Name": "data2", - "Type": "System.Int32" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithNestedReferencesToProvider", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "System.IDisposable" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Dispose", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "System.IDisposable", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "serviceProvider", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithPrivateCtor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithProtectedConstructor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithStaticCtor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithThrowingCtor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "service", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ClassWithThrowingEmptyCtor", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.CreationCountFakeService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_InstanceCount", - "Parameters": [], - "ReturnType": "System.Int32", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_InstanceCount", - "Parameters": [ - { - "Name": "value", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Void", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_InstanceId", - "Parameters": [], - "ReturnType": "System.Int32", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "dependency", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Field", - "Name": "InstanceLock", - "Parameters": [], - "ReturnType": "System.Object", - "Static": true, - "ReadOnly": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOneMultipleService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" - ], - "Members": [ - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOpenGenericService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Value", - "Parameters": [], - "ReturnType": "T0", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "value", - "Type": "T0" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [ - { - "ParameterName": "TVal", - "ParameterPosition": 0, - "BaseTypeOrInterfaces": [] - } - ] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeOuterService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_SingleService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_MultipleServices", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IEnumerable", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "singleService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "multipleServices", - "Type": "System.Collections.Generic.IEnumerable" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeEveryService", - "System.IDisposable" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Value", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_Value", - "Parameters": [ - { - "Name": "value", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Disposed", - "Parameters": [], - "ReturnType": "System.Boolean", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Dispose", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "System.IDisposable", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.FakeTwoMultipleService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" - ], - "Members": [ - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_FakeService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Value", - "Parameters": [], - "ReturnType": "System.Int32", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeEveryService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService", - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService", - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeServiceInstance", - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeSingletonService", - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService" - ], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - ], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOpenGenericService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_Value", - "Parameters": [], - "ReturnType": "T0", - "GenericParameter": [] - } - ], - "GenericParameters": [ - { - "ParameterName": "TValue", - "ParameterPosition": 0, - "BaseTypeOrInterfaces": [] - } - ] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeOuterService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_SingleService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_MultipleServices", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IEnumerable", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - ], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeServiceInstance", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - ], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeSingletonService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - ], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.INonexistentService", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.PocoClass", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ScopedFactoryService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_FakeService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_FakeService", - "Parameters": [ - { - "Name": "value", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ServiceAcceptingFactoryService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_ScopedService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ScopedFactoryService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_TransientService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "scopedService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.ScopedFactoryService" - }, - { - "Name": "transientService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.TransientFactoryService", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_FakeService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_FakeService", - "Parameters": [ - { - "Name": "value", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Value", - "Parameters": [], - "ReturnType": "System.Int32", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_Value", - "Parameters": [ - { - "Name": "value", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.TypeWithSupersetConstructors", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_Service", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_FactoryService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_MultipleService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_ScopedService", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "factoryService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "fakeService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "fakeService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "factoryService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "fakeService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "multipleService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" - }, - { - "Name": "factoryService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "multipleService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeMultipleService" - }, - { - "Name": "factoryService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFactoryService" - }, - { - "Name": "fakeService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeService" - }, - { - "Name": "scopedService", - "Type": "Microsoft.Extensions.DependencyInjection.Specification.Fakes.IFakeScopedService" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+CreateInstanceFunc", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "BaseType": "System.MulticastDelegate", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Invoke", - "Parameters": [ - { - "Name": "provider", - "Type": "System.IServiceProvider" - }, - { - "Name": "type", - "Type": "System.Type" - }, - { - "Name": "args", - "Type": "System.Object[]" - } - ], - "ReturnType": "System.Object", - "Virtual": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "BeginInvoke", - "Parameters": [ - { - "Name": "provider", - "Type": "System.IServiceProvider" - }, - { - "Name": "type", - "Type": "System.Type" - }, - { - "Name": "args", - "Type": "System.Object[]" - }, - { - "Name": "callback", - "Type": "System.AsyncCallback" - }, - { - "Name": "object", - "Type": "System.Object" - } - ], - "ReturnType": "System.IAsyncResult", - "Virtual": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "EndInvoke", - "Parameters": [ - { - "Name": "result", - "Type": "System.IAsyncResult" - } - ], - "ReturnType": "System.Object", - "Virtual": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "object", - "Type": "System.Object" - }, - { - "Name": "method", - "Type": "System.IntPtr" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - } - ] -} \ No newline at end of file From 2adbe11e305822c7b40949a03ff3e3ddf65eabdf Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 31 Jan 2019 13:20:34 -0800 Subject: [PATCH 06/16] Remove implicit references for non-test projects (dotnet/Extensions#1037) Commit migrated from https://github.com/dotnet/Extensions/commit/e504b4ee74bba3a7df2be5612e8d509ad61b0c24 --- ...ions.DependencyInjection.Specification.Tests.csproj | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index ba8cbfd3f98dec..2eaa5498fca641 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -7,8 +7,8 @@ true dependencyinjection;di $(NoWarn);CS1591 + false - true @@ -17,6 +17,14 @@ + From 678640f69842d22be2415996e646f20dfc8aa77f Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 11 Feb 2019 12:10:15 -0800 Subject: [PATCH 07/16] Add reference assembly generations support (dotnet/Extensions#1093) Commit migrated from https://github.com/dotnet/Extensions/commit/8ad1395c9181c0f370ac8012760984541f557eee --- ...oft.Extensions.DependencyInjection.Specification.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index 2eaa5498fca641..2a5d3ad80c3e69 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -10,6 +10,7 @@ false true + false From d498fdf2c7e07328d2b2a5ae207d24947dea6b35 Mon Sep 17 00:00:00 2001 From: Eugene Sadovoi Date: Tue, 23 Apr 2019 02:35:19 -0400 Subject: [PATCH 08/16] Fixes aspnet/Extensionsdotnet/Extensions#1503 (dotnet/Extensions#1504) Commit migrated from https://github.com/dotnet/Extensions/commit/c3be53d2c8e78d388af8d47827fee604d9dcac59 --- .../Fakes/FakeDisposableCallbackOuterService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs index d400c122de081d..027dcb8e4cb36c 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs @@ -1,6 +1,7 @@ // 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.Linq; using System.Collections.Generic; namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes @@ -13,10 +14,10 @@ public FakeDisposableCallbackOuterService( FakeDisposeCallback callback) : base(callback) { SingleService = singleService; - MultipleServices = multipleServices; + MultipleServices = multipleServices.ToArray(); } public IFakeService SingleService { get; } public IEnumerable MultipleServices { get; } } -} \ No newline at end of file +} From c6690db8645f900871c5dd42afe41c3319796180 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Thu, 23 May 2019 16:33:55 -0700 Subject: [PATCH 09/16] Add support for source-build (dotnet/Extensions#1740) Commit migrated from https://github.com/dotnet/Extensions/commit/ad4067b012f62a70bb7378c3e0a029168f3eb106 --- ...oft.Extensions.DependencyInjection.Specification.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index 2a5d3ad80c3e69..d0532e13770c34 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -11,6 +11,7 @@ false true false + true From 3b86e56888b5f65827cd21eb13ae402d1dfa1026 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 12 Jun 2019 22:39:41 -0700 Subject: [PATCH 10/16] Use even more Arcade and other csproj cleanups (dotnet/Extensions#1833) * Use Arcade's convention for setting IsPackable (must be explicitly set) * Use Arcade conventions for using DebugType and eng/Versions.props * Remove dead code * Update restore feeds in daily builds.md * Disable UsingToolNetFrameworkReferenceAssemblies in analyzer tests * Remove usage of TestGroupName (an obsolete KoreBuild setting) * Use IVT as a .csproj attribute Commit migrated from https://github.com/dotnet/Extensions/commit/f12d709976e382672ce100bc00381a8847f06489 --- ...oft.Extensions.DependencyInjection.Specification.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index d0532e13770c34..ce391836d87367 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -9,6 +9,7 @@ $(NoWarn);CS1591 false + true true false true From ae0b649ec8d3dce01a641f74bd0e5a17b968b59e Mon Sep 17 00:00:00 2001 From: David Fowler Date: Wed, 28 Aug 2019 09:02:25 -0700 Subject: [PATCH 11/16] Added verification test for resolving singleton from scoped container. (dotnet/Extensions#2236) * Added verification test for resolving singleton from scoped container. * Skip failing test with the Unity container Commit migrated from https://github.com/dotnet/Extensions/commit/732d143b501650bf4dda655d13b81549d60ae83f --- .../DependencyInjectionSpecificationTests.cs | 32 +++++++++++++++++++ .../Fakes/ClassWithServiceProvider.cs | 16 ++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs index 4bfa9d3fb25475..164d78f2cb8d6f 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs @@ -122,6 +122,38 @@ public void TransientServiceCanBeResolvedFromScope() } } + [Fact] + public void SingletonServiceCanBeResolvedFromScope() + { + // Arrange + var collection = new TestServiceCollection(); + collection.AddSingleton(); + var provider = CreateServiceProvider(collection); + + // Act + IServiceProvider scopedSp1 = null; + IServiceProvider scopedSp2 = null; + ClassWithServiceProvider instance1 = null; + ClassWithServiceProvider instance2 = null; + + using (var scope1 = provider.CreateScope()) + { + scopedSp1 = scope1.ServiceProvider; + instance1 = scope1.ServiceProvider.GetRequiredService(); + } + + using (var scope2 = provider.CreateScope()) + { + scopedSp2 = scope2.ServiceProvider; + instance2 = scope2.ServiceProvider.GetRequiredService(); + } + + // Assert + Assert.Same(instance1.ServiceProvider, instance2.ServiceProvider); + Assert.NotSame(instance1.ServiceProvider, scopedSp1); + Assert.NotSame(instance2.ServiceProvider, scopedSp2); + } + [Fact] public void SingleServiceCanBeIEnumerableResolved() { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs new file mode 100644 index 00000000000000..f58d02273ea6b0 --- /dev/null +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes +{ + public class ClassWithServiceProvider + { + public ClassWithServiceProvider(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + } + + public IServiceProvider ServiceProvider { get; } + } +} From db6499aa457d7806badfb981387afdc5f9d0f4fd Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 26 Feb 2020 10:27:22 -0800 Subject: [PATCH 12/16] Normalize all file headers to the expected Apache 2.0 license Commit migrated from https://github.com/dotnet/Extensions/commit/cec6e75f0ce3145c76acd4c8a8c14093696a03ba --- .../DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs index f58d02273ea6b0..7e1e5ddd55c401 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs @@ -1,3 +1,6 @@ +// 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 System.Collections.Generic; using System.Text; From b27f9890311cdd8be810692c1fd911694d7fd5f5 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 26 Feb 2020 10:31:24 -0800 Subject: [PATCH 13/16] Switch file headers to the MIT license Commit migrated from https://github.com/dotnet/Extensions/commit/321a30c4d74b387db587d92f965391235fe33770 --- .../tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs | 5 +++-- .../DependencyInjectionSpecificationTests.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/AnotherClass.cs | 5 +++-- .../Fakes/AnotherClassAcceptingData.cs | 5 +++-- .../DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs | 5 +++-- .../Fakes/ClassWithAmbiguousCtorsAndAttribute.cs | 5 +++-- .../Fakes/ClassWithInternalConstructor.cs | 5 +++-- .../Fakes/ClassWithMultipleMarkedCtors.cs | 5 +++-- .../Fakes/ClassWithNestedReferencesToProvider.cs | 5 +++-- .../Fakes/ClassWithOptionalArgsCtor.cs | 5 +++-- .../Fakes/ClassWithOptionalArgsCtorWithStructs.cs | 5 +++-- .../DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs | 5 +++-- .../Fakes/ClassWithProtectedConstructor.cs | 5 +++-- .../DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs | 5 +++-- .../DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs | 5 +++-- .../DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs | 5 +++-- .../Fakes/ClassWithThrowingEmptyCtor.cs | 5 +++-- .../DI.Specification.Tests/Fakes/CreationCountFakeService.cs | 5 +++-- .../Fakes/FakeDisposableCallbackInnerService.cs | 5 +++-- .../Fakes/FakeDisposableCallbackOuterService.cs | 5 +++-- .../Fakes/FakeDisposableCallbackService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/FakeDisposeCallback.cs | 5 +++-- .../DI.Specification.Tests/Fakes/FakeOneMultipleService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/FakeOpenGenericService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/FakeOuterService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/FakeService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/IFactoryService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/IFakeMultipleService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/IFakeService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/IFakeServiceInstance.cs | 5 +++-- .../DI.Specification.Tests/Fakes/IFakeSingletonService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/INonexistentService.cs | 5 +++-- .../tests/DI.Specification.Tests/Fakes/PocoClass.cs | 5 +++-- .../DI.Specification.Tests/Fakes/ScopedFactoryService.cs | 5 +++-- .../Fakes/ServiceAcceptingFactoryService.cs | 5 +++-- .../DI.Specification.Tests/Fakes/TransientFactoryService.cs | 5 +++-- .../Fakes/TypeWithSupersetConstructors.cs | 5 +++-- .../tests/DI.Specification.Tests/ServiceCollection.cs | 5 +++-- 43 files changed, 129 insertions(+), 86 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs index 8ee67cbbc551a2..d653a671f1ce91 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ActivatorUtilitiesTests.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs index 164d78f2cb8d6f..beed0c8661e4b8 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/DependencyInjectionSpecificationTests.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; using System.Collections; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs index 7b66b0a895ed0a..40a92237bfbe6f 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClass.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs index 6eb8982254a3ed..4f9dcda0ae303a 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/AnotherClassAcceptingData.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs index 9f0e97891502cf..55ec934be20b42 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtors.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs index 65b2494b80ce7c..b0e7d2284cdedf 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs index 269ce44d6b28d3..220d3e86d39b20 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithInternalConstructor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs index af364fb4f09c4a..9cb04aafd63a6f 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithMultipleMarkedCtors.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs index 1b5b5fd075146d..1813db134fa962 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithNestedReferencesToProvider.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs index 52506279d57067..810804bafccc76 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs index f39d546cf48c09..d0b2588211e461 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithOptionalArgsCtorWithStructs.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs index 74ef1329ffa24c..f0ef2a678c7377 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithPrivateCtor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs index 8834c3141cacf1..d3098dcd09b6c5 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithProtectedConstructor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs index 7e1e5ddd55c401..1003e9976580ae 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithServiceProvider.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs index 1b427ef9294c4d..ebd631b17e9ddb 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithStaticCtor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs index 4f9fe3ca36dc52..575d18117113b9 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingCtor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs index bd1b9ac7563106..9ecc4b233244bb 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ClassWithThrowingEmptyCtor.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs index 9be98289e9b62d..8c9a21912b051e 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/CreationCountFakeService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs index c8581330cf7f55..2acc2204591536 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackInnerService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs index 027dcb8e4cb36c..7ef95a854b051b 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackOuterService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System.Linq; using System.Collections.Generic; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs index 53e095793c75fb..5f29aa01ed1c15 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposableCallbackService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs index 4fab8d63528bd5..8d0ca9f446f605 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeDisposeCallback.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System.Collections.Generic; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs index 81c0445471ddfa..a5d3cd1451c224 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOneMultipleService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs index 564c758fa563f0..c2be6bc4c1b43b 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOpenGenericService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs index e5d3c3017ae38e..667f911557e8b1 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeOuterService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System.Collections.Generic; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs index 1bedc0a2fcdb5c..3fccf3de00b37d 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs index d31711d2434e5a..89fcab70108407 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/FakeTwoMultipleService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs index 6e9e60c9be1541..ddbc44f20fb79e 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFactoryService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs index b044fc69eb204e..9e24521a65ab5a 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeEveryService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs index 07a61cfbe50800..a38394c665f870 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeMultipleService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs index bc4b7f051eae69..12dc7142557384 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOpenGenericService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs index 02ba79477f99cb..f4bd3e3a2dae27 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeOuterService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System.Collections.Generic; diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs index 2da71c1852914c..9f3f4f000df1aa 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeScopedService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs index 1737ac6c1eb481..391bf2edf3d4a7 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs index da58e46f7e1d36..e6ed4019e37bbd 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeServiceInstance.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs index 1fd5db82fbe8a3..3f341ce204de4e 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/IFakeSingletonService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs index b91fb36088cefe..54661e3cd970cd 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/INonexistentService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs index 17e6e10b9ecb06..75bd28ae9f745c 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/PocoClass.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs index 79c3f197224b28..298ad076c1adb1 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ScopedFactoryService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs index b3d6aaa4320719..c016eaeeca7cfe 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/ServiceAcceptingFactoryService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs index b74377011638b7..1915f3fda0a385 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TransientFactoryService.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs index 009cd1a01cf83a..c378883701547b 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Fakes/TypeWithSupersetConstructors.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs index c3b120c1cac032..b4501e76319e92 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/ServiceCollection.cs @@ -1,5 +1,6 @@ -// 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. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. using System.Collections.Generic; From 7f4ec6a406659e8dd8eb8d68cd7007253d10ca39 Mon Sep 17 00:00:00 2001 From: Maryam Ariyan Date: Tue, 17 Mar 2020 16:01:42 -0700 Subject: [PATCH 14/16] Update src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj Co-Authored-By: Eric StJohn --- ...ft.Extensions.DependencyInjection.Specification.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index ce391836d87367..b993165a0f8289 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -2,7 +2,7 @@ Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection. - netstandard2.0 + $(NetCoreAppCurrent);$(NetFrameworkCurrent) Microsoft.Extensions.DependencyInjection.Specification true dependencyinjection;di From 03bedd8cde79b523bedab2a855ab9697226fa09c Mon Sep 17 00:00:00 2001 From: Maryam Ariyan Date: Wed, 18 Mar 2020 13:51:09 -0700 Subject: [PATCH 15/16] Update src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj Co-Authored-By: Eric StJohn --- ...s.DependencyInjection.Specification.Tests.csproj | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj index b993165a0f8289..2bfca2762efc69 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj @@ -18,17 +18,4 @@ - - - - - - From a2e87f1f9ca62395e9230c5fcab816a15c2df063 Mon Sep 17 00:00:00 2001 From: Maryam Ariyan Date: Wed, 18 Mar 2020 15:03:24 -0700 Subject: [PATCH 16/16] Remove DI.Specification csproj --- ...ndencyInjection.Specification.Tests.csproj | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj deleted file mode 100644 index 2bfca2762efc69..00000000000000 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Specification.Tests/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection. - $(NetCoreAppCurrent);$(NetFrameworkCurrent) - Microsoft.Extensions.DependencyInjection.Specification - true - dependencyinjection;di - $(NoWarn);CS1591 - - false - true - true - false - true - - - - - -