53 references to AutoActivationExtensions
Microsoft.Extensions.DependencyInjection.AutoActivation.Tests (53)
AutoActivationExtensionsKeyedTests.cs (26)
19Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton<IFakeService, FakeService>(null!, null, (_, _) => null!));
20Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton<IFakeService, FakeService>(serviceCollection, null, null!));
22Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton<FakeService>(null!, null, (_, _) => null!));
23Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton<FakeService>(serviceCollection, null, null!));
25Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton<FakeService>(null!, null));
27Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(null!, typeof(FakeService), null));
28Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(serviceCollection, null!, null));
30Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton<IFakeService, FakeService>(null!, null));
32Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(null!, typeof(FakeService), null, (_, _) => null!));
33Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(serviceCollection, null!, null, (_, _) => null!));
34Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(serviceCollection, typeof(FakeService), null, implementationFactory: null!));
36Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(null!, typeof(IFakeService), null, typeof(FakeService)));
37Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(serviceCollection, null!, null, typeof(FakeService)));
38Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedKeyedSingleton(serviceCollection, typeof(IFakeService), null, implementationType: null!));
45Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(null!, typeof(FakeService), null));
46Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(serviceCollection, null!, null));
48Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(null!, typeof(IFakeService), null, typeof(FakeService)));
49Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(serviceCollection, null!, null, typeof(FakeService)));
50Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(serviceCollection, typeof(IFakeService), null, implementationType: null!));
52Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(null!, typeof(FakeService), null, (_, _) => null!));
53Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(serviceCollection, null!, null, (_, _) => null!));
54Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton(serviceCollection, typeof(FakeService), null, implementationFactory: null!));
56Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton<FakeService>(null!, null));
58Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton<IFakeService, FakeService>(null!, null));
60Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton<FakeService>(null!, null, (_, _) => null!));
61Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedKeyedSingleton<FakeService>(serviceCollection, null, null!));
AutoActivationExtensionsTests.cs (27)
18Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.ActivateSingleton<IFakeService>(null!));
25Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton<IFakeService, FakeService>(null!, _ => null!));
26Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton<IFakeService, FakeService>(serviceCollection, null!));
28Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton<FakeService>(null!, _ => null!));
29Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton<FakeService>(serviceCollection, null!));
31Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton<FakeService>(null!));
33Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(null!, typeof(FakeService)));
34Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(serviceCollection, null!));
36Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton<IFakeService, FakeService>(null!));
38Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(null!, typeof(FakeService), _ => null!));
39Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(serviceCollection, null!, _ => null!));
40Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(serviceCollection, typeof(FakeService), implementationFactory: null!));
42Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(null!, typeof(IFakeService), typeof(FakeService)));
43Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(serviceCollection, null!, typeof(FakeService)));
44Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.AddActivatedSingleton(serviceCollection, typeof(IFakeService), implementationType: null!));
51Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(null!, typeof(FakeService)));
52Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(serviceCollection, null!));
54Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(null!, typeof(IFakeService), typeof(FakeService)));
55Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(serviceCollection, null!, typeof(FakeService)));
56Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(serviceCollection, typeof(IFakeService), implementationType: null!));
58Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(null!, typeof(FakeService), _ => null!));
59Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(serviceCollection, null!, _ => null!));
60Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton(serviceCollection, typeof(FakeService), implementationFactory: null!));
62Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton<FakeService>(null!));
64Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton<IFakeService, FakeService>(null!));
66Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton<FakeService>(null!, _ => null!));
67Assert.Throws<ArgumentNullException>(() => AutoActivationExtensions.TryAddActivatedSingleton<FakeService>(serviceCollection, null!));