Class ServiceCollectionExtensions
- Assembly
- Codebelt.Extensions.Xunit.Hosting.AspNetCore.dll
Extension methods for the Microsoft.Extensions.DependencyInjection.IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ObjectServiceCollectionExtensions
Methods
AddFakeHttpContextAccessor(IServiceCollection, ServiceLifetime)
Adds a unit test optimized implementation for the Microsoft.AspNetCore.Http.IHttpContextAccessor service.
public static IServiceCollection AddFakeHttpContextAccessor(this IServiceCollection services, ServiceLifetime lifetime = ServiceLifetime.Singleton)
Parameters
services
IServiceCollectionThe Microsoft.Extensions.DependencyInjection.IServiceCollection to extend.
lifetime
ServiceLifetimeThe lifetime of the service. Default is Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton.
Returns
- IServiceCollection
A reference to
services
after the operation has completed.