Namespace Codebelt.Extensions.Xunit.Hosting
The Codebelt.Extensions.Xunit.Hosting
namespace contains types that provides a uniform way of doing unit testing that is used in conjunction with Microsoft Dependency Injection. The namespace relates to the Xunit.Abstractions
namespace.
Availability: .NET 9, .NET 8 and .NET Standard 2.0
Complements: xUnit: Shared Context between Tests 🔗
Extension Methods
Type | Ext | Methods |
---|---|---|
ILogger{T} | ⬇️ | GetTestStore |
IServiceCollection | ⬇️ | AddXunitTestOutputHelperAccessor |
IServiceProvider | ⬇️ | GetRequiredScopedService |
Classes
- GenericHostFixtureExtensions
Extension methods for the IGenericHostFixture interface.
- HostFixture
Represents the base class from which all implementations of xUnit fixture concept should derive.
- HostTest
Represents the non-generic base class from where its generic equivalent should derive.
- HostTest<T>
Represents a base class from which all implementations of unit testing, that uses Microsoft Dependency Injection, should derive.
- HostTestFactory
Provides a set of static methods for IHost unit testing.
- LoggerExtensions
Extension methods for the ILogger<TCategoryName> interface.
- ManagedHostFixture
Provides a default implementation of the IGenericHostFixture interface.
- ManagedMinimalHostFixture
Provides a default implementation of the IMinimalHostFixture interface.
- MinimalHostFixtureExtensions
Extension methods for the IMinimalHostFixture interface.
- MinimalHostTest
Represents the non-generic base class from where its generic equivalent should derive.
- MinimalHostTest<T>
Represents a base class from which all implementations of unit testing, that uses Microsoft Dependency Injection (minimal style), should derive.
- MinimalHostTestFactory
Provides a set of static methods for IHost unit testing (minimal style).
- SelfManagedHostFixture
Represents a self-managed implementation of the ManagedHostFixture class.
- SelfManagedMinimalHostFixture
Represents a self-managed implementation of the ManagedMinimalHostFixture class.
- ServiceCollectionExtensions
Extension methods for the IServiceCollection interface.
- ServiceProviderExtensions
Provides extension methods for the IServiceProvider interface.
- XunitTestLoggerEntry
Represents a captured log-entry for testing purposes. This record encapsulates the LogLevel, EventId and message.
Interfaces
- IConfigurationTest
Represents the members needed for DI testing with support for Configuration.
- IEnvironmentTest
Represents the members needed for DI testing with support for IHostEnvironment.
- IGenericHostFixture
Provides a way to use Microsoft Dependency Injection in unit tests.
- IHostFixture
Provides a way to support app and lifetime management in unit tests.
- IMinimalHostFixture
Provides a way to use Microsoft Dependency Injection in unit tests (minimal style).