1048 references to AddSingleton
ApiExplorerWebSite (1)
Startup.cs (1)
34services.AddSingleton(wellKnownChangeToken);
Aspire.Azure.Messaging.EventHubs.Tests (1)
AspireEventHubsExtensionsTests.cs (1)
67services.AddSingleton(blobClient);
Aspire.Dashboard.Components.Tests (22)
Controls\ApplicationNameTests.cs (4)
21Services.AddSingleton<IConfiguration>(new ConfigurationManager()); 22Services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance); 39Services.AddSingleton<IConfiguration>(new ConfigurationManager()); 40Services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Controls\TextVisualizerDialogTests.cs (1)
149Services.AddSingleton(themeManager);
GridColumnManagerTests.cs (3)
19Services.AddSingleton<DimensionManager>(dimensionManager); 47Services.AddSingleton<DimensionManager>(dimensionManager); 84Services.AddSingleton<DimensionManager>(dimensionManager);
Layout\MainLayoutTests.cs (2)
132Services.AddSingleton<ILocalStorage>(localStorage ?? new TestLocalStorage()); 136Services.AddSingleton<IMessageService>(messageService ?? new MessageService());
Pages\ConsoleLogsTests.cs (3)
162Services.AddSingleton<ILoggerFactory>(loggerFactory); 165Services.AddSingleton<IOptions<DashboardOptions>>(Options.Create(new DashboardOptions())); 173Services.AddSingleton<IDashboardClient>(dashboardClient ?? new TestDashboardClient());
Pages\StructuredLogsTests.cs (2)
178Services.AddSingleton<IOptions<DashboardOptions>>(Options.Create(new DashboardOptions())); 180Services.AddSingleton<ILogger<StructuredLogs>>(NullLogger<StructuredLogs>.Instance);
Pages\TraceDetailsTests.cs (2)
112Services.AddSingleton<IOptions<DashboardOptions>>(Options.Create(new DashboardOptions())); 114Services.AddSingleton<ILogger<StructuredLogs>>(NullLogger<StructuredLogs>.Instance);
Shared\MetricsSetupHelpers.cs (2)
77context.Services.AddSingleton<IOptions<DashboardOptions>>(Options.Create(new DashboardOptions())); 81context.Services.AddSingleton<ISessionStorage>(sessionStorage ?? new TestSessionStorage());
tests\Shared\Logging\XunitLoggerFactoryExtensions.cs (3)
15builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output)); 21builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel)); 27builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
Aspire.Dashboard.Tests (5)
Integration\DashboardClientAuthTests.cs (1)
80serverAppBuilder.Services.AddSingleton(loggerFactory);
Integration\IntegrationTestHelpers.cs (1)
99builder.Services.AddSingleton(loggerFactory);
tests\Shared\Logging\XunitLoggerFactoryExtensions.cs (3)
15builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output)); 21builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel)); 27builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
Aspire.Hosting (12)
Dashboard\DashboardServiceHost.cs (7)
76builder.Services.AddSingleton(configuration); 105builder.Services.AddSingleton(loggerFactory); 106builder.Services.AddSingleton(loggerOptions); 110builder.Services.AddSingleton(applicationModel); 111builder.Services.AddSingleton(commandExecutor); 113builder.Services.AddSingleton(resourceNotificationService); 114builder.Services.AddSingleton(resourceLoggerService);
DistributedApplicationBuilder.cs (5)
135_innerBuilder.Services.AddSingleton(TimeProvider.System); 204_innerBuilder.Services.AddSingleton(options); 207_innerBuilder.Services.AddSingleton<IDistributedApplicationEventing>(Eventing); 288_innerBuilder.Services.AddSingleton(new Locations()); 311_innerBuilder.Services.AddSingleton(ExecutionContext);
Aspire.Hosting.Testing.Tests (3)
tests\Shared\Logging\XunitLoggerFactoryExtensions.cs (3)
15builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output)); 21builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel)); 27builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
Aspire.Hosting.Tests (4)
Health\ResourceHealthCheckServiceTests.cs (1)
138builder.Services.AddSingleton<TimeProvider>(timeProvider);
tests\Shared\Logging\XunitLoggerFactoryExtensions.cs (3)
15builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output)); 21builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel)); 27builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
Aspire.Playground.Tests (3)
tests\Shared\Logging\XunitLoggerFactoryExtensions.cs (3)
15builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output)); 21builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel)); 27builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
BasicTestApp (1)
Program.cs (1)
34builder.Services.AddSingleton(new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
BasicWebSite (1)
StartupWithoutEndpointRouting.cs (1)
20services.AddSingleton(new TestService { Message = "true" });
ClientSample (1)
Tcp\TcpHubConnectionBuilderExtensions.cs (1)
41builder.Services.AddSingleton(endPoint);
DaprServiceC (1)
Program.cs (1)
12builder.Services.AddSingleton<DaprClient>(dapr);
GenericHostWebSite (1)
Startup.cs (1)
14services.AddSingleton(new TestGenericService { Message = "true" });
HostFilteringSample (1)
Startup.cs (1)
37services.AddSingleton<IOptionsChangeTokenSource<HostFilteringOptions>>(new ConfigurationChangeTokenSource<HostFilteringOptions>(Config));
IIS.Tests (1)
Utilities\TestServer.cs (1)
160services.AddSingleton(_loggerFactory);
InMemory.FunctionalTests (13)
HttpsConnectionMiddlewareTests.cs (1)
44.AddSingleton(env.Object)
HttpsTests.cs (7)
41.AddSingleton(Mock.Of<IHostEnvironment>()) 453services.AddSingleton<IMultiplexedConnectionListenerFactory>(multiplexedConnectionListenerFactory); 497services.AddSingleton<IMultiplexedConnectionListenerFactory>(multiplexedConnectionListenerFactory); 537services.AddSingleton<IMultiplexedConnectionListenerFactory>(multiplexedConnectionListenerFactory); 573services.AddSingleton<IMultiplexedConnectionListenerFactory>(multiplexedConnectionListenerFactory); 612services.AddSingleton<IMultiplexedConnectionListenerFactory>(multiplexedConnectionListenerFactory); 662services.AddSingleton<IMultiplexedConnectionListenerFactory>(multiplexedConnectionListenerFactory);
ResponseTests.cs (3)
4418services.AddSingleton<IMultiplexedConnectionListenerFactory>(new MockMultiplexedConnectionListenerFactory()); 4517services.AddSingleton<IMultiplexedConnectionListenerFactory>(new MockMultiplexedConnectionListenerFactory()); 4697services => services.AddSingleton(mockHttpContextFactory.Object)))
TestTransport\TestServer.cs (2)
88services.AddSingleton<IStartup>(this); 89services.AddSingleton(context.LoggerFactory);
Microsoft.AspNetCore (1)
WebHost.cs (1)
265services.AddSingleton<IOptionsChangeTokenSource<HostFilteringOptions>>(
Microsoft.AspNetCore.Antiforgery.Test (6)
AntiforgeryApplicationBuilderExtensionsTest.cs (1)
55services.AddSingleton(antiforgeryService);
DefaultAntiforgeryTest.cs (5)
354services.AddSingleton(loggerFactory.Object); 1285services.AddSingleton(loggerFactory.Object); 1323services.AddSingleton(loggerFactory.Object); 1357services.AddSingleton(loggerFactory.Object); 1404builder.AddSingleton<ILoggerFactory>(new LoggerFactory());
Microsoft.AspNetCore.Authentication.Core.Test (1)
AuthenticationServiceTests.cs (1)
35.AddSingleton<IClaimsTransformation>(transform)
Microsoft.AspNetCore.Authentication.Negotiate.Test (1)
ServerDeferralTests.cs (1)
52services.AddSingleton<IServerIntegratedAuth>(new ServerIntegratedAuth()
Microsoft.AspNetCore.Authentication.Test (65)
AuthenticationMiddlewareTests.cs (2)
209serviceCollection.AddSingleton(authenticationService); 213serviceCollection.AddSingleton<IConfiguration>(new ConfigurationManager());
CertificateTests.cs (1)
881services.AddSingleton<ICertificateValidationCache>(new CertificateValidationCache(Options.Create(new CertificateValidationCacheOptions()), timeProvider));
JwtBearerTests_Handler.cs (1)
1001services.AddSingleton<IConfiguration>(config);
OpenIdConnect\OpenIdConnectConfigurationTests.cs (20)
44services.AddSingleton(forwardDefault); 89services.AddSingleton(specific); 91services.AddSingleton(forwardDefault); 118services.AddSingleton(specific); 120services.AddSingleton(forwardDefault); 158services.AddSingleton(specific); 160services.AddSingleton(forwardDefault); 198services.AddSingleton(specific); 200services.AddSingleton(forwardDefault); 238services.AddSingleton(specific); 240services.AddSingleton(forwardDefault); 279services.AddSingleton(specific); 281services.AddSingleton(forwardDefault); 283services.AddSingleton(selector); 334services.AddSingleton(specific); 336services.AddSingleton(forwardDefault); 338services.AddSingleton(selector); 394services.AddSingleton(specific); 396services.AddSingleton(forwardDefault); 398services.AddSingleton(selector);
OpenIdConnect\OpenIdConnectTests.cs (5)
435services.AddSingleton<IConfiguration>(config); 468services.AddSingleton<IConfiguration>(config); 503services.AddSingleton<IConfiguration>(config); 526services.AddSingleton<IConfiguration>(config); 551services.AddSingleton<IConfiguration>(config);
PolicyTests.cs (10)
70services.AddSingleton(handler1); 72services.AddSingleton(handler2); 126services.AddSingleton(handler1); 128services.AddSingleton(handler2); 187services.AddSingleton(handler1); 189services.AddSingleton(handler2); 239services.AddSingleton(handler1); 241services.AddSingleton(handler2); 296services.AddSingleton(handler1); 298services.AddSingleton(handler2);
RemoteAuthenticationTests.cs (1)
22s.AddSingleton<IConfiguration>(new ConfigurationManager());
SharedAuthenticationTests.cs (23)
39services.AddSingleton(forwardDefault); 101services.AddSingleton(specific); 103services.AddSingleton(forwardDefault); 143services.AddSingleton(specific); 145services.AddSingleton(forwardDefault); 183services.AddSingleton(specific); 185services.AddSingleton(forwardDefault); 220var builder = services.AddSingleton<IClaimsTransformation>(transform).AddAuthentication(o => 233services.AddSingleton(specific); 235services.AddSingleton(forwardDefault); 262services.AddSingleton(specific); 264services.AddSingleton(forwardDefault); 301services.AddSingleton(specific); 303services.AddSingleton(forwardDefault); 341services.AddSingleton(specific); 343services.AddSingleton(forwardDefault); 345services.AddSingleton(selector); 410services.AddSingleton(specific); 412services.AddSingleton(forwardDefault); 414services.AddSingleton(selector); 484services.AddSingleton(specific); 486services.AddSingleton(forwardDefault); 488services.AddSingleton(selector);
WsFederation\WsFederationTest.cs (1)
30services.AddSingleton<IConfiguration>(new ConfigurationManager());
WsFederation\WsFederationTest_Handler.cs (1)
28services.AddSingleton<IConfiguration>(new ConfigurationManager());
Microsoft.AspNetCore.Authorization.Test (20)
AuthorizationAppBuilderExtensionsTests.cs (1)
71services.AddSingleton(authenticationService);
AuthorizationMiddlewareTests.cs (5)
253.AddSingleton(CreateDataSource(endpoint)).BuildServiceProvider(); 293.AddSingleton(policyProvider.Object) 295.AddSingleton(CreateDataSource(endpoint)).BuildServiceProvider(); 362.AddSingleton(CreateDataSource(endpoint)).BuildServiceProvider(); 1037serviceCollection.AddSingleton(authenticationService);
DefaultAuthorizationServiceTests.cs (12)
101services.AddSingleton<IAuthorizationHandler>(handler1); 102services.AddSingleton<IAuthorizationHandler>(handler2); 126services.AddSingleton<IAuthorizationHandler>(handler1); 127services.AddSingleton<IAuthorizationHandler>(handler2); 178services.AddSingleton<IAuthorizationHandler>(handler1); 179services.AddSingleton<IAuthorizationHandler>(handler2); 180services.AddSingleton<IAuthorizationHandler>(handler3); 845services.AddSingleton<IAuthorizationHandler>(new ExpenseReportAuthorizationHandler(new OperationAuthorizationRequirement[] { Operations.Edit })); 931services.AddSingleton<IAuthorizationHandler>(new ExpenseReportAuthorizationHandler(new OperationAuthorizationRequirement[] { Operations.Edit })); 948services.AddSingleton<IAuthorizationHandler>(new ExpenseReportAuthorizationHandler(new OperationAuthorizationRequirement[] { Operations.Edit })); 1200services.AddSingleton<ILogger<DefaultAuthorizationService>>(new DefaultAuthorizationServiceTestLogger(Assertion)); 1234services.AddSingleton<ILogger<DefaultAuthorizationService>>(new DefaultAuthorizationServiceTestLogger(Assertion));
PassThroughAuthorizationHandlerTests.cs (1)
37services.AddSingleton<IAuthorizationHandler>(afterHandler);
PolicyEvaluatorTests.cs (1)
55var services = new ServiceCollection().AddSingleton<IAuthenticationService>(auth);
Microsoft.AspNetCore.Components.Authorization.Tests (7)
AuthorizeRouteViewTest.cs (2)
31serviceCollection.AddSingleton<AuthenticationStateProvider>(_authenticationStateProvider); 33serviceCollection.AddSingleton<IAuthorizationService>(_testAuthorizationService);
AuthorizeViewTest.cs (2)
567serviceCollection.AddSingleton(authorizationService); 568serviceCollection.AddSingleton<IAuthorizationPolicyProvider>(new TestAuthorizationPolicyProvider());
CascadingAuthenticationStateTest.cs (3)
41services.AddSingleton<AuthenticationStateProvider>(authStateProvider); 74services.AddSingleton<AuthenticationStateProvider>(authStateProvider); 126services.AddSingleton<AuthenticationStateProvider>(authStateProvider);
Microsoft.AspNetCore.Components.Endpoints.Tests (12)
Builder\RazorComponentsEndpointConventionBuilderExtensionsTest.cs (2)
274collection.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 275collection.AddSingleton<IWebHostEnvironment>(new TestWebHostEnvironment());
EndpointHtmlRendererTest.cs (1)
1669services.AddSingleton(_dataprotectorProvider);
ImportMapTest.cs (1)
23services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RazorComponentEndpointInvokerTest.cs (2)
23.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()) 24.AddSingleton<IWebHostEnvironment>(new TestWebHostEnvironment())
RazorComponentResultTest.cs (2)
457.AddSingleton(new DiagnosticListener("test")) 458.AddSingleton<IWebHostEnvironment>(mockWebHostEnvironment)
RazorComponentsServiceCollectionExtensionsTest.cs (4)
20services.AddSingleton<IConfiguration>(new ConfigurationBuilder().AddInMemoryCollection().Build()); 21services.AddSingleton<IWebHostEnvironment>(new TestWebHostEnvironment()); 47services.AddSingleton<IConfiguration>(new ConfigurationBuilder().AddInMemoryCollection().Build()); 48services.AddSingleton<IWebHostEnvironment>(new TestWebHostEnvironment());
Microsoft.AspNetCore.Components.Server.Tests (7)
Circuits\CircuitHostTest.cs (1)
645serviceCollection.AddSingleton(new Mock<IJSRuntime>().Object);
Circuits\RemoteRendererTest.cs (1)
640serviceCollection.AddSingleton(new Mock<IJSRuntime>().Object);
ComponentEndpointRouteBuilderExtensionsTest.cs (5)
131services.AddSingleton(Mock.Of<IHostApplicationLifetime>()); 135services.AddSingleton(listener); 136services.AddSingleton<DiagnosticSource>(listener); 140services.AddSingleton(environment.Object); 141services.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
Microsoft.AspNetCore.Components.Tests (3)
RouteViewTest.cs (1)
22serviceCollection.AddSingleton<NavigationManager>(_navigationManager);
Routing\RouterTest.cs (2)
23services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance); 24services.AddSingleton<NavigationManager>(_navigationManager);
Microsoft.AspNetCore.Components.Web.Tests (43)
HtmlRendering\HtmlRendererTest.cs (43)
24var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(_ => { }))); 37var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(_ => { }))); 50var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 72var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 95var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 118var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 141var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 172var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 198var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 223var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 246var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 269var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 298var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 333var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 374var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 399var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 424var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 448var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 472var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 496var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 519var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 549var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 586var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 617var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 658var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new Func<ParameterView, RenderFragment>(Content))); 683var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 711var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 838var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(builder => 866var services = GetServiceProvider(collection =>collection.AddSingleton(new AsyncLoadingComponentCompletion { Task = completionTcs.Task })); 888var services = GetServiceProvider(collection => collection.AddSingleton(new AsyncLoadingComponentCompletion { Task = new TaskCompletionSource().Task })); 910var services = GetServiceProvider(collection => collection.AddSingleton(new AsyncLoadingComponentCompletion { Task = Task.Delay(0) })); 929var services = GetServiceProvider(collection => collection.AddSingleton(new AsyncLoadingComponentCompletion { Task = new TaskCompletionSource().Task })); 951var services = GetServiceProvider(collection => collection.AddSingleton(new AsyncLoadingComponentCompletion { Task = completionTcs.Task })); 987var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1016var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1039var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1062var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1069.AddSingleton<IFormValueMapper>(formValueMapper)); 1086var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1124var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1145var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1167var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb => 1189var serviceProvider = GetServiceProvider(collection => collection.AddSingleton(new RenderFragment(rtb =>
Microsoft.AspNetCore.Components.WebAssembly (8)
Hosting\WebAssemblyHostBuilder.cs (8)
177Services.AddSingleton<IWebAssemblyHostEnvironment>(hostEnvironment); 286Services.AddSingleton<IConfiguration>(Configuration); 299Services.AddSingleton<IJSRuntime>(DefaultWebAssemblyJSRuntime.Instance); 300Services.AddSingleton<NavigationManager>(WebAssemblyNavigationManager.Instance); 301Services.AddSingleton<INavigationInterception>(WebAssemblyNavigationInterception.Instance); 302Services.AddSingleton<IScrollToLocationHash>(WebAssemblyScrollToLocationHash.Instance); 303Services.AddSingleton<IInternalJSImportMethods>(_jsMethods); 304Services.AddSingleton(new LazyAssemblyLoader(DefaultWebAssemblyJSRuntime.Instance));
Microsoft.AspNetCore.Components.WebAssembly.Tests (3)
Hosting\WebAssemblyHostTest.cs (3)
22builder.Services.AddSingleton(Mock.Of<IJSRuntime>()); 42builder.Services.AddSingleton(Mock.Of<IJSRuntime>()); 64builder.Services.AddSingleton(Mock.Of<IJSRuntime>());
Microsoft.AspNetCore.DataProtection.Tests (20)
ActivatorTests.cs (1)
73serviceCollection.AddSingleton<IActivator>(expectedActivator);
DataProtectionUtilityExtensionsTests.cs (4)
34.AddSingleton(mockEnvironment.Object) 65.AddSingleton(mockEnvironment.Object) 92.AddSingleton(mockEnvironment.Object) 93.AddSingleton(mockAppDiscriminator.Object)
HostingTests.cs (3)
34.AddSingleton<IServer>( 60.AddSingleton<IServer>( 89.AddSingleton(mockServer.Object))
KeyManagement\KeyEscrowServiceProviderExtensionsTests.cs (3)
43serviceCollection.AddSingleton<IKeyEscrowSink>(mockKeyEscrowSink.Object); 75serviceCollection.AddSingleton<IKeyEscrowSink>(mockKeyEscrowSink1.Object); 76serviceCollection.AddSingleton<IKeyEscrowSink>(mockKeyEscrowSink2.Object);
ServiceCollectionTests.cs (3)
83.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 115.AddSingleton<IConfiguration>(config) 116.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
XmlEncryption\CertificateXmlEncryptionTests.cs (1)
39serviceCollection.AddSingleton<IInternalEncryptedXmlDecryptor>(mockInternalDecryptor.Object);
XmlEncryption\XmlEncryptionExtensionsTests.cs (5)
41serviceCollection.AddSingleton<IActivator>(mockActivator.Object); 68serviceCollection.AddSingleton<IActivator>(mockActivator.Object); 102serviceCollection.AddSingleton<IActivator>(mockActivator.Object); 134serviceCollection.AddSingleton<IActivator>(mockActivator.Object); 185serviceCollection.AddSingleton<IActivator>(mockActivator.Object);
Microsoft.AspNetCore.Diagnostics.Tests (10)
DeveloperExceptionPageMiddlewareTest.cs (2)
584s.AddSingleton<IMeterFactory>(meterFactory); 585s.AddSingleton(LoggerFactory);
ExceptionHandlerMiddlewareTest.cs (4)
311s.AddSingleton<IMeterFactory>(meterFactory); 312s.AddSingleton(LoggerFactory); 374s.AddSingleton<IMeterFactory>(meterFactory); 375s.AddSingleton(LoggerFactory);
ExceptionHandlerTest.cs (4)
618services.AddSingleton<ILoggerFactory>(loggerFactory); 1000s.AddSingleton<IMeterFactory>(meterFactory); 1054s.AddSingleton<IMeterFactory>(meterFactory); 1124s.AddSingleton<IMeterFactory>(meterFactory);
Microsoft.AspNetCore.HeaderParsing.Tests (1)
HeaderParsingExtensionsTests.cs (1)
87var context = CreateContext(new ServiceCollection().AddSingleton(headerRegistry.Object));
Microsoft.AspNetCore.HostFiltering.Tests (1)
HostFilteringMiddlewareTests.cs (1)
242services.AddSingleton<IOptionsChangeTokenSource<HostFilteringOptions>>(new ConfigurationChangeTokenSource<HostFilteringOptions>(config));
Microsoft.AspNetCore.Hosting (10)
GenericHost\GenericWebHostBuilder.cs (2)
58services.AddSingleton(webhostContext.HostingEnvironment); 60services.AddSingleton((AspNetCore.Hosting.IHostingEnvironment)webhostContext.HostingEnvironment);
GenericHost\SlimWebHostBuilder.cs (2)
34services.AddSingleton(webhostContext.HostingEnvironment); 36services.AddSingleton((AspNetCore.Hosting.IHostingEnvironment)webhostContext.HostingEnvironment);
WebHostBuilder.cs (6)
266services.AddSingleton(_options); 267services.AddSingleton<IWebHostEnvironment>(_hostingEnvironment); 268services.AddSingleton<IHostEnvironment>(_hostingEnvironment); 270services.AddSingleton<AspNetCore.Hosting.IHostingEnvironment>(_hostingEnvironment); 271services.AddSingleton<Extensions.Hosting.IHostingEnvironment>(_hostingEnvironment); 273services.AddSingleton(_context);
Microsoft.AspNetCore.Hosting.Abstractions (1)
HostingAbstractionsWebHostBuilderExtensions.cs (1)
76services.AddSingleton(server);
Microsoft.AspNetCore.Hosting.Tests (30)
Fakes\StartupWithILoggerFactory.cs (1)
23collection.AddSingleton(this);
StartupManagerTests.cs (19)
22serviceCollection.AddSingleton<IStartupConfigureServicesFilter>(new TestStartupServicesFilter(1, overrideAfterService: true)); 23serviceCollection.AddSingleton<IStartupConfigureServicesFilter>(new TestStartupServicesFilter(2, overrideAfterService: true)); 44serviceCollection.AddSingleton<IStartupConfigureServicesFilter>(new TestStartupServicesFilter(1, overrideAfterService: false)); 45serviceCollection.AddSingleton<IStartupConfigureServicesFilter>(new TestStartupServicesFilter(2, overrideAfterService: true)); 66serviceCollection.AddSingleton<IStartupConfigureServicesFilter>(new TestStartupServicesFilter(1, overrideAfterService: false)); 90serviceCollection.AddSingleton<IStartupConfigureContainerFilter<MyContainer>>(new TestConfigureContainerFilter(1, overrideAfterService: true)); 91serviceCollection.AddSingleton<IStartupConfigureContainerFilter<MyContainer>>(new TestConfigureContainerFilter(2, overrideAfterService: true)); 112serviceCollection.AddSingleton<IStartupConfigureContainerFilter<MyContainer>>(new TestConfigureContainerFilter(1, overrideAfterService: false)); 113serviceCollection.AddSingleton<IStartupConfigureContainerFilter<MyContainer>>(new TestConfigureContainerFilter(2, overrideAfterService: true)); 134serviceCollection.AddSingleton<IStartupConfigureServicesFilter>(new TestStartupServicesFilter(1, overrideAfterService: false)); 135serviceCollection.AddSingleton<IStartupConfigureContainerFilter<MyContainer>>(new TestConfigureContainerFilter(2, overrideAfterService: true)); 206services.Services.AddSingleton(new ServiceAfter { Message = $"ConfigureContainerFilter After {AdditionalData}" }); 255services.AddSingleton(new ServiceAfter { Message = $"StartupServicesFilter After {AdditionalData}" }); 294serviceCollection.AddSingleton<IFakeStartupCallback>(callbackStartup); 311serviceCollection.AddSingleton<IServiceProviderFactory<IServiceCollection>>(new DefaultServiceProviderFactory(new ServiceProviderOptions 364serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback()); 411serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback()); 425serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback()); 440serviceCollection.AddSingleton<IFakeStartupCallback>(new FakeStartupCallback());
WebHostBuilderTests.cs (4)
875.ConfigureServices(collection => collection.AddSingleton<ILoggerFactory>(factory)) 981services.AddSingleton<IServiceProviderFactory<IServiceCollection>>(containerFactory); 1651services.AddSingleton(this); 1693.ConfigureServices(services => services.AddSingleton<ITestSink>(loggerProvider.Sink))
WebHostTests.cs (6)
216services.AddSingleton(server.Object); 255services.AddSingleton(server.Object); 291services.AddSingleton(server.Object); 1050services.AddSingleton(server.Object); 1069services.AddSingleton(server.Object); 1125services.AddSingleton<IHostedService>(new DelegateHostedService(started, stopping, () => { }));
Microsoft.AspNetCore.Http.Connections.Tests (2)
HttpConnectionDispatcherTests.cs (2)
2963services.AddSingleton(new MessageWrapper() { Buffer = new ReadOnlySequence<byte>(new byte[] { 1, 2, 3 }) }); 2986services.AddSingleton(new MessageWrapper() { Buffer = new ReadOnlySequence<byte>(new byte[] { 4, 5, 6 }) });
Microsoft.AspNetCore.Http.Extensions.Tests (27)
ProblemDetailsDefaultWriterTest.cs (1)
696services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RequestDelegateFactoryTests.cs (10)
1173serviceCollection.AddSingleton(LoggerFactory); 1343.AddSingleton(LoggerFactory) 1344.AddSingleton(Options.Create(new JsonOptions())) 1375.AddSingleton(LoggerFactory) 1376.AddSingleton(Options.Create(new JsonOptions())) 1404.AddSingleton(LoggerFactory) 1737serviceCollection.AddSingleton(LoggerFactory); 3019var serviceProvider = new ServiceCollection().AddSingleton(metadataService).BuildServiceProvider(); 3034var serviceProvider = new ServiceCollection().AddSingleton(metadataService).BuildServiceProvider(); 3262RequestServices = new ServiceCollection().AddSingleton(LoggerFactory).BuildServiceProvider(),
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
211serviceCollection.AddSingleton(LoggerFactory);
RequestDelegateGenerator\RequestDelegateCreationTests.cs (2)
271serviceCollection.AddSingleton<TestService>(new TestService()); 300serviceCollection.AddSingleton<TestService>(new TestService());
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBodyOrService.cs (3)
49(serviceCollection) => serviceCollection.AddSingleton(new TestService()) 78var serviceProvider = CreateServiceProvider((serviceCollection) => serviceCollection.AddSingleton(new TestService())); 217serviceCollection.AddSingleton(new TestService());
RequestDelegateGenerator\RequestDelegateCreationTests.KeyServices.cs (2)
67serviceCollection.AddSingleton(myOriginalService2); 193serviceCollection.AddSingleton(myOriginalService2);
RequestDelegateGenerator\RequestDelegateCreationTests.Metadata.cs (2)
361services.AddSingleton(metadataService).BuildServiceProvider(); 381services.AddSingleton(metadataService).BuildServiceProvider();
RequestDelegateGenerator\RequestDelegateCreationTests.Responses.cs (6)
647.AddSingleton(LoggerFactory) 648.AddSingleton(Options.Create(new JsonOptions())) 670.AddSingleton(LoggerFactory) 671.AddSingleton(Options.Create(new JsonOptions())) 758.AddSingleton(LoggerFactory) 759.AddSingleton(Options.Create(new JsonOptions()))
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
211serviceCollection.AddSingleton(LoggerFactory);
Microsoft.AspNetCore.Http.Results.Tests (29)
AcceptedAtRouteOfTResultTests.cs (1)
223services.AddSingleton(linkGenerator);
AcceptedAtRouteResultTests.cs (1)
133services.AddSingleton(linkGenerator);
ChallengeResultTests.cs (2)
59.AddSingleton(auth.Object) 68services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ContentResultTests.cs (1)
174services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
CreatedAtRouteOfTResultTests.cs (1)
192services.AddSingleton<LinkGenerator>(linkGenerator);
CreatedAtRouteResultTests.cs (1)
138services.AddSingleton<LinkGenerator>(linkGenerator);
ForbidResultTests.cs (2)
126.AddSingleton(auth) 135services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
JsonResultTests.cs (1)
316services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
LocalRedirectResultTests.cs (1)
124serviceCollection.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
NoContentResultTests.cs (1)
92services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ProblemResultTests.cs (1)
254services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RedirectToRouteResultTests.cs (2)
111services.AddSingleton<LinkGenerator>(new TestLinkGenerator { Url = path }); 114services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ResultsOfTTests.cs (1)
56services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
SignInResultTests.cs (2)
92.AddSingleton(auth) 100services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
SignOutResultTests.cs (2)
91.AddSingleton(auth) 99services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\FileContentResultTestBase.cs (1)
356services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\FileStreamResultTestBase.cs (1)
445services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (1)
461services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (2)
491services.AddSingleton<IWebHostEnvironment>(hostingEnvironment); 492services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
StatusCodeResultTests.cs (1)
49services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
UnauthorizedResultTests.cs (1)
59services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Utf8ContentResultTests.cs (1)
92services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ValidationProblemResultTests.cs (1)
180services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Microsoft.AspNetCore.Http.Tests (3)
ApplicationBuilderTests.cs (2)
83services.AddSingleton(LoggerFactory); 109services.AddSingleton(LoggerFactory);
ResponseCookiesTest.cs (1)
34services.AddSingleton<ILoggerFactory>(loggerFactory);
Microsoft.AspNetCore.HttpLogging.Tests (3)
HttpLoggingMiddlewareTests.cs (3)
1917services.AddSingleton(LoggerFactory); 2021services.AddSingleton(interceptor); 2023services.AddSingleton(LoggerFactory);
Microsoft.AspNetCore.HttpsPolicy.Tests (12)
HstsMiddlewareTests.cs (5)
186services.AddSingleton<ILoggerFactory>(loggerFactory); 236services.AddSingleton<ILoggerFactory>(loggerFactory); 291services.AddSingleton<ILoggerFactory>(loggerFactory); 343services.AddSingleton<ILoggerFactory>(loggerFactory); 390services.AddSingleton<ILoggerFactory>(loggerFactory);
HttpsRedirectionMiddlewareTests.cs (7)
34services.AddSingleton<ILoggerFactory>(loggerFactory); 84services.AddSingleton<ILoggerFactory>(loggerFactory); 140services.AddSingleton<ILoggerFactory>(loggerFactory); 245services.AddSingleton<ILoggerFactory>(loggerFactory); 331services.AddSingleton<ILoggerFactory>(loggerFactory); 384services.AddSingleton<ILoggerFactory>(loggerFactory); 426services.AddSingleton<ILoggerFactory>(loggerFactory);
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (26)
CustomSchemaTest.cs (1)
22.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
DefaultPocoTest.cs (1)
23.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
EmptySchemaTest.cs (1)
22.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
MaxKeyLengthSchemaTest.cs (1)
23.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
SqlStoreOnlyUsersTestBase.cs (1)
64services.AddSingleton<IUserStore<TUser>>(new UserOnlyStore<TUser, TestUserDbContext, TKey>((TestUserDbContext)context));
SqlStoreTestBase.cs (5)
51services.AddSingleton((TestDbContext)context); 53services.AddSingleton<ILogger<UserManager<TUser>>>(new TestLogger<UserManager<TUser>>()); 54services.AddSingleton<ILogger<RoleManager<TRole>>>(new TestLogger<RoleManager<TRole>>()); 109services.AddSingleton<IUserStore<TUser>>(new UserStore<TUser, TRole, TestDbContext, TKey>((TestDbContext)context)); 114services.AddSingleton<IRoleStore<TRole>>(new RoleStore<TRole, TestDbContext, TKey>((TestDbContext)context));
UserOnlyCustomContextTest.cs (1)
67.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
UserOnlyTest.cs (1)
28.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
UserStoreGuidKeyTest.cs (4)
46services.AddSingleton<IUserStore<GuidUser>>(new ApplicationUserStore((TestDbContext)context)); 51services.AddSingleton<IRoleStore<GuidRole>>(new ApplicationRoleStore((TestDbContext)context)); 59.AddSingleton(new TestDbContext(new DbContextOptionsBuilder<TestDbContext>().Options)); 76.AddSingleton(new TestDbContext(new DbContextOptionsBuilder<TestDbContext>().Options));
UserStoreIntKeyTest.cs (2)
37.AddSingleton(new TestDbContext(new DbContextOptionsBuilder<TestDbContext>().Options)); 54.AddSingleton(new TestDbContext(new DbContextOptionsBuilder<TestDbContext>().Options));
UserStoreStringKeyTest.cs (2)
38.AddSingleton(new TestDbContext(new DbContextOptionsBuilder<TestDbContext>().Options)); 55.AddSingleton(new TestDbContext(new DbContextOptionsBuilder<TestDbContext>().Options));
UserStoreTest.cs (2)
55services.AddSingleton<IUserStore<IdentityUser>>(new UserStore<IdentityUser, IdentityRole, IdentityDbContext>((IdentityDbContext)context)); 60services.AddSingleton<IRoleStore<IdentityRole>>(new RoleStore<IdentityRole, IdentityDbContext>((IdentityDbContext)context));
UserStoreWithGenericsTest.cs (2)
36services.AddSingleton<IUserStore<IdentityUserWithGenerics>>(new UserStoreWithGenerics((ContextWithGenerics)context, "TestContext")); 41services.AddSingleton<IRoleStore<MyIdentityRole>>(new RoleStoreWithGenerics((ContextWithGenerics)context, "TestContext"));
VersionOneSchemaTest.cs (1)
22.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
VersionTwoSchemaTest.cs (1)
22.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build())
Microsoft.AspNetCore.Identity.FunctionalTests (13)
Infrastructure\FunctionalTestsServiceCollectionExtensions.cs (1)
32services.AddSingleton(sender);
MapIdentityApiTests.cs (12)
168services.AddSingleton<TimeProvider>(clock); 328services.AddSingleton<TimeProvider>(clock); 485services.AddSingleton<IEmailSender>(emailSender); 510services.AddSingleton<IEmailSender>(emailSender); 535services.AddSingleton<IEmailSender>(emailSender); 595services.AddSingleton<IEmailSender>(emailSender); 638services.AddSingleton<IEmailSender>(emailSender); 955services.AddSingleton<IEmailSender>(emailSender); 1026services.AddSingleton<IEmailSender>(emailSender); 1117services.AddSingleton<IEmailSender>(emailSender); 1225services.AddSingleton<IEmailSender>(emailSender); 1286builder.Services.AddSingleton(LoggerFactory);
Microsoft.AspNetCore.Identity.InMemory.Test (14)
ControllerTest.cs (5)
32.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()) 34.AddSingleton(contextAccessor.Object); 84.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()) 86.AddSingleton(contextAccessor.Object); 111context.RequestServices = new ServiceCollection().AddSingleton(auth.Object).BuildServiceProvider();
FunctionalTest.cs (6)
122services.AddSingleton<TimeProvider>(timeProvider); 171services.AddSingleton<TimeProvider>(timeProvider); 222var server = await CreateServer(services => services.AddSingleton<TimeProvider>(timeProvider), testCore: testCore); 251var server = await CreateServer(services => services.AddSingleton<TimeProvider>(timeProvider), testCore: testCore); 392services.AddSingleton<IUserStore<PocoUser>>(store); 393services.AddSingleton<IRoleStore<PocoRole>>(store);
InMemoryStoreTest.cs (2)
20services.AddSingleton<IUserStore<PocoUser>>((InMemoryStore<PocoUser, PocoRole>)context); 25services.AddSingleton<IRoleStore<PocoRole>>((InMemoryStore<PocoUser, PocoRole>)context);
InMemoryUserStoreTest.cs (1)
21services.AddSingleton<IUserStore<PocoUser>>((InMemoryUserStore<PocoUser>)context);
Microsoft.AspNetCore.Identity.Specification.Tests (4)
IdentitySpecificationTestBase.cs (3)
55services.AddSingleton<ILogger<UserManager<TUser>>>(new TestLogger<UserManager<TUser>>()); 56services.AddSingleton<ILogger<RoleManager<TRole>>>(new TestLogger<RoleManager<TRole>>()); 70services.AddSingleton<ILogger<RoleManager<TRole>>>(new TestLogger<RoleManager<TRole>>());
UserManagerSpecificationTests.cs (1)
67services.AddSingleton<ILogger<UserManager<TUser>>>(new TestLogger<UserManager<TUser>>());
Microsoft.AspNetCore.Identity.Test (45)
IdentityBuilderTest.cs (16)
57.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 67.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 78.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 93.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 108.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 118.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 128.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 138.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 150.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 162.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()) 179.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 203.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 222.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 242.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 254.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 265.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build());
SecurityStampValidatorTest.cs (21)
120services.AddSingleton(options.Object); 121services.AddSingleton(signInManager.Object); 122services.AddSingleton<ISecurityStampValidator>(new SecurityStampValidator<PocoUser>(options.Object, signInManager.Object, new LoggerFactory())); 123services.AddSingleton(authService.Object); 174services.AddSingleton(options.Object); 175services.AddSingleton(signInManager); 176services.AddSingleton<ISecurityStampValidator>(new SecurityStampValidator<PocoUser>(options.Object, signInManager, new LoggerFactory())); 215services.AddSingleton(options.Object); 216services.AddSingleton(signInManager.Object); 217services.AddSingleton<ISecurityStampValidator>(new SecurityStampValidator<PocoUser>(options.Object, signInManager.Object, new LoggerFactory())); 218services.AddSingleton(authService.Object); 253services.AddSingleton(options.Object); 254services.AddSingleton(signInManager.Object); 255services.AddSingleton<ISecurityStampValidator>(new SecurityStampValidator<PocoUser>(options.Object, signInManager.Object, new LoggerFactory())); 291services.AddSingleton(options.Object); 292services.AddSingleton(signInManager.Object); 293services.AddSingleton<ISecurityStampValidator>(new SecurityStampValidator<PocoUser>(options.Object, signInManager.Object, new LoggerFactory())); 340services.AddSingleton(options.Object); 341services.AddSingleton(signInManager.Object); 342services.AddSingleton<ITwoFactorSecurityStampValidator>(new TwoFactorSecurityStampValidator<PocoUser>(options.Object, signInManager.Object, new LoggerFactory())); 343services.AddSingleton(authService.Object);
SignInManagerTest.cs (1)
808context.RequestServices = new ServiceCollection().AddSingleton(auth.Object).BuildServiceProvider();
UserManagerTest.cs (7)
19.AddSingleton<IConfiguration>(config) 34.AddSingleton<IConfiguration>(config) 793.AddSingleton<IConfiguration>(config) 890.AddSingleton<IConfiguration>(config) 1746.AddSingleton<IConfiguration>(config) 1748.AddSingleton<IdentityErrorDescriber>(describer) 1749.AddSingleton<IUserStore<PocoUser>>(store.Object)
Microsoft.AspNetCore.InternalTesting (4)
LoggedTest\LoggedTestBase.cs (1)
45public void AddTestLogging(IServiceCollection services) => services.AddSingleton(LoggerFactory);
Logging\XunitLoggerFactoryExtensions.cs (3)
15builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output)); 21builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel)); 27builder.Services.AddSingleton<ILoggerProvider>(new XunitLoggerProvider(output, minLevel, logStart));
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (1)
EndpointMetadataApiDescriptionProviderTest.cs (1)
1534serviceCollection.AddSingleton<IInferredServiceInterface>(new InferredServiceClass());
Microsoft.AspNetCore.Mvc.Core.Test (92)
AcceptedAtActionResultTests.cs (1)
271services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
AcceptedAtRouteResultTests.cs (1)
179services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
AcceptedResultTests.cs (1)
136services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
ApplicationModels\EndpointMetadataProviderTest.cs (1)
268services.AddSingleton(actions);
Authorization\AuthorizeFilterTest.cs (3)
498.AddSingleton(policyProvider) 553.AddSingleton<IAuthorizationPolicyProvider>(policyProvider) 604serviceCollection.AddSingleton(auth.Object);
Builder\MvcApplicationBuilderExtensionsTest.cs (2)
39services.AddSingleton<DiagnosticListener>(new DiagnosticListener("Microsoft.AspNetCore")); 64services.AddSingleton<DiagnosticListener>(new DiagnosticListener("Microsoft.AspNetCore"));
ChallengeResultTest.cs (3)
27.Returns(CreateServices().AddSingleton(auth.Object).BuildServiceProvider()); 52.Returns(CreateServices().AddSingleton(auth.Object).BuildServiceProvider()); 71services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ContentResultTest.cs (2)
267services.AddSingleton<IActionResultExecutor<ContentResult>>(new ContentResultExecutor( 270services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ControllerBaseTest.cs (1)
3198services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Controllers\ControllerActivatorProviderTest.cs (1)
50.AddSingleton(expected)
Controllers\ControllerBinderDelegateProviderTest.cs (1)
1252services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
CreatedAtActionResultTests.cs (1)
91services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
CreatedAtRouteResultTests.cs (1)
105services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
CreatedResultTests.cs (1)
138services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
DependencyInjection\MvcCoreServiceCollectionExtensionsTest.cs (7)
114services.AddSingleton(manager); 133services.AddSingleton(mockManager.Object); 136services.AddSingleton(manager); 153services.AddSingleton<IWebHostEnvironment>(environment.Object); 173services.AddSingleton<IWebHostEnvironment>(environment.Object); 177services.AddSingleton<IWebHostEnvironment>(environment.Object); 199services.AddSingleton<IWebHostEnvironment>(environment.Object);
FileContentResultTest.cs (1)
34.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
FileResultHelperTest.cs (2)
79.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 464services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Filters\MiddlewareFilterConfigurationProviderTest.cs (2)
49services.AddSingleton(loggerFactory); 50services.AddSingleton(Mock.Of<IWebHostEnvironment>());
Filters\MiddlewareFilterTest.cs (1)
336services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ForbidResultTest.cs (2)
142.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 143.AddSingleton(auth)
HttpActionResultTests.cs (1)
54services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
HttpNotFoundObjectResultTest.cs (1)
71services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
HttpOkObjectResultTest.cs (1)
73services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
HttpOkResultTest.cs (1)
45services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
HttpStatusCodeResultTests.cs (1)
51services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Infrastructure\ControllerActionInvokerTest.cs (3)
1708services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance); 1709services.AddSingleton<IOptions<MvcOptions>>(options); 1710services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor(
Infrastructure\DefaultApiProblemDetailsWriterTest.cs (1)
219services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Infrastructure\JsonResultExecutorTestBase.cs (1)
485services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Infrastructure\ObjectResultExecutorTest.cs (1)
462services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ModelBinding\Binders\HeaderModelBinderTests.cs (1)
343services.AddSingleton(Options.Create(options));
ModelBinding\Binders\ServicesModelBinderTest.cs (1)
40services.AddSingleton<IService>(new Service());
ModelBinding\DefaultModelBindingContextTest.cs (1)
158services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ModelBinding\ModelBinderFactoryTest.cs (1)
642services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ModelBinding\ModelBindingHelperTest.cs (1)
1496services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ModelBinding\ParameterBinderTest.cs (1)
707services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ModelBinding\TestModelBinderProviderContext.cs (1)
103services.AddSingleton(Options.Create(mvcOptions));
ModelBinding\Validation\DefaultObjectValidatorTests.cs (1)
582var provider = new ServiceCollection().AddSingleton(service.Object).BuildServiceProvider();
ObjectResultTests.cs (2)
160services.AddSingleton<IActionResultExecutor<ObjectResult>>(new ObjectResultExecutor( 165services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
PhysicalFileResultTest.cs (1)
60services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RedirectToActionResultTest.cs (1)
152services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RedirectToPageResultTest.cs (2)
299services.AddSingleton(factory); 306services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RedirectToRouteResultTest.cs (2)
182services.AddSingleton(factory); 189services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RequireHttpsAttributeTests.cs (1)
240services.AddSingleton<IOptions<MvcOptions>>(options);
Routing\ActionEndpointDataSourceBaseTest.cs (1)
138services.AddSingleton(actions);
Routing\AttributeRouteTest.cs (2)
767.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 809.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
Routing\AttributeRoutingTest.cs (3)
174.AddSingleton<IInlineConstraintResolver>(inlineConstraintResolver); 180return services.AddSingleton(actionDescriptorProvider.Object) 181.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
Routing\ControllerLinkGeneratorExtensionsTest.cs (1)
219.AddSingleton<UrlEncoder>(UrlEncoder.Default);
Routing\KnownRouteValueConstraintTests.cs (1)
31services.AddSingleton(descriptorCollectionProvider);
Routing\PageLinkGeneratorExtensionsTest.cs (1)
189.AddSingleton<UrlEncoder>(UrlEncoder.Default);
Routing\UrlHelperBaseTest.cs (1)
109.AddSingleton<UrlEncoder>(UrlEncoder.Default);
Routing\UrlHelperTestBase.cs (1)
1165.AddSingleton<UrlEncoder>(UrlEncoder.Default);
ServiceFilterAttributeTest.cs (2)
17.AddSingleton(expected) 34.AddSingleton(new TestFilterFactory())
SignInResultTest.cs (2)
103.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 104.AddSingleton(auth)
SignOutResultTest.cs (2)
168.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 169.AddSingleton(auth)
src\Shared\ResultsTests\FileContentResultTestBase.cs (1)
356services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\FileStreamResultTestBase.cs (1)
445services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (1)
461services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (2)
491services.AddSingleton<IWebHostEnvironment>(hostingEnvironment); 492services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
TypeFilterAttributeTest.cs (6)
18.AddSingleton(value) 19.AddSingleton(uri) 40.AddSingleton("Value in DI") 41.AddSingleton(uri) 65.AddSingleton("Value in DI") 66.AddSingleton(uri)
VirtualFileResultTest.cs (1)
85.AddSingleton(webHostEnvironment)
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
TestModelBinderFactory.cs (1)
84services.AddSingleton(options);
Microsoft.AspNetCore.Mvc.Cors.Test (1)
CorsAuthorizationFilterTest.cs (1)
145services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (3)
DataAnnotationsModelValidatorTest.cs (1)
402var provider = new ServiceCollection().AddSingleton(service.Object).BuildServiceProvider();
MvcDataAnnotationsMvcOptionsSetup.cs (2)
19services.AddSingleton<IWebHostEnvironment>(Mock.Of<IWebHostEnvironment>()); 21services.AddSingleton<IOptions<MvcDataAnnotationsLocalizationOptions>>(
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerOutputFormatterTest.cs (1)
808.AddSingleton(Options.Create(new MvcOptions()))
XmlSerializerOutputFormatterTest.cs (1)
590.AddSingleton(Options.Create(new MvcOptions()))
Microsoft.AspNetCore.Mvc.FunctionalTests (4)
ComponentRenderingFunctionalTests.cs (1)
206services.AddSingleton(new WeatherForecastService(new HttpClient(loopHandler)
HtmlGenerationWithCultureTest.cs (1)
142.ConfigureTestServices(services => services.AddSingleton(LoggerFactory)))
Infrastructure\MvcTestFixture.cs (2)
40services.AddSingleton<ILoggerFactory>(loggerFactory); 41services.AddSingleton<TestSink>(testSink);
Microsoft.AspNetCore.Mvc.IntegrationTests (5)
AuthorizeFilterIntegrationTest.cs (1)
182.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
ModelBindingTestHelper.cs (4)
168serviceCollection.AddSingleton(new ApplicationPartManager()); 171serviceCollection.AddSingleton(metadataProvider); 191serviceCollection.AddSingleton(Options.Create(mvcOptions)); 197.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
Microsoft.AspNetCore.Mvc.Localization.Test (2)
MvcLocalizationMvcBuilderExtensionsTest.cs (1)
107builder.Services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
MvcLocalizationMvcCoreBuilderExtensionsTest.cs (1)
107builder.Services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (1)
src\Mvc\Mvc.Core\test\Infrastructure\JsonResultExecutorTestBase.cs (1)
485services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (1)
PageLoaderMatcherPolicyTest.cs (1)
49RequestServices = new ServiceCollection().AddSingleton(loader.Object).BuildServiceProvider(),
Microsoft.AspNetCore.Mvc.Razor.Test (8)
DependencyInjection\MvcRazorMvcCoreBuilderExtensionsTest.cs (1)
42services.AddSingleton(hostingEnvironment.Object);
RazorHotReloadTest.cs (3)
80.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance) 81.AddSingleton<DiagnosticSource>(diagnosticListener) 82.AddSingleton(diagnosticListener)
RazorPageActivatorTest.cs (2)
250.AddSingleton(myService) 251.AddSingleton(htmlHelper)
RazorPageCreateModelExpressionTest.cs (1)
316serviceCollection.AddSingleton<IModelMetadataProvider>(provider);
RazorPageTest.cs (1)
1416.AddSingleton<IViewBufferScope>(bufferScope)
Microsoft.AspNetCore.Mvc.RazorPages.Test (15)
Builder\PageActionEndpointConventionBuilderResourceCollectionExtensionsTest.cs (5)
216collection.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 217collection.AddSingleton<IWebHostEnvironment>(new TestWebHostEnvironment()); 218collection.AddSingleton(new ApplicationPartManager()); 219collection.AddSingleton(new DiagnosticListener("Microsoft.AspNetCore")); 220collection.AddSingleton<DiagnosticSource>(new TestDiagnosticSource());
DependencyInjection\PageConventionCollectionExtensionsTest.cs (1)
980.AddSingleton<IOptions<MvcOptions>>(Options.Options.Create(options))
Filters\PageSaveTempDataPropertyFilterFactoryTest.cs (1)
35serviceCollection.AddSingleton(Mock.Of<ITempDataProvider>());
Infrastructure\DefaultPageFactoryProviderTest.cs (3)
251.AddSingleton<ILogger>(NullLogger.Instance) 294.AddSingleton<ILogger>(NullLogger.Instance) 332.AddSingleton<ILogger>(NullLogger.Instance)
Infrastructure\DefaultPageModelActivatorProviderTest.cs (2)
41serviceCollection.AddSingleton(generator); 71serviceCollection.AddSingleton(generator);
Infrastructure\PageBinderFactoryTest.cs (1)
786services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
PageModelTest.cs (1)
1790.AddSingleton(urlHelperFactory.Object)
src\Mvc\Mvc.Core\test\Routing\ActionEndpointDataSourceBaseTest.cs (1)
138services.AddSingleton(actions);
Microsoft.AspNetCore.Mvc.TagHelpers.Test (7)
DefaultTagHelperActivatorTest.cs (7)
57.AddSingleton(HostingEnvironment) 58.AddSingleton(MemoryCache) 59.AddSingleton(CacheProvider) 60.AddSingleton(HtmlEncoder.Default) 61.AddSingleton(JavaScriptEncoder.Default) 62.AddSingleton(Mock.Of<IUrlHelperFactory>()) 63.AddSingleton(FileVersionProvider)
Microsoft.AspNetCore.Mvc.Test (24)
MvcOptionsSetupTest.cs (4)
287serviceCollection.AddSingleton(new ApplicationPartManager()); 289serviceCollection.AddSingleton<DiagnosticSource>(diagnosticListener); 290serviceCollection.AddSingleton<DiagnosticListener>(diagnosticListener); 314serviceCollection.AddSingleton(hostingEnvironment.Object);
MvcServiceCollectionExtensionsTest.cs (20)
49services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 87services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 102services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 118services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 133services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 166services.AddSingleton<IConfiguration>(new ConfigurationBuilder().AddInMemoryCollection().Build()); 168services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 183services.AddSingleton<IConfiguration>(new ConfigurationBuilder().AddInMemoryCollection().Build()); 185services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 202services.AddSingleton<IConfiguration>(new ConfigurationBuilder().AddInMemoryCollection().Build()); 204services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 219services.AddSingleton<IConfiguration>(new ConfigurationBuilder().AddInMemoryCollection().Build()); 221services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment()); 382services.AddSingleton(manager); 399services.AddSingleton<IWebHostEnvironment>(hostEnvironment); 400services.AddSingleton<IHostEnvironment>(hostEnvironment); 403services.AddSingleton<DiagnosticSource>(diagnosticListener); 404services.AddSingleton<DiagnosticListener>(diagnosticListener); 405services.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 460services.AddSingleton<IWebHostEnvironment>(GetHostingEnvironment());
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (26)
Builder\ControllerActionEndpointConventionBuilderResourceCollectionExtensionsTest.cs (5)
289collection.AddSingleton<IConfiguration>(new ConfigurationBuilder().Build()); 290collection.AddSingleton<IWebHostEnvironment>(new TestWebHostEnvironment()); 291collection.AddSingleton(new ApplicationPartManager()); 292collection.AddSingleton(new DiagnosticListener("Microsoft.AspNetCore")); 293collection.AddSingleton<DiagnosticSource>(new TestDiagnosticSource());
Filters\ControllerSaveTempDataPropertyFilterFactoryTest.cs (1)
31serviceCollection.AddSingleton(Mock.Of<ITempDataProvider>());
PageRemoteAttributeTest.cs (2)
162serviceCollection.AddSingleton<IUrlHelperFactory>(factory.Object); 187.AddSingleton<ILoggerFactory>(new NullLoggerFactory());
PartialViewResultTest.cs (1)
245services.AddSingleton<IActionResultExecutor<PartialViewResult>>(viewExecutor);
RemoteAttributeBaseTest.cs (1)
472serviceCollection.AddSingleton<IStringLocalizerFactory>(localizerFactory);
RemoteAttributeTest.cs (3)
365serviceCollection.AddSingleton<IUrlHelperFactory>(factory.Object); 417serviceCollection.AddSingleton<IUrlHelperFactory>(factory.Object); 488.AddSingleton<ILoggerFactory>(new NullLoggerFactory());
Rendering\DefaultTemplatesUtilities.cs (4)
270.AddSingleton(viewEngine) 271.AddSingleton(urlHelperFactory.Object) 272.AddSingleton(Mock.Of<IViewComponentHelper>()) 273.AddSingleton(innerHelper)
ViewComponentResultTest.cs (6)
414services.AddSingleton<IViewComponentHelper>(helper); 456services.AddSingleton<IViewComponentHelper>(helper); 662services.AddSingleton<DiagnosticListener>(diagnosticSource); 664services.AddSingleton(Options.Create(new MvcViewOptions())); 672services.AddSingleton<IViewComponentDescriptorProvider>(new FixedSetViewComponentDescriptorProvider(descriptors)); 674services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
ViewExecutorTest.cs (2)
163serviceCollection.AddSingleton<IModelMetadataProvider>(new EmptyModelMetadataProvider()); 165serviceCollection.AddSingleton<ITempDataDictionary>(new TempDataDictionary(httpContext, tempDataProvider));
ViewResultTest.cs (1)
257services.AddSingleton<IActionResultExecutor<ViewResult>>(viewExecutor);
Microsoft.AspNetCore.OpenApi (1)
Extensions\OpenApiServiceCollectionExtensions.cs (1)
112services.AddSingleton(new NamedService<OpenApiDocumentService>(documentName));
Microsoft.AspNetCore.OpenApi.Tests (21)
Extensions\OpenApiEndpointRouteBuilderExtensionsTests.cs (4)
185.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 186.AddSingleton<IHostEnvironment>(hostEnvironment) 187.AddSingleton(CreateApiDescriptionGroupCollectionProvider()) 188.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance)
Extensions\OpenApiRouteHandlerBuilderExtensionTests.cs (14)
22.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 23.AddSingleton<IHostEnvironment>(hostEnvironment) 45.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 46.AddSingleton<IHostEnvironment>(hostEnvironment) 68.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 69.AddSingleton<IHostEnvironment>(hostEnvironment) 96.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 97.AddSingleton<IHostEnvironment>(hostEnvironment) 125.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 126.AddSingleton<IHostEnvironment>(hostEnvironment) 157.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 158.AddSingleton<IHostEnvironment>(hostEnvironment) 187.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 188.AddSingleton<IHostEnvironment>(hostEnvironment)
Services\OpenApiDocumentProviderTests.cs (3)
64.AddSingleton<IServiceProviderIsService>(serviceProviderIsService) 65.AddSingleton<IHostEnvironment>(hostEnvironment) 66.AddSingleton(CreateApiDescriptionGroupCollectionProvider());
Microsoft.AspNetCore.Owin.Tests (1)
OwinExtensionTests.cs (1)
41new ServiceCollection().AddSingleton(new FakeService()).BuildServiceProvider());
Microsoft.AspNetCore.RequestDecompression.Tests (6)
RequestDecompressionMiddlewareTests.cs (6)
213services.AddSingleton<ILoggerFactory>(loggerFactory); 283services.AddSingleton<ILoggerFactory>(loggerFactory); 359services.AddSingleton<ILoggerFactory>(loggerFactory); 454services.AddSingleton<ILoggerFactory>(loggerFactory); 540services.AddSingleton<ILoggerFactory>(loggerFactory); 698services.AddSingleton<ILoggerFactory>(loggerFactory);
Microsoft.AspNetCore.ResponseCompression.Tests (4)
ResponseCompressionMiddlewareTest.cs (4)
449services.AddSingleton<ILoggerFactory>(loggerFactory); 510services.AddSingleton<ILoggerFactory>(loggerFactory); 573services.AddSingleton<ILoggerFactory>(loggerFactory); 1251services.AddSingleton<ILoggerFactory>(loggerFactory);
Microsoft.AspNetCore.Routing.Tests (20)
Builder\EndpointRoutingApplicationBuilderExtensionsTest.cs (4)
355services.AddSingleton<MatcherFactory>(matcherFactory); 363services.AddSingleton(listener); 364services.AddSingleton<DiagnosticSource>(listener); 365services.AddSingleton(Mock.Of<IHostEnvironment>());
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (2)
973serviceCollection.AddSingleton(LoggerFactory); 992appServiceCollection.AddSingleton(appService);
DefaultLinkParserTest.cs (3)
27var parser = CreateLinkParser(services => { services.AddSingleton<ILoggerFactory>(loggerFactory); }, endpoint); 49var parser = CreateLinkParser(services => { services.AddSingleton<ILoggerFactory>(loggerFactory); }, endpoint1, endpoint2); 73var parser = CreateLinkParser(services => { services.AddSingleton<ILoggerFactory>(loggerFactory); }, endpoint0, endpoint1, endpoint2);
Matching\DfaMatcherTest.cs (3)
41serviceCollection.AddSingleton<MatcherPolicy>(policies[i]); 47serviceCollection.AddSingleton<EndpointSelector>(endpointSelector); 52serviceCollection.AddSingleton<ILoggerFactory>(loggerFactory);
RouteCollectionTest.cs (1)
621services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
RouteHandlerOptionsTests.cs (2)
23services.AddSingleton<IHostEnvironment>(new HostEnvironment 43services.AddSingleton<IHostEnvironment>(new HostEnvironment
RouteTest.cs (4)
654services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance); 658services.AddSingleton<UrlEncoder>(new UrlTestEncoder()); 1516services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance); 1761services.AddSingleton<IInlineConstraintResolver>(_inlineConstraintResolver);
TemplateParserDefaultValuesTests.cs (1)
129services.AddSingleton<IInlineConstraintResolver>(_inlineConstraintResolver);
Microsoft.AspNetCore.Server.IIS (1)
WebHostBuilderIISExtensions.cs (1)
37services.AddSingleton(new IISNativeApplication(new NativeSafeHandle(iisConfigData.pNativeApplication)));
Microsoft.AspNetCore.Server.IISIntegration (1)
WebHostBuilderIISExtensions.cs (1)
91services.AddSingleton<IStartupFilter>(new IISSetupFilter(pairingToken, new PathString(path), isWebSocketsSupported));
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (11)
KestrelServerOptionsTests.cs (3)
84serviceCollection.AddSingleton(Mock.Of<IHostEnvironment>()); 85serviceCollection.AddSingleton(Mock.Of<ILogger<KestrelServer>>()); 86serviceCollection.AddSingleton(Mock.Of<ILogger<HttpsConnectionMiddleware>>());
KestrelServerTests.cs (8)
39.AddSingleton(Mock.Of<IHostEnvironment>()) 789serviceCollection.AddSingleton(Mock.Of<IHostEnvironment>()); 790serviceCollection.AddSingleton(Mock.Of<ILogger<KestrelServer>>()); 791serviceCollection.AddSingleton(Mock.Of<ILogger<HttpsConnectionMiddleware>>()); 792serviceCollection.AddSingleton(Mock.Of<ILogger<CertificatePathWatcher>>()); 928serviceCollection.AddSingleton(Mock.Of<IHostEnvironment>()); 929serviceCollection.AddSingleton(Mock.Of<ILogger<KestrelServer>>()); 930serviceCollection.AddSingleton(Mock.Of<ILogger<HttpsConnectionMiddleware>>());
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
InMemoryTransportBenchmark.cs (1)
56.ConfigureServices(services => services.AddSingleton<IConnectionListenerFactory>(transportFactory))
Microsoft.AspNetCore.Server.Kestrel.Tests (1)
KestrelConfigurationLoaderTests.cs (1)
29.AddSingleton<IHostEnvironment>(env)
Microsoft.AspNetCore.Session.Tests (9)
SessionTests.cs (9)
664services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 713services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 762services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 810services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 862services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 925services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 991services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 1056services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions())) 1108services.AddSingleton<IDistributedCache>(new UnreliableCache(new MemoryCache(new MemoryCacheOptions()))
Microsoft.AspNetCore.SignalR.Client.Core (3)
HubConnectionBuilderExtensions.cs (3)
36hubConnectionBuilder.Services.AddSingleton<IRetryPolicy>(new DefaultRetryPolicy()); 51hubConnectionBuilder.Services.AddSingleton<IRetryPolicy>(new DefaultRetryPolicy(reconnectDelays)); 63hubConnectionBuilder.Services.AddSingleton(retryPolicy);
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (18)
HubConnectionTests.cs (11)
48hubConnectionBuilder.Services.AddSingleton(protocol); 64hubConnectionBuilder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory); 98connectionBuilder.Services.AddSingleton(protocol); 137connectionBuilder.Services.AddSingleton(protocol); 167connectionBuilder.Services.AddSingleton(protocol); 2574connectionBuilder.Services.AddSingleton(protocol); 2632connectionBuilder.Services.AddSingleton(protocol); 2707connectionBuilder.Services.AddSingleton(protocol); 2771connectionBuilder.Services.AddSingleton(protocol); 2814connectionBuilder.Services.AddSingleton(protocol); 2878connectionBuilder.Services.AddSingleton<IHubProtocol>(new HubProtocolVersionTests.SingleVersionHubProtocol(HubProtocols["json"], 1));
HubConnectionTests.Tracing.cs (3)
61connectionBuilder.Services.AddSingleton(protocol); 599connectionBuilder.Services.AddSingleton(protocol); 689connectionBuilder.Services.AddSingleton(protocol);
HubProtocolVersionTests.cs (4)
76connectionBuilder.Services.AddSingleton<IHubProtocol>(new VersionedJsonHubProtocol(1000)); 120connectionBuilder.Services.AddSingleton<IHubProtocol>(new VersionedJsonHubProtocol(1000)); 121connectionBuilder.Services.AddSingleton<IConnectionFactory>(proxyConnectionFactory); 175connectionBuilder.Services.AddSingleton<IHubProtocol>(new SingleVersionHubProtocol(new VersionedJsonHubProtocol(int.MaxValue), int.MaxValue));
Microsoft.AspNetCore.SignalR.Client.Tests (26)
HubConnectionBuilderTests.cs (2)
30builder.Services.AddSingleton<IConnectionFactory>(new HttpConnectionFactory(Options.Create(new HttpConnectionOptions()), NullLoggerFactory.Instance)); 64builder.Services.AddSingleton<IConnectionFactory>(new HttpConnectionFactory(Options.Create(new HttpConnectionOptions()), NullLoggerFactory.Instance));
HubConnectionTests.ConnectionLifecycle.cs (3)
89builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory); 122builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory); 614builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory);
HubConnectionTests.cs (3)
67builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory); 894builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory); 926builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory);
HubConnectionTests.Helpers.cs (2)
30builder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory); 39builder.Services.AddSingleton(protocol);
HubConnectionTests.Reconnect.cs (12)
113builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 214builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 309builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 389builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 487builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 571builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 630builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 685builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 743builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 850builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 983builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory); 1060builder.Services.AddSingleton<IConnectionFactory>(testConnectionFactory);
TestServerTests.cs (4)
25s.AddSingleton(LoggerFactory); 54connectionBuilder.Services.AddSingleton(LoggerFactory); 77s.AddSingleton(LoggerFactory); 99connectionBuilder.Services.AddSingleton(LoggerFactory);
Microsoft.AspNetCore.SignalR.Microbenchmarks (3)
HubConnectionReceiveBenchmark.cs (1)
85hubConnectionBuilder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory);
HubConnectionSendBenchmark.cs (1)
65hubConnectionBuilder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory);
HubConnectionStartBenchmark.cs (1)
51hubConnectionBuilder.Services.AddSingleton<IConnectionFactory>(delegateConnectionFactory);
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (1)
RedisEndToEnd.cs (1)
227hubConnectionBuilder.Services.AddSingleton(protocol);
Microsoft.AspNetCore.SignalR.Tests (55)
AddSignalRTests.cs (1)
36serviceCollection.AddSingleton<IConfigureOptions<HubOptions>>(hubOptions);
HubConnectionHandlerTests.Activity.cs (10)
28builder.AddSingleton(hubMethodTestSource); 31builder.AddSingleton(testSource); 103builder.AddSingleton(hubMethodTestSource); 106builder.AddSingleton(testSource); 175builder.AddSingleton(testSource); 234builder.AddSingleton(testSource); 307builder.AddSingleton(testSource); 354builder.AddSingleton(testSource); 406builder.AddSingleton(testSource); 457builder.AddSingleton(testSource);
HubConnectionHandlerTests.ClientResult.cs (1)
289builder.AddSingleton(tcsService);
HubConnectionHandlerTests.cs (30)
44var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(trackDispose), LoggerFactory); 70s.AddSingleton(trackDispose); 98var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory); 700services.AddSingleton(mockLifetimeManager.Object); 701services.AddSingleton(mockHubActivator.Object); 742services.AddSingleton(mockLifetimeManager.Object); 774services.AddSingleton(mockLifetimeManager.Object); 2548services.AddSingleton<IUserIdProvider>(userIdProvider); 2872services.AddSingleton(state); 3017services.AddSingleton(tcsService); 3076services.AddSingleton(tcsService); 3323builder.AddSingleton(tcsService); 3378builder.AddSingleton(tcsService); 3434builder.AddSingleton(tcsService); 3504builder.AddSingleton(tcsService); 3770services.AddSingleton(tcsService); 3820var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory); 3843var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory); 3899LoggerFactory, (services) => services.AddSingleton<IHubProtocol>(testProtocol.Object)); 4212builder.AddSingleton(tcsService); 4253builder.AddSingleton(tcsService); 4298builder.AddSingleton(tcsService); 4329builder.AddSingleton(tcsService); 4356builder.AddSingleton(tcsService); 4509services.AddSingleton(callerService); 4734provider.AddSingleton(channel.Reader); 5116var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory); 5140var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory); 5244var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory); 5307var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider(s => s.AddSingleton(state), LoggerFactory);
HubConnectionHandlerTestUtils\Utils.cs (1)
69services.AddSingleton(loggerFactory);
HubFilterTests.cs (12)
29services.AddSingleton(tcsService); 85services.AddSingleton(tcsService); 105services.AddSingleton(tcsService); 235services.AddSingleton(tcsService2); 286services.AddSingleton(tcsService2); 516services.AddSingleton(new VerifyMethodFilter(tcsService)); 536services.AddSingleton(counter); 585services.AddSingleton(counter); 726services.AddSingleton(tcsService); 767services.AddSingleton(tcsService); 802services.AddSingleton(tcsService); 843services.AddSingleton(tcsService);
Microsoft.AspNetCore.SignalR.Tests.Utils (1)
HubConnectionBuilderTestExtensions.cs (1)
17hubConnectionBuilder.Services.AddSingleton(loggerFactory);
Microsoft.AspNetCore.SpaServices.Extensions.Tests (3)
SpaServicesExtensionsTests.cs (3)
61services.AddSingleton<ILoggerFactory>(ListLoggerFactory); 66services.AddSingleton(listener); 67services.AddSingleton<DiagnosticSource>(listener);
Microsoft.AspNetCore.StaticFiles.FunctionalTests (8)
FallbackStaticFileTest.cs (2)
30services.AddSingleton(LoggerFactory); 83services.AddSingleton(LoggerFactory);
StaticFileMiddlewareTests.cs (6)
28.ConfigureServices(services => services.AddSingleton(LoggerFactory)) 51.ConfigureServices(services => { services.AddSingleton(LoggerFactory); services.AddRouting(); }) 97.ConfigureServices(services => services.AddSingleton(LoggerFactory)) 142.ConfigureServices(services => services.AddSingleton(LoggerFactory)) 184.ConfigureServices(services => services.AddSingleton(LoggerFactory)) 246.ConfigureServices(services => services.AddSingleton(LoggerFactory))
Microsoft.AspNetCore.TestHost (2)
WebHostBuilderExtensions.cs (2)
89s => s.AddSingleton<IStartupConfigureServicesFilter>( 111s => s.AddSingleton<IStartupConfigureContainerFilter<TContainer>>(
Microsoft.AspNetCore.TestHost.Tests (12)
ClientHandlerTests.cs (1)
697services.AddSingleton<ILogger<IWebHost>>(logger);
HttpContextBuilderTests.cs (1)
312services.AddSingleton<ILogger<IWebHost>>(logger);
TestClientTests.cs (2)
604services.AddSingleton<ILogger<IWebHost>>(logger); 724.ConfigureServices(services => services.AddSingleton<ILogger<IWebHost>>(logger))
TestServerTests.cs (8)
127.ConfigureTestServices(services => services.AddSingleton(new SimpleService { Message = "OverridesConfigureServices" })) 128.ConfigureTestContainer<ThirdPartyContainer>(container => container.Services.AddSingleton(new TestService { Message = "OverridesConfigureContainer" })); 140services.AddSingleton(new SimpleService { Message = "ConfigureServices" }); 143container.Services.AddSingleton(new TestService { Message = "ConfigureContainer" }); 184services.AddSingleton(testService); 328.ConfigureServices(services => services.AddSingleton(testService)) 348.ConfigureServices(services => services.AddSingleton(testService)) 506services.AddSingleton<IStartupFilter>(new ReplaceServiceProvidersFeatureFilter(appServices, appServices));
Microsoft.AspNetCore.Tests (15)
WebApplicationTests.cs (15)
180builder.Services.AddSingleton<IServer>(server); 201builder.Services.AddSingleton<IServer>(server); 220builder.Services.AddSingleton<IServer>(server); 239builder.Services.AddSingleton<IServer>(server); 259builder.Services.AddSingleton<IServer>(server); 279builder.Services.AddSingleton<IServer>(new MockAddressesServer()); 293builder.Services.AddSingleton<IHostedService>(hostedService); 294builder.Services.AddSingleton<IServer>(server); 352builder.Services.AddSingleton<IServer>(new MockAddressesServer()); 363builder.Services.AddSingleton<IServer>(new MockAddressesServer(new List<string>().AsReadOnly())); 1402builder.Services.AddSingleton<IConfiguration>(builder.Configuration); 1474builder.Services.AddSingleton(builder.Services); 1504builder.Services.AddSingleton(builder.Services); 1550builder.Services.AddSingleton(builder.Services); 1817Assert.Throws<InvalidOperationException>(() => builder.Services.AddSingleton<IService>(new Service()));
Microsoft.AspNetCore.WebSockets.Tests (1)
KestrelWebSocketHelpers.cs (1)
61s.AddSingleton(loggerFactory);
Microsoft.DotNet.Build.Tasks.Feed.Tests (14)
BuildModelFactoryTests.cs (1)
60.AddSingleton(_taskLoggingHelper)
GenerateBuildManifestTests.cs (1)
62.AddSingleton(fileSystemMock.Object)
PushToBuildStorageTests.cs (12)
214.AddSingleton(fileSystemMock.Object) 245.AddSingleton(fileSystemMock.Object) 290.AddSingleton(fileSystemMock.Object) 294.AddSingleton(nupkgInfoFactoryMock.Object); 339.AddSingleton(fileSystemMock.Object) 343.AddSingleton(nupkgInfoFactoryMock.Object); 386.AddSingleton(fileSystemMock.Object) 390.AddSingleton(nupkgInfoFactoryMock.Object); 436.AddSingleton(fileSystemMock.Object) 440.AddSingleton(nupkgInfoFactoryMock.Object); 540.AddSingleton(fileSystemMock.Object) 545.AddSingleton(nupkgInfoFactoryMock.Object);
Microsoft.DotNet.Helix.Sdk.Tests (12)
CreateXHarnessAndroidWorkItemsTests.cs (2)
256collection.AddSingleton<IFileSystem>(_fileSystem); 257collection.AddSingleton(_zipArchiveManager.Object);
CreateXHarnessAppleWorkItemsTests.cs (3)
329collection.AddSingleton<IFileSystem>(_fileSystem); 330collection.AddSingleton(_profileProvider.Object); 331collection.AddSingleton(_zipArchiveManager.Object);
InstallDotNetToolTests.cs (7)
243collection1.AddSingleton(hangingCommandFactoryMock.Object); 244collection1.AddSingleton(fileSystemMock1.Object); 248collection2.AddSingleton(_commandFactoryMock.Object); 249collection2.AddSingleton(fileSystemMock2.Object); 340collection.AddSingleton(_commandFactoryMock.Object); 341collection.AddSingleton(_fileSystemMock.Object); 342collection.AddSingleton(_helpersMock.Object);
Microsoft.Extensions.Caching.Hybrid (2)
HybridCacheBuilderExtensions.cs (2)
22_ = Throw.IfNull(builder).Services.AddSingleton<IHybridCacheSerializer<T>>(serializer); 46_ = Throw.IfNull(builder).Services.AddSingleton<IHybridCacheSerializerFactory>(factory);
Microsoft.Extensions.Caching.Hybrid.Tests (3)
DistributedCacheTests.cs (2)
47services.AddSingleton<TimeProvider>(Clock); 48services.AddSingleton<ISystemClock>(Clock);
RedisTests.cs (1)
33services.AddSingleton<IConnectionMultiplexer>(redis);
Microsoft.Extensions.Diagnostics (3)
Metrics\Configuration\MetricsBuilderConfigurationExtensions.cs (3)
37builder.Services.AddSingleton<IConfigureOptions<MetricsOptions>>(new MetricsConfigureOptions(configuration)); 38builder.Services.AddSingleton<IOptionsChangeTokenSource<MetricsOptions>>(new ConfigurationChangeTokenSource<MetricsOptions>(configuration)); 39builder.Services.AddSingleton(new MetricsConfiguration(configuration));
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (3)
ApplicationLifecycleHealthChecksExtensionsTests.cs (3)
20serviceCollection.AddSingleton<IHostApplicationLifetime>(new Mock<IHostApplicationLifetime>().Object); 30serviceCollection.AddSingleton<IHostApplicationLifetime>(new Mock<IHostApplicationLifetime>().Object); 40serviceCollection.AddSingleton<IHostApplicationLifetime>(new Mock<IHostApplicationLifetime>().Object);
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (4)
DefaultHealthCheckServiceTest.cs (1)
341b.Services.AddSingleton<ILoggerFactory>(loggerFactory);
DependencyInjection\HealthChecksBuilderTest.cs (1)
69services.AddSingleton(instance);
HealthCheckPublisherHostedServiceTest.cs (2)
770serviceCollection.AddSingleton<IHealthCheckPublisher>(publishers[i]); 781serviceCollection.AddSingleton<ILoggerFactory>(new TestLoggerFactory(sink, enabled: true));
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (8)
Linux\AcceptanceTest.cs (4)
229.AddSingleton<TimeProvider>(clock) 232.AddSingleton<IResourceUtilizationPublisher>(new GenericPublisher(_ => e.Set())) 312.AddSingleton<TimeProvider>(clock) 315.AddSingleton<IResourceUtilizationPublisher>(new GenericPublisher(_ => e.Set()))
ResourceMonitoringExtensionsTests.cs (4)
36.AddSingleton<TimeProvider>(TimeProvider.System) 56.AddSingleton<TimeProvider>(TimeProvider.System) 72.AddSingleton<TimeProvider>(TimeProvider.System) 96builder.Services.AddSingleton<TimeProvider>(TimeProvider.System);
Microsoft.Extensions.Hosting (3)
HostBuilder.cs (3)
301services.AddSingleton<IHostingEnvironment>(hostingEnvironment); 303services.AddSingleton<IHostEnvironment>(hostingEnvironment); 304services.AddSingleton(hostBuilderContext);
Microsoft.Extensions.Hosting.Testing (1)
FakeHostBuilder.cs (1)
31.AddSingleton(options)
Microsoft.Extensions.Http.Diagnostics (1)
Http\HttpDiagnosticsServiceCollectionExtensions.cs (1)
27_ = services.AddSingleton(downstreamDependencyMetadata);
Microsoft.Extensions.Http.Polly (3)
DependencyInjection\PollyServiceCollectionExtensions.cs (3)
70services.AddSingleton<IPolicyRegistry<string>>(registry); 71services.AddSingleton<IReadOnlyPolicyRegistry<string>>(registry); 75services.AddSingleton<IConcurrentPolicyRegistry<string>>(concurrentRegistry);
Microsoft.Extensions.Http.Polly.Tests (1)
DependencyInjection\PollyHttpClientBuilderExtensionsTest.cs (1)
404serviceCollection.AddSingleton(options);
Microsoft.Extensions.Http.Resilience.PerformanceTests (2)
HttpClientFactory.cs (2)
39.AddSingleton<IRedactorProvider>(NullRedactorProvider.Instance) 55services.AddSingleton<ILoggerFactory>(NullLoggerFactory.Instance);
Microsoft.Extensions.Http.Resilience.Tests (4)
Hedging\HedgingTests.cs (1)
48_services.AddSingleton<IRedactorProvider>(NullRedactorProvider.Instance);
Hedging\StandardHedgingTests.cs (1)
208Builder.Services.AddSingleton(provider.Object);
Resilience\HttpClientBuilderExtensionsTests.Resilience.cs (2)
204services.AddSingleton(resilienceProvider.Object); 250services.AddSingleton(providerMock.Object);
Microsoft.Extensions.Logging (1)
LoggingBuilderExtensions.cs (1)
37builder.Services.AddSingleton(provider);
Microsoft.Extensions.Logging.AzureAppServices (8)
AzureAppServicesLoggerFactoryExtensions.cs (8)
64services.AddSingleton(context); 65services.AddSingleton<IOptionsChangeTokenSource<LoggerFilterOptions>>( 71services.AddSingleton<IConfigureOptions<LoggerFilterOptions>>(CreateFileFilterConfigureOptions(config)); 72services.AddSingleton<IConfigureOptions<AzureFileLoggerOptions>>(new FileLoggerConfigureOptions(config, context)); 73services.AddSingleton<IOptionsChangeTokenSource<AzureFileLoggerOptions>>( 80services.AddSingleton<IConfigureOptions<LoggerFilterOptions>>(CreateBlobFilterConfigureOptions(config)); 81services.AddSingleton<IConfigureOptions<AzureBlobLoggerOptions>>(new BlobLoggerConfigureOptions(config, context, configureBlobLoggerOptions)); 82services.AddSingleton<IOptionsChangeTokenSource<AzureBlobLoggerOptions>>(
Microsoft.Extensions.Logging.Configuration (3)
LoggingBuilderExtensions.cs (3)
26builder.Services.AddSingleton<IConfigureOptions<LoggerFilterOptions>>(new LoggerFilterConfigureOptions(configuration)); 27builder.Services.AddSingleton<IOptionsChangeTokenSource<LoggerFilterOptions>>(new ConfigurationChangeTokenSource<LoggerFilterOptions>(configuration)); 29builder.Services.AddSingleton(new LoggingConfiguration(configuration));
Microsoft.Extensions.Options (5)
OptionsBuilder.cs (3)
52Services.AddSingleton<IConfigureOptions<TOptions>>(new ConfigureNamedOptions<TOptions>(Name, configureOptions)); 201Services.AddSingleton<IPostConfigureOptions<TOptions>>(new PostConfigureOptions<TOptions>(Name, configureOptions)); 356Services.AddSingleton<IValidateOptions<TOptions>>(new ValidateOptions<TOptions>(Name, validation, failureMessage));
OptionsServiceCollectionExtensions.cs (2)
102services.AddSingleton<IConfigureOptions<TOptions>>(new ConfigureNamedOptions<TOptions>(name, configureOptions)); 143services.AddSingleton<IPostConfigureOptions<TOptions>>(new PostConfigureOptions<TOptions>(name, configureOptions));
Microsoft.Extensions.Options.ConfigurationExtensions (2)
OptionsConfigurationServiceCollectionExtensions.cs (2)
73services.AddSingleton<IOptionsChangeTokenSource<TOptions>>(new ConfigurationChangeTokenSource<TOptions>(name, config)); 74return services.AddSingleton<IConfigureOptions<TOptions>>(new NamedConfigureFromConfigurationOptions<TOptions>(name, config, configureBinder));
Microsoft.Extensions.Options.Contextual (2)
ContextualOptionsServiceCollectionExtensions.cs (2)
64.AddSingleton<ILoadContextualOptions<TOptions>>( 95return services.AddContextualOptions().AddSingleton<ILoadContextualOptions<TOptions>>(
Microsoft.Extensions.Options.DataAnnotations (1)
OptionsBuilderDataAnnotationsExtensions.cs (1)
24optionsBuilder.Services.AddSingleton<IValidateOptions<TOptions>>(new DataAnnotationValidateOptions<TOptions>(optionsBuilder.Name));
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
DnsServiceEndpointResolverTests.cs (1)
18.AddSingleton<TimeProvider>(timeProvider)
DnsSrvServiceEndpointResolverTests.cs (3)
103.AddSingleton<IDnsQuery>(dnsClientMock) 174.AddSingleton<IDnsQuery>(dnsClientMock) 175.AddSingleton<IConfiguration>(config.Build())
Microsoft.Extensions.ServiceDiscovery.Tests (10)
ConfigurationServiceEndpointResolverTests.cs (7)
28.AddSingleton<IConfiguration>(config.Build()) 64.AddSingleton<IConfiguration>(config.Build()) 145.AddSingleton<IConfiguration>(config.Build()) 245.AddSingleton<IConfiguration>(config.Build()) 287.AddSingleton<IConfiguration>(config.Build()) 354.AddSingleton<IConfiguration>(config.Build()) 399.AddSingleton<IConfiguration>(config.Build())
PassThroughServiceEndpointResolverTests.cs (3)
55.AddSingleton<IConfiguration>(config.Build()) 88.AddSingleton<IConfiguration>(config.Build()) 122.AddSingleton<IConfiguration>(config.Build())
Microsoft.Extensions.ServiceDiscovery.Yarp.Tests (5)
YarpServiceDiscoveryTests.cs (5)
63.AddSingleton<IConfiguration>(config.Build()) 93.AddSingleton<IConfiguration>(config.Build()) 127.AddSingleton<IConfiguration>(config.Build()) 206.AddSingleton<IConfiguration>(config.Build()) 294.AddSingleton<IDnsQuery>(dnsClientMock)
Microsoft.Extensions.Telemetry.Abstractions (2)
Enrichment\EnrichmentServiceCollectionExtensions.cs (2)
35=> Throw.IfNull(services).AddSingleton(Throw.IfNull(enricher)); 56=> Throw.IfNull(services).AddSingleton(Throw.IfNull(enricher));
Microsoft.ML.AutoML (9)
API\AutoMLExperimentExtension.cs (7)
41experiment.ServiceCollection.AddSingleton<IDatasetManager>(datasetManager); 42experiment.ServiceCollection.AddSingleton(datasetManager); 71experiment.ServiceCollection.AddSingleton<IDatasetManager>(datasetManager); 72experiment.ServiceCollection.AddSingleton(datasetManager); 144experiment.ServiceCollection.AddSingleton(pipeline); 352experiment.ServiceCollection.AddSingleton<IMetricManager>(metricManager); 353experiment.ServiceCollection.AddSingleton<IEvaluateMetricManager>(metricManager);
AutoMLExperiment\AutoMLExperiment.cs (2)
123_serviceCollection.AddSingleton<IMonitor>(monitor); 147_serviceCollection.AddSingleton<ITrialRunner>(runner);
Microsoft.ML.GenAI.Phi (2)
Extension\SemanticKernelExtension.cs (2)
20builder.Services.AddSingleton<IChatCompletionService>(new Phi3CausalLMChatCompletionService(pipeline)); 29builder.Services.AddSingleton<ITextGenerationService>(new Phi3CausalLMTextGenerationService(pipeline));
RazorBuildWebSite (2)
Startup.cs (1)
11services.AddSingleton(fileProvider);
StartupWithHostingStartup.cs (1)
19services.AddSingleton(fileProvider);
Sockets.BindTests (2)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (2)
88services.AddSingleton<IStartup>(this); 89services.AddSingleton(context.LoggerFactory);
Sockets.FunctionalTests (4)
src\Servers\Kestrel\shared\test\TransportTestHelpers\TestServer.cs (2)
88services.AddSingleton<IStartup>(this); 89services.AddSingleton(context.LoggerFactory);
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (2)
609.ConfigureServices(s => s.AddSingleton<IMeterFactory>(testMeterFactory)); 703.ConfigureServices(s => s.AddSingleton<IMeterFactory>(testMeterFactory));