Skip to main content
Xunit.DependencyInjection package icon

Xunit.DependencyInjection

Use Microsoft.Extensions.DependencyInjection to inject xunit testclass. If you want write Microsoft.Extensions.Logging to ITestOutputHelper, please install Xunit.DependencyInjection.Logging Release notes: 7.7: Add [MethodData], like [MemberData], support injection. 7.6: Fix #48, each TestRunner should have a different scope. 7.5: Add XunitTestCaseRunnerAdapter, It will be support more XunitTestCase type. 7.4: Always set applicationName, unwarp TargetInvocationException. 7.3: Fix #41, activate ITestOutputHelperAccessor on tests without a constructor. 7.2: Add Startup analyzer. 7.1: Fix can't run test case when host.StartAsync() throw exception. 7.0: Add fixture injection and refactor DependencyInjectionTestFramework, you don't have to declare the [assembly: TestFrameworkAttribute] on normal case.

Total Downloads
22.3M
22,324,896
Published
Oct 14, 2021
Latest stable version

Install

.NET CLI
dotnet add package Xunit.DependencyInjection --version 7.7.0
Package Manager Console
Install-Package Xunit.DependencyInjection -Version 7.7.0
PackageReference
<PackageReference Include="Xunit.DependencyInjection" Version="7.7.0" />

Frameworks

.NETFramework4.6.1 .NETStandard2.0

Dependencies

[2.1.0, )
[2.1.0, 3.0.0)
[2.1.0, )
[2.2.0, 3.0.0)

Adoption guide

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

How to read this guidance

Sources: published NuGet v3 registry metadata and explicit NuBrowse editorial guides. Refresh: package metadata is refreshed from NuGet when the page loads. Limit: this is not a security, legal or compatibility guarantee; validate the selected version in your project.

Useful next steps

Move from package metadata to a concrete selection or review workflow.