Namespace Codebelt.Extensions.Xunit.Hosting.AspNetCore
The Codebelt.Extensions.Xunit.Hosting.AspNetCore
namespace contains types that provides a uniform way of doing unit testing that depends on ASP.NET Core and used in conjunction with Microsoft Dependency Injection. The namespace relates to the Microsoft.AspNetCore.TestHost
namespace.
Availability: .NET 9 and .NET 8
Complements: Microsoft.AspNetCore.TestHost namespace 🔗
Extension Methods
Type | Ext | Methods |
---|---|---|
HttpClient | ⬇️ | ToHttpResponseMessageAsync |
IServiceCollection | ⬇️ | AddFakeHttpContextAccessor |
Classes
- AspNetCoreHostFixture
Provides a default implementation of the IAspNetCoreHostFixture interface.
- AspNetCoreHostTest<T>
Represents a base class from which all implementations of unit testing, that uses Microsoft Dependency Injection and depends on ASP.NET Core, should derive.
- HttpClientExtensions
Provides extension methods for the System.Net.Http.HttpClient class.
- ServiceCollectionExtensions
Extension methods for the Microsoft.Extensions.DependencyInjection.IServiceCollection interface.
- WebHostTestFactory
Provides a set of static methods for ASP.NET Core (including, but not limited to MVC, Razor and related) unit testing.
Interfaces
- IAspNetCoreHostFixture
Provides a way to use Microsoft Dependency Injection in unit tests tailored for ASP.NET Core.
- IPipelineTest
Represents the members needed for ASP.NET Core pipeline testing.
- IWebHostTest
Represents the members needed for ASP.NET Core (including but not limited to MVC, Razor and related) testing.