Codebelt.Extensions.Xunit.Hosting
10.0.0
dotnet add package Codebelt.Extensions.Xunit.Hosting --version 10.0.0
NuGet\Install-Package Codebelt.Extensions.Xunit.Hosting -Version 10.0.0
<PackageReference Include="Codebelt.Extensions.Xunit.Hosting" Version="10.0.0" />
<PackageVersion Include="Codebelt.Extensions.Xunit.Hosting" Version="10.0.0" />
<PackageReference Include="Codebelt.Extensions.Xunit.Hosting" />
paket add Codebelt.Extensions.Xunit.Hosting --version 10.0.0
#r "nuget: Codebelt.Extensions.Xunit.Hosting, 10.0.0"
#addin nuget:?package=Codebelt.Extensions.Xunit.Hosting&version=10.0.0
#tool nuget:?package=Codebelt.Extensions.Xunit.Hosting&version=10.0.0
About
An open-source project (MIT license) that targets and complements the xUnit.net test platform. It provides a uniform and convenient way of doing unit test for all project types in .NET.
It is, by heart, free, flexible and built to extend and boost your agile codebelt.
Codebelt.Extensions.Xunit.Hosting for .NET
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.
More documentation available at our documentation site:
Related Packages
- Codebelt.Extensions.Xunit 📦
- Codebelt.Extensions.Xunit.App 🏭
- Codebelt.Extensions.Xunit.Hosting 📦
- Codebelt.Extensions.Xunit.Hosting.AspNetCore 📦
CSharp Example
public class HostTestTest : HostTest<HostFixture>
{
private readonly IServiceProvider _provider;
public HostTestTest(HostFixture hostFixture, ITestOutputHelper output) : base(hostFixture, output)
{
_provider = hostFixture.ServiceProvider;
_provider.GetRequiredService<ITestOutputHelperAccessor>().TestOutput = output;
}
// intentionally left out for brevity
public override void ConfigureServices(IServiceCollection services)
{
services.AddXunitTestLoggingOutputHelperAccessor();
services.AddXunitTestLogging(TestOutput);
}
}
A similar but real life example can be found here: AspNetCoreHostTestTest.cs
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Codebelt.Extensions.Xunit (>= 10.0.0)
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.4)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.1)
- Microsoft.Extensions.Configuration.Json (>= 8.0.1)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- System.Threading.Tasks.Extensions (>= 4.6.3)
- xunit.abstractions (>= 2.0.3)
- xunit.assert (>= 2.9.3)
- xunit.extensibility.core (>= 2.9.3)
-
net8.0
- Codebelt.Extensions.Xunit (>= 10.0.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.FileExtensions (>= 8.0.1)
- Microsoft.Extensions.Configuration.Json (>= 8.0.1)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- xunit.abstractions (>= 2.0.3)
- xunit.assert (>= 2.9.3)
- xunit.extensibility.core (>= 2.9.3)
-
net9.0
- Codebelt.Extensions.Xunit (>= 10.0.0)
- Microsoft.Extensions.Configuration (>= 9.0.4)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.4)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.4)
- Microsoft.Extensions.Configuration.Json (>= 9.0.4)
- Microsoft.Extensions.Hosting (>= 9.0.4)
- xunit.abstractions (>= 2.0.3)
- xunit.assert (>= 2.9.3)
- xunit.extensibility.core (>= 2.9.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Codebelt.Extensions.Xunit.Hosting:
Package | Downloads |
---|---|
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. |
|
Codebelt.Extensions.Xunit.App
Provides a convenient set of default API additions for building .NET test projects based on xUnit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
10.0.0 | 1,342 | 10 days ago |
10.0.0-preview.3 | 63 | 10 days ago |
10.0.0-preview.2 | 152 | 13 days ago |
10.0.0-preview.1 | 115 | 15 days ago |
9.1.3 | 214 | 19 days ago |
9.1.2 | 359 | 19 days ago |
9.1.1 | 164 | 21 days ago |
9.1.0 | 158 | 22 days ago |
9.0.1 | 617 | 3 months ago |
9.0.0 | 1,030 | 5 months ago |
9.0.0-rc.1 | 524 | 5 months ago |
9.0.0-preview.11 | 133 | 6 months ago |
9.0.0-preview.10 | 238 | 6 months ago |
9.0.0-preview.9 | 299 | 7 months ago |
9.0.0-preview.8 | 201 | 7 months ago |
9.0.0-preview.7 | 60 | 7 months ago |
9.0.0-preview.6 | 138 | 7 months ago |
9.0.0-preview.5 | 58 | 7 months ago |
9.0.0-preview.4 | 397 | 7 months ago |
9.0.0-preview.3 | 59 | 7 months ago |
9.0.0-preview.2 | 144 | 7 months ago |
9.0.0-preview.1 | 81 | 7 months ago |
8.4.1 | 472 | 7 months ago |
8.4.0 | 183 | 7 months ago |
Version 10.0.0
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Breaking Changes
- RENAMED IHostingEnvironmentTest in the Codebelt.Extensions.Xunit.Hosting namespace to IEnvironmentTest
- RENAMED GenericHostTestFactory in the Codebelt.Extensions.Xunit.Hosting namespace to HostTestFactory
- RENAMED IGenericHostTest in the Codebelt.Extensions.Xunit.Hosting namespace to IHostTest
- REMOVED IServiceTest interface in the Codebelt.Extensions.Xunit.Hosting namespace due to redundancies with the IHost interface (Services property)
- CHANGED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace to an abstract class from which all other host fixture classes derive from (e.g., ManagedWebHostFixture, ManagedHostFixture, etc.)
- REMOVED HostFixtureExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace
- CHANGED IHostFixture interface in the Codebelt.Extensions.Xunit.Hosting namespace to be more confined in scope (e.g., less interface inheritance and ultimately fewer members)
# New Features
- ADDED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace that represents the non-generic base class from where its generic equivalent should derive (e.g., MinimalHostTest{T}, HostTest{T}, etc.)
- ADDED IGenericHostFixture interface in the Codebelt.Extensions.Xunit.Hosting namespace that provides a set of members for configuring the host
- ADDED ManagedHostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace that provides a default implementation of the IGenericHostFixture interface (replaces the legacy HostFixture class)
- ADDED GenericHostFixtureExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace that consist of one extension method for the IGenericHostFixture interface: HasValidState
- ADDED IMinimalHostFixture interface in the Codebelt.Extensions.Xunit.Hosting namespace that provides a set of members for configuring the host (minimal style)
- ADDED ManagedMinimalHostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace that provides a default implementation of the IMinimalHostFixture interface
- ADDED MinimalHostFixtureExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace that consist of one extension method for the IMinimalHostFixture interface: HasValidState
- ADDED MinimalHostTest class in the Codebelt.Extensions.Xunit.Hosting namespace that represents the non-generic base class from where its generic equivalent should derive (e.g., MinimalWebHostTest, {T}, MinimalHostTest{T}, etc.)
- ADDED MinimalHostTestFactory class in the Codebelt.Extensions.Xunit.Hosting namespace that provides a set of static methods for IHost unit testing (minimal style)
- EXTENDED ServiceCollectionExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace with one new extension method for the IServiceCollection interface: An overload of AddXunitTestLogging that does not rely on the ITestOutputHelper interface
- ADDED SelfManagedHostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace that represents a self-managed implementation of the ManagedHostFixture class (i.e., the host is not started automatically)
- ADDED SelfManagedMinimalHostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace that represents a self-managed implementation of the ManagedMinimalHostFixture class (i.e., the host is not started automatically)
Version 9.1.3
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Bug Fixes
- FIXED IGenericHostTest interface in the Codebelt.Extensions.Xunit.Hosting namespace to include the IHostTest interface
# Improvements
- CHANGED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to include IGenericHostTest interface
Version 9.1.2
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Bug Fixes
- FIXED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as prior to 9.1.0 release (hereby being backward compatible as originally intended)
Version 9.1.1
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Bug Fixes
- FIXED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as prior to 9.1.0 release (hereby being backward compatible as originally intended)
- FIXED LoggerExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace to have same behavior as prior to 9.1.0 release (hereby being backward compatible as originally intended)
# Improvements
- CHANGED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace so that IHostEnvironment.ApplicationName is aligned with the equivalent logic found in AspNetCoreHostFixture class (e.g., the assembly name of the calling Test type is used as the default value for the ApplicationName property)
# New Features
- EXTENDED LoggerExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace with one new extension method for the ILogger interface: An overload of GetTestStore that takes an optional string argument (categoryName)
Version 9.1.0
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# New Features
- ADDED HostFixtureExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace that consist of one extension method for the IHostFixture interface: HasValidState
# Improvements
- CHANGED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace to have an additional virtual method: StartConfiguredHost, which is called from the ConfigureHost method, to allow for custom implementations of the host startup process
- CHANGED GenericHostTestFactory class in the Codebelt.Extensions.Xunit.Hosting namespace to accept an optional argument taking a custom implementation of IHostFixture (promote DIP)
Version 9.0.1
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Improvements
- CHANGED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace no longer have a dependency to IHostingEnvironment (TFM netstandard2.0)
- CHANGED HostTest class in the Codebelt.Extensions.Xunit.Hosting namespace no longer have a dependency to IHostingEnvironment (TFM netstandard2.0)
- CHANGED IHostFixture interface in the Codebelt.Extensions.Xunit.Hosting namespace no longer have a dependency to IHostingEnvironment (TFM netstandard2.0)
- CHANGED IHostingEnvironmentTest interface in the Codebelt.Extensions.Xunit.Hosting namespace no longer have a dependency to IHostingEnvironment (TFM netstandard2.0)
Version 9.0.0
Availability: .NET 9, .NET 8 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
- REMOVED Support for TFM .NET 6 (LTS)
# Breaking Changes
- REMOVED AddXunitTestLogging overloaded extension method from the ServiceCollectionExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace
# New Features
- EXTENDED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace to enable ValidateOnBuild and ValidateScopes when TFM is .NET 9 (or greater) and started the Host for consistency with AspNetCoreHostFixture
- EXTENDED IHostFixture interface in the Codebelt.Extensions.Xunit.Hosting namespace with two new methods: Dispose and DisposeAsync
- EXTENDED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace with three new methods: InitializeAsync, OnDisposeManagedResourcesAsync, Dispose and DisposeAsync
Version 8.4.1
Availability: .NET 8, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Breaking Changes
- RENAMED AddXunitTestOutputHelperAccessor and AddXunitTestOutputHelperAccessor{T} on the ServiceCollectionExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace to AddXunitTestLoggingOutputHelperAccessor and AddXunitTestLoggingOutputHelperAccessor{T} (for consistency)
# New Features
- EXTENDED ServiceCollectionExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace with one new extension method for the IServiceCollection interface: An overload of AddXunitTestLogging
Version 8.4.0
Availability: .NET 8, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# New Features
- ADDED ServiceProviderExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace that consist of one extension method for the IServiceProvider interface: GetRequiredScopedService
- EXTENDED ServiceCollectionExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace with two new extension methods for the IServiceCollection interface: AddXunitTestOutputHelperAccessor and AddXunitTestOutputHelperAccessor{T}
Version 8.3.2
Availability: .NET 8, .NET 6 and .NET Standard 2.0
# ALM
- REMOVED Support for TFM .NET 7 (STS)
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version 8.3.1
Availability: .NET 8, .NET 7, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version 8.2.0
Availability: .NET 8, .NET 7, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 8.1.0
Availability: .NET 8, .NET 7, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# New Features
- ADDED LoggerExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace that consist of extension methods for the ILogger{T} interface: GetTestStore{T}
- ADDED ServiceCollectionExtensions class in the Codebelt.Extensions.Xunit.Hosting namespace that consist of extension methods for the IServiceCollection interface: AddXunitTestLogging
- ADDED XunitTestLoggerEntry record in the Codebelt.Extensions.Xunit.Hosting namespace that represents a captured log-entry for testing purposes
Version: 8.0.1
Availability: .NET 8, .NET 7, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
Version: 8.0.0
Availability: .NET 8, .NET 7, .NET 6 and .NET Standard 2.0
# ALM
- CHANGED Dependencies to latest and greatest with respect to TFMs
# Breaking Changes
- REMOVED CreateGenericHostTest method from GenericHostTestFactory class in the Codebelt.Extensions.Xunit.Hosting namespace
# Bug Fixes
- FIXED HostFixture class in the Codebelt.Extensions.Xunit.Hosting namespace by adding a null conditional operator to the ServiceProvider property