Stravaig.Extensions.Logging.Diagnostics.XUnit
3.0.1
dotnet add package Stravaig.Extensions.Logging.Diagnostics.XUnit --version 3.0.1
NuGet\Install-Package Stravaig.Extensions.Logging.Diagnostics.XUnit -Version 3.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Stravaig.Extensions.Logging.Diagnostics.XUnit" Version="3.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Stravaig.Extensions.Logging.Diagnostics.XUnit --version 3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Stravaig.Extensions.Logging.Diagnostics.XUnit, 3.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Stravaig.Extensions.Logging.Diagnostics.XUnit as a Cake Addin #addin nuget:?package=Stravaig.Extensions.Logging.Diagnostics.XUnit&version=3.0.1 // Install Stravaig.Extensions.Logging.Diagnostics.XUnit as a Cake Tool #tool nuget:?package=Stravaig.Extensions.Logging.Diagnostics.XUnit&version=3.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
About
XUnit extensions for Stravaig Log Capture add helper extension methods for outputting the captured logs via XUnit's IOutputTestHelper
.
Version & Framework support
- v2.x: Supports .NET 6.0, 7.0 & 8.0
- v3.x: Supports .NET 6.0, 8.0 & 9.0
How to use
For simple tests you can pass the logger into the class under test like this:
public class MyTestClass
{
private readonly IOutputTestHelper _output;
public MyTestClass(IOutputTestHelper output)
{
_output = output;
}
[Fact]
public void EnsureSomeFunctionalityWorks()
{
// Arrange
var logger = new TestCaptureLogger<ServiceClass>();
var service = new ServiceClass(logger);
// Act
service.DoSomething();
// Assert
_output.WriteLogs(logger); // Writes all captured logs to the output.
logger.GetLogs().Count.ShouldBe(1);
}
}
See also
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Stravaig.Extensions.Logging.Diagnostics (>= 3.0.1)
- xunit.abstractions (>= 2.0.3)
-
net8.0
- Stravaig.Extensions.Logging.Diagnostics (>= 3.0.1)
- xunit.abstractions (>= 2.0.3)
-
net9.0
- Stravaig.Extensions.Logging.Diagnostics (>= 3.0.1)
- xunit.abstractions (>= 2.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
3.0.1 | 796 | 12/1/2024 |
3.0.0-preview.466 | 42 | 11/23/2024 |
3.0.0-preview.463 | 49 | 11/16/2024 |
3.0.0-preview.455 | 41 | 11/3/2024 |
2.2.1 | 10,728 | 2/27/2024 |
2.2.0 | 2,292 | 11/15/2023 |
2.2.0-preview.383 | 68 | 11/15/2023 |
2.1.0 | 2,202 | 7/31/2023 |
2.1.0-preview.356 | 111 | 7/30/2023 |