Class ServiceCollectionExtensions
- Namespace
- Codebelt.Extensions.Xunit.Hosting
- Assembly
- Codebelt.Extensions.Xunit.Hosting.dll
Extension methods for the Microsoft.Extensions.DependencyInjection.IServiceCollection interface.
public static class ServiceCollectionExtensions
- Inheritance
-
ObjectServiceCollectionExtensions
Methods
AddXunitTestLogging(IServiceCollection, ITestOutputHelper, LogLevel)
Adds a unit test optimized implementation of output logging to the services
collection.
public static IServiceCollection AddXunitTestLogging(this IServiceCollection services, ITestOutputHelper output, LogLevel minimumLevel = LogLevel.Trace)
Parameters
services
IServiceCollectionThe Microsoft.Extensions.DependencyInjection.IServiceCollection to extend.
output
ITestOutputHelperThe Xunit.Abstractions.ITestOutputHelper that provides the output for the logging.
minimumLevel
LogLevelThe Microsoft.Extensions.Logging.LogLevel that specifies the minimum level to include for the logging.
Returns
- IServiceCollection
A reference to
services
so that additional configuration calls can be chained.
Exceptions
- System.ArgumentNullException
services
cannot be null -or-output
cannot be null.
AddXunitTestLoggingOutputHelperAccessor(IServiceCollection)
Adds a default implementation of ITestOutputHelperAccessor to the services
collection.
public static IServiceCollection AddXunitTestLoggingOutputHelperAccessor(this IServiceCollection services)
Parameters
services
IServiceCollectionThe Microsoft.Extensions.DependencyInjection.IServiceCollection to extend.
Returns
- IServiceCollection
A reference to
services
so that additional configuration calls can be chained.
AddXunitTestLoggingOutputHelperAccessor<T>(IServiceCollection)
Adds a specified implementation of ITestOutputHelperAccessor to the services
collection.
public static IServiceCollection AddXunitTestLoggingOutputHelperAccessor<T>(this IServiceCollection services)
where T : class, ITestOutputHelperAccessor
Parameters
services
IServiceCollectionThe Microsoft.Extensions.DependencyInjection.IServiceCollection to extend.
Returns
- IServiceCollection
A reference to
services
so that additional configuration calls can be chained.
Type Parameters
T
The type of the implementation of ITestOutputHelperAccessor.
Exceptions
- System.ArgumentNullException
services
cannot be null.